Class JaxoExportPlugin

java.lang.Object
net.sf.jaxodraw.plugin.AbstractJaxoPlugin
net.sf.jaxodraw.plugin.JaxoExportPlugin
All Implemented Interfaces:
JaxoPlugin, JaxoLocalized
Direct Known Subclasses:
JaxoExport

public abstract class JaxoExportPlugin extends AbstractJaxoPlugin
An abstract superclass for all export plugins.
Since:
2.0
  • Constructor Details

    • JaxoExportPlugin

      public JaxoExportPlugin()
  • Method Details

    • setGraph

      public final void setGraph(JaxoGraph newGraph)
      Sets the graph to export. Makes a backup of the original graph and breaks all groups.
      Parameters:
      newGraph - The graph to export.
    • getGraph

      public final JaxoGraph getGraph()
      Returns the current graph to export.
      Returns:
      The graph to export.
    • setCanvasSize

      @Deprecated public void setCanvasSize(Dimension value)
      Deprecated.
      this is not used, exports should not depend on the canvas size!
      Set the canvas size. In general, the canvas size is not needed.
      Parameters:
      value - The canvas size.
    • getCanvasSize

      @Deprecated protected Dimension getCanvasSize()
      Deprecated.
      this is not used, exports should not depend on the canvas size!
      Returns the canvas size.
      Returns:
      The canvas size, or null, if it hasn't been set.
    • export

      public final void export(String fileName)
      Export the current graph to the given nonempty file name. Checks if fileName is empty, if yes, does nothing.
      Parameters:
      fileName - The file to export to.
    • export

      public void export(JaxoGraph exportGraph, String fileName)
      Export a graph to a file.
      Parameters:
      exportGraph - The graph to export.
      fileName - Absolute path of the file to export to.
    • preview

      public void preview(JaxoPreview p)
      Show a preview in a new window.
      Parameters:
      p - The JaxoPreview to use.
    • paintGraph

      protected void paintGraph(Graphics2D g2d, boolean printing)
      Paint the graph.
      Parameters:
      g2d - the graphics context to paint to.
      printing - set to true to suppress any UI-elements or aids.
    • showErrorDialog

      protected void showErrorDialog(String message)
      Show an error message window, unless silent.
      Parameters:
      message - The message to display.
    • errorDialogMessage

      protected String errorDialogMessage(String fileName)
      Returns a default error message for exporting to 'fileName'.
      Parameters:
      fileName - The file name to insert in the message.
      Returns:
      a default error message.
    • getLaTeXTextWarning

      public String getLaTeXTextWarning()
      Returns an internationalized warning when latex texts are present in the graph.
      Returns:
      A translated warning.
    • getPSTextWarning

      public String getPSTextWarning()
      Returns an internationalized warning when postscript texts are present in the graph.
      Returns:
      A translated warning.
    • getPSTextWarningForLaTeX

      public String getPSTextWarningForLaTeX()
      Returns an internationalized warning when postscript texts are present in the graph.
      Returns:
      A translated warning.
    • getColorSpaceWarningForLaTeX

      public String getColorSpaceWarningForLaTeX()
      Returns an internationalized warning when the color space is the complete one.
      Returns:
      A translated warning.
    • commitConfiguration

      public abstract void commitConfiguration()
      Apply the changes made in the configuration panel.
    • getConfigurationPanel

      public abstract JComponent getConfigurationPanel()
      Returns a panel that allows to configure optional parameters of this export format.
      Returns:
      Null by default, no options to configure.
    • exportTo

      protected abstract void exportTo(String fileName) throws JaxoPluginExecutionException
      Export the graph to the given nonempty file name.
      Parameters:
      fileName - The file to export to.
      Throws:
      JaxoPluginExecutionException - if exporting fails. The exception message sould be displayable in error dialogs, so it should be an internationalized string.
    • preview

      public abstract void preview(JaxoPreview p, boolean sameWindow)
      Show a preview.
      Parameters:
      p - The JaxoPreview to show.
      sameWindow - If false, a new window will be opened for the preview. If true, and if a preview window for the current format is open already, the same window will be used for the preview. Not all implementations may support this feature.
    • getWarningForGraph

      public abstract String getWarningForGraph()
      Returns a warning, eg if a part of the graph cannot be exported to the current format.
      Returns:
      An (internationalized) String, or null for no warning.