net.sf.jaxodraw.plugin
Class JaxoImportPlugin

java.lang.Object
  extended by net.sf.jaxodraw.plugin.AbstractJaxoPlugin
      extended by net.sf.jaxodraw.plugin.JaxoImportPlugin
All Implemented Interfaces:
JaxoPlugin, JaxoLocalized
Direct Known Subclasses:
JaxoImport

public abstract class JaxoImportPlugin
extends AbstractJaxoPlugin

An abstract superclass for all import plugins.

Since:
2.0

Constructor Summary
JaxoImportPlugin()
           
 
Method Summary
 void commitConfiguration()
          Apply the changes made in the configuration panel.
 String getCharsetName()
          Returns the current charset name.
 JComponent getConfigurationPanel()
          Returns a panel that allows to configure optional parameters of this import format.
 JaxoGraph importGraph(File f)
          Imports a graph from the given file.
protected abstract  JaxoGraph importGraph(InputStream inputStream)
          Import a graph from a Reader.
 JaxoGraph importGraph(String fileName)
          Imports a graph from the given file.
 void setCharsetName(String name)
          Sets the charset name.
 
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.plugin.JaxoPlugin
description, getShortName, makeAvailableAtRuntime, pluginId, version
 
Methods inherited from interface net.sf.jaxodraw.util.JaxoLocalized
updateLanguage
 

Constructor Detail

JaxoImportPlugin

public JaxoImportPlugin()
Method Detail

getCharsetName

public String getCharsetName()
Returns the current charset name. Defaults to null, which means the system default encoding will be used for reading files.

Returns:
The current charset name.

setCharsetName

public void setCharsetName(String name)
Sets the charset name.

Parameters:
name - The charset to use. No check is done here whether the given charset name is valid or the corresponding Charset is supported. Set this to null to use the system default encoding.

importGraph

public JaxoGraph importGraph(String fileName)
Imports a graph from the given file.

Parameters:
fileName - The absolute path to the file to be imported
Returns:
The imported JaxoGraph or null, if no file was imported

importGraph

public JaxoGraph importGraph(File f)
Imports a graph from the given file.

Parameters:
f - The file to be imported
Returns:
The imported JaxoGraph or null, if no file was imported

getConfigurationPanel

public JComponent getConfigurationPanel()
Returns a panel that allows to configure optional parameters of this import format. By default, an empty component is returned, implementing classes should override this to provide a custom component.

Returns:
an empty component by default.

commitConfiguration

public void commitConfiguration()
Apply the changes made in the configuration panel. By default does nothing, implementing classes should override this to provide a custom behavior.


importGraph

protected abstract JaxoGraph importGraph(InputStream inputStream)
                                  throws JaxoPluginExecutionException
Import a graph from a Reader.

Parameters:
inputStream - An InputStream to supply the input data.
Returns:
The imported JaxoGraph or null, if importing failed.
Throws:
JaxoPluginExecutionException - if the graph could not be imported. Note that the message of the Exception should be an internationalized String.


Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.