Package uk.ac.starlink.topcat.plot2

# Class PlotExporter

java.lang.Object
uk.ac.starlink.topcat.plot2.PlotExporter

public class PlotExporter extends 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

Modifier and Type
Method
Description
`void`
`attemptSave(Icon icon, 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(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 Details

### PlotExporter

public PlotExporter()
Constructor.

## Method Details

### exportPlot

public void exportPlot(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(Icon icon, File file, uk.ac.starlink.ttools.plot.GraphicExporter exporter) throws 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:
  `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