net.sf.jaxodraw.io.exports
Class JaxoExportPS

java.lang.Object
  extended by net.sf.jaxodraw.plugin.AbstractJaxoPlugin
      extended by net.sf.jaxodraw.plugin.JaxoExportPlugin
          extended by net.sf.jaxodraw.io.exports.JaxoExport
              extended by net.sf.jaxodraw.io.exports.JaxoExportPS
All Implemented Interfaces:
java.awt.print.Printable, JaxoPlugin, JaxoLocalized

public class JaxoExportPS
extends JaxoExport
implements java.awt.print.Printable

The class that is responsible for exporting to postscript output: portrait, landscape or EPS are possible options. Asks for an export file name.

Since:
2.0

Field Summary
static int PS_EPS
          An integer specifying the postscript EPS mode.
static int PS_PS
          An integer specifying the postscript portrait mode.
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
JaxoExportPS(int psmode)
          Constructor.
 
Method Summary
 void commitConfiguration()
          Apply the changes made in the configuration panel.
 java.lang.String description()
          Return a short description (preferably internationalized) of what this plugin does.
protected  void exportTo(java.lang.String fileName)
          Export the graph to the given nonempty file name.
 javax.swing.JComponent getConfigurationPanel()
          Returns a panel that allows to configure optional parameters of this export format.
 java.lang.String getFileExtension()
          Extension to be used for plugin files.
 java.lang.String getFileExtensionDescription()
          Description to be used for plugin file extensions.
 java.lang.String getFormatName()
          The name of the plugin (export or import) format.
 int getMode()
          Returns the current export mode.
 java.lang.String getShortName()
          Return a short name for this plugin.
 boolean isLandscape()
          Returns the landscape mode.
 java.lang.String pluginId()
          This must return the class name of the plugin (MyPlugin.class.getName()).
 void preview(JaxoPreview p, boolean sameWindow)
          Show a preview.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          The actual printing routine required by the Printable interface.
 void setLandscape(boolean value)
          Sets the landscape mode.
 void setMode(int value)
          Sets the export mode.
 void updateLanguage()
          Updates the component with the current language as set in the preferences (JaxoPrefs.PREF_LANGUAGE).
protected  void writePS(java.lang.String fileName)
          The class that is responsible for exporting to postscript output: portrait, landscape or EPS are possible options.
 
Methods inherited from class net.sf.jaxodraw.io.exports.JaxoExport
getBuiltInFormats, getWarningForGraph, makeAvailableAtRuntime, version
 
Methods inherited from class net.sf.jaxodraw.plugin.JaxoExportPlugin
errorDialogMessage, export, export, getCanvasSize, getColorSpaceWarningForLaTeX, getGraph, getLaTeXTextWarning, getPSTextWarning, getPSTextWarningForLaTeX, paintGraph, preview, setCanvasSize, setGraph, showErrorDialog
 
Methods inherited from class net.sf.jaxodraw.plugin.AbstractJaxoPlugin
close, close, close, close, getClassName, getFailure, 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
 

Field Detail

PS_PS

public static final int PS_PS
An integer specifying the postscript portrait mode.

See Also:
Constant Field Values

PS_EPS

public static final int PS_EPS
An integer specifying the postscript EPS mode.

See Also:
Constant Field Values
Constructor Detail

JaxoExportPS

public JaxoExportPS(int psmode)
Constructor.

Parameters:
psmode - PS_PS or PS_EPS.
Method Detail

isLandscape

public final boolean isLandscape()
Returns the landscape mode.

Returns:
True for landscape, false for portrait..

setLandscape

public void setLandscape(boolean value)
Sets the landscape mode.

Parameters:
value - True for landscape, false for portrait.

setMode

public final void setMode(int value)
Sets the export mode.

Parameters:
value - The new export mode (PS_XYZ constant).

getMode

public final int getMode()
Returns the current export mode.

Returns:
The current export mode.

getFormatName

public final java.lang.String getFormatName()
The name of the plugin (export or import) format.

Specified by:
getFormatName in class AbstractJaxoPlugin
Returns:
An (internationalized) name of the plugin format.

getFileExtension

public final java.lang.String getFileExtension()
Extension to be used for plugin files.

Specified by:
getFileExtension in class AbstractJaxoPlugin
Returns:
The file extension.

getFileExtensionDescription

public final java.lang.String getFileExtensionDescription()
Description to be used for plugin file extensions.

Specified by:
getFileExtensionDescription in class AbstractJaxoPlugin
Returns:
An (internationalized) description of the file extension.

description

public java.lang.String description()
Return a short description (preferably internationalized) of what this plugin does.

Specified by:
description in interface JaxoPlugin
Returns:
a description.

pluginId

public java.lang.String pluginId()
This must return the class name of the plugin (MyPlugin.class.getName()). It is used to uniquely identify the plugin.

Specified by:
pluginId in interface JaxoPlugin
Returns:
the class name of the plugins' main class.

getShortName

public java.lang.String getShortName()
Return a short name for this plugin. This is used to construct names of output files, eg to get a "jaxodraw-pdf-plugin.properties" file, the short name should just be "pdf".

Specified by:
getShortName in interface JaxoPlugin
Returns:
The short name of this plugin.

exportTo

protected void exportTo(java.lang.String fileName)
                 throws JaxoPluginExecutionException
Export the graph to the given nonempty file name.

Specified by:
exportTo in class JaxoExportPlugin
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.

print

public final int print(java.awt.Graphics g,
                       java.awt.print.PageFormat pf,
                       int pageIndex)
The actual printing routine required by the Printable interface.

Specified by:
print in interface java.awt.print.Printable
Parameters:
g - The specified graphics context.
pf - The specified page format.
pageIndex - The specified page index.
Returns:
Either Printable.PAGE_EXISTS or Printable.NO_SUCH_PAGE.

writePS

protected final void writePS(java.lang.String fileName)
The class that is responsible for exporting to postscript output: portrait, landscape or EPS are possible options. The export file name is given by fileName.

Parameters:
fileName - The export file name.

preview

public void preview(JaxoPreview p,
                    boolean sameWindow)
Show a preview.

Specified by:
preview in class JaxoExportPlugin
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.

commitConfiguration

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

Specified by:
commitConfiguration in class JaxoExportPlugin

getConfigurationPanel

public javax.swing.JComponent getConfigurationPanel()
Returns a panel that allows to configure optional parameters of this export format.

Specified by:
getConfigurationPanel in class JaxoExportPlugin
Returns:
A panel to configure the postscript orientation.

updateLanguage

public final void updateLanguage()
Updates the component with the current language as set in the preferences (JaxoPrefs.PREF_LANGUAGE).

Specified by:
updateLanguage in interface JaxoLocalized


Licensed under GPL. For more information, see http://jaxodraw.sourceforge.net/license.html or the LICENSE file in the jaxodraw distribution.