Package net.sf.jaxodraw.plugin
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 Summary
Constructors Constructor Description JaxoExportPlugin()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract voidcommitConfiguration()Apply the changes made in the configuration panel.protected java.lang.StringerrorDialogMessage(java.lang.String fileName)Returns a default error message for exporting to 'fileName'.voidexport(java.lang.String fileName)Export the current graph to the given nonempty file name.voidexport(JaxoGraph exportGraph, java.lang.String fileName)Export a graph to a file.protected abstract voidexportTo(java.lang.String fileName)Export the graph to the given nonempty file name.protected java.awt.DimensiongetCanvasSize()Deprecated.this is not used, exports should not depend on the canvas size!java.lang.StringgetColorSpaceWarningForLaTeX()Returns an internationalized warning when the color space is the complete one.abstract javax.swing.JComponentgetConfigurationPanel()Returns a panel that allows to configure optional parameters of this export format.JaxoGraphgetGraph()Returns the current graph to export.java.lang.StringgetLaTeXTextWarning()Returns an internationalized warning when latex texts are present in the graph.java.lang.StringgetPSTextWarning()Returns an internationalized warning when postscript texts are present in the graph.java.lang.StringgetPSTextWarningForLaTeX()Returns an internationalized warning when postscript texts are present in the graph.abstract java.lang.StringgetWarningForGraph()Returns a warning, eg if a part of the graph cannot be exported to the current format.protected voidpaintGraph(java.awt.Graphics2D g2d, boolean printing)Paint the graph.voidpreview(JaxoPreview p)Show a preview in a new window.abstract voidpreview(JaxoPreview p, boolean sameWindow)Show a preview.voidsetCanvasSize(java.awt.Dimension value)Deprecated.this is not used, exports should not depend on the canvas size!voidsetGraph(JaxoGraph newGraph)Sets the graph to export.protected voidshowErrorDialog(java.lang.String message)Show an error message window, unless silent.-
Methods inherited from class net.sf.jaxodraw.plugin.AbstractJaxoPlugin
close, getClassName, getFailure, getFileExtension, getFileExtensionDescription, getFormatName, getLang, getLog, getParentComponent, getProperties, getProperty, getProperty, getShortGraphName, hasFailed, isSilent, loadProperties, pluginName, registerDictionary, setFailure, setParentComponent, setProperty, setShortGraphName, setSilent, storeProperties
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.jaxodraw.util.JaxoLocalized
updateLanguage
-
Methods inherited from interface net.sf.jaxodraw.plugin.JaxoPlugin
description, getShortName, makeAvailableAtRuntime, pluginId, version
-
-
-
-
Method Detail
-
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(java.awt.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 java.awt.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(java.lang.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, java.lang.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(java.awt.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(java.lang.String message)
Show an error message window, unless silent.- Parameters:
message- The message to display.
-
errorDialogMessage
protected java.lang.String errorDialogMessage(java.lang.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 java.lang.String getLaTeXTextWarning()
Returns an internationalized warning when latex texts are present in the graph.- Returns:
- A translated warning.
-
getPSTextWarning
public java.lang.String getPSTextWarning()
Returns an internationalized warning when postscript texts are present in the graph.- Returns:
- A translated warning.
-
getPSTextWarningForLaTeX
public java.lang.String getPSTextWarningForLaTeX()
Returns an internationalized warning when postscript texts are present in the graph.- Returns:
- A translated warning.
-
getColorSpaceWarningForLaTeX
public java.lang.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 javax.swing.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(java.lang.String fileName) throws JaxoPluginExecutionExceptionExport 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 java.lang.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.
-
-