Class PlotExporter


  • public class PlotExporter
    extends java.lang.Object
    Provides a GUI for exporting a plot to an external format, generally to a file.
    Since:
    12 Mar 2013
    Author:
    Mark Taylor
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  PlotExporter.IconFactory
      Defines an object that can supply an icon for exporting.
    • Constructor Summary

      Constructors 
      Constructor Description
      PlotExporter()
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void attemptSave​(javax.swing.Icon icon, java.io.File file, uk.ac.starlink.ttools.plot.GraphicExporter exporter)
      Attempts to write a given icon to a file in a particular graphics format.
      void exportPlot​(java.awt.Component parent, PlotExporter.IconFactory ifact)
      Offers the user a GUI to export a supplied plot icon in a user-chosen format.
      static PlotExporter getInstance()
      Returns a single instance of this class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PlotExporter

        public PlotExporter()
        Constructor.
    • Method Detail

      • exportPlot

        public void exportPlot​(java.awt.Component parent,
                               PlotExporter.IconFactory ifact)
        Offers the user a GUI to export a supplied plot icon in a user-chosen format.
        Parameters:
        parent - parent component for dialogue window
        ifact - supplies the icon to export
      • attemptSave

        public void attemptSave​(javax.swing.Icon icon,
                                java.io.File file,
                                uk.ac.starlink.ttools.plot.GraphicExporter exporter)
                         throws java.io.IOException
        Attempts to write a given icon to a file in a particular graphics format.
        Parameters:
        icon - image to paint
        file - destination file
        exporter - output graphics format handler
        Throws:
        java.io.IOException - in case of write error
      • getInstance

        public static PlotExporter getInstance()
        Returns a single instance of this class. You don't have to use it as a singleton, but doing it like that allows it to retain current directory for output file etc.
        Returns:
        shared instance