jsynoptic.plugins.export
Class SynopticsExportPlugin

java.lang.Object
  extended by jsynoptic.base.Plugin
      extended by jsynoptic.plugins.export.SynopticsExportPlugin
All Implemented Interfaces:
FileReferenceListener

public class SynopticsExportPlugin
extends Plugin
implements FileReferenceListener

A plugin dedicated to export some synoptics to an archive (zip) file. It shall be possible to include all synoptics references into this archive file.

Author:
zxpletran007

Field Summary
protected static int BUFFER
           
protected static javax.swing.filechooser.FileFilter[] filters
           
protected static SynopticsExportPanel optionPanel
           
static MenuResourceBundle resources
           
protected static MenuResourceBundle.FileFilter zipFileFilter
           
 
Fields inherited from class jsynoptic.base.Plugin
EXPORT, IMPORT, OPEN, SAVE
 
Constructor Summary
SynopticsExportPlugin()
           
 
Method Summary
 java.lang.String about()
          The information returned here will be displayed in the about box.
protected  void addFileResourceToArchive(java.util.zip.ZipOutputStream zos, java.io.File f, java.lang.String zipEntryName)
          Add a file entry to the given archive output stream
protected  boolean archiveSynoptics(java.io.File[] files, java.io.File zipFile)
          Archive file into zip archive file
protected  void copyResource(java.io.File source, java.io.File destination)
          Copy the resource to another destination
protected  void deleteResource(java.io.File resource)
          Delete a file.
 void fileReferenceCalled(java.io.File srcFile)
          Called whenever a file reference has occurred
 javax.swing.filechooser.FileFilter[] getFileFilters(int action)
          Give the plugin an occasion to add its file filters.
 javax.swing.JComponent getOptionPanelForFilter(javax.swing.filechooser.FileFilter filter)
          Enables a plugin to show an option panel when the user selects a file using one of the plugin file filters.
 boolean processFile(java.io.File zipFile, int action)
          See getFileFilters for usage description.
protected  void restoreAbsoluteLinks(ShapesContainer sc, java.io.File f)
           
protected  boolean saveShapesContainer(ShapesContainer sc, java.io.File f)
          Save shape container
protected  void setRelativeLinks(ShapesContainer sc, java.io.File f)
           
 
Methods inherited from class jsynoptic.base.Plugin
addPluginHashMap, createShape, createSource, exit, getDataSourceIcons, getHelp, getShapeName, getShapes, getShapesMap, getSources, getTemplates, load, newComponent, newDesktopComponent, newSourceComponent, newSourceComponent, processDataSourceCollection, processSynoptic, setMenu, setMenu, setToolBarItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

public static MenuResourceBundle resources

BUFFER

protected static final int BUFFER
See Also:
Constant Field Values

zipFileFilter

protected static MenuResourceBundle.FileFilter zipFileFilter

filters

protected static javax.swing.filechooser.FileFilter[] filters

optionPanel

protected static SynopticsExportPanel optionPanel
Constructor Detail

SynopticsExportPlugin

public SynopticsExportPlugin()
Method Detail

getOptionPanelForFilter

public javax.swing.JComponent getOptionPanelForFilter(javax.swing.filechooser.FileFilter filter)
Description copied from class: Plugin
Enables a plugin to show an option panel when the user selects a file using one of the plugin file filters.

Overrides:
getOptionPanelForFilter in class Plugin
Returns:
a component to display, or null if there is no option for this filter (default)

getFileFilters

public javax.swing.filechooser.FileFilter[] getFileFilters(int action)
Description copied from class: Plugin
Give the plugin an occasion to add its file filters. If a file is selected by the user and it is accepted by one of the FileFilters returned by this function, then the processFile method will be called on that file. In graphic mode, the file filters will end up in a JFileChooser. In batch mode, the file filters will be used directly on a user-specified file. In any case, this should be transparent for the plugin.

Overrides:
getFileFilters in class Plugin
Parameters:
action - What to do with the file. Currently OPEN or SAVE.
Returns:
An array containing all the file filters added by this plugin

processFile

public boolean processFile(java.io.File zipFile,
                           int action)
Description copied from class: Plugin
See getFileFilters for usage description.

Overrides:
processFile in class Plugin
Parameters:
zipFile - The file to process
action - What to do with the file. Currently OPEN or SAVE.
Returns:
true if the action could be performed successfully.

saveShapesContainer

protected boolean saveShapesContainer(ShapesContainer sc,
                                      java.io.File f)
                               throws java.io.IOException
Save shape container

Parameters:
shapeContainer -
Returns:
Throws:
java.io.IOException

restoreAbsoluteLinks

protected void restoreAbsoluteLinks(ShapesContainer sc,
                                    java.io.File f)
                             throws java.io.IOException
Throws:
java.io.IOException

setRelativeLinks

protected void setRelativeLinks(ShapesContainer sc,
                                java.io.File f)
                         throws java.io.IOException
Throws:
java.io.IOException

addFileResourceToArchive

protected void addFileResourceToArchive(java.util.zip.ZipOutputStream zos,
                                        java.io.File f,
                                        java.lang.String zipEntryName)
                                 throws java.io.IOException
Add a file entry to the given archive output stream

Parameters:
zos -
f -
Throws:
java.io.IOException

about

public java.lang.String about()
Description copied from class: Plugin
The information returned here will be displayed in the about box. You should return an HTML 3.2 text content. This text will be included in a
  • tag. Returning null is permitted, and disables completely this plugin information. Default is to use the class name, without the package prefix.

    Overrides:
    about in class Plugin
    Returns:
    the information about this plugin, including authors, license, etc..

  • fileReferenceCalled

    public void fileReferenceCalled(java.io.File srcFile)
    Description copied from interface: FileReferenceListener
    Called whenever a file reference has occurred

    Specified by:
    fileReferenceCalled in interface FileReferenceListener
    Parameters:
    srcFile - - The file that has been referenced

    archiveSynoptics

    protected boolean archiveSynoptics(java.io.File[] files,
                                       java.io.File zipFile)
    Archive file into zip archive file

    Parameters:
    source -
    zipFile -
    Returns:
    true if archive process has succeeded

    deleteResource

    protected void deleteResource(java.io.File resource)
    Delete a file. If file is a repository, delete also its contents

    Parameters:
    resource - the file to be deleted

    copyResource

    protected void copyResource(java.io.File source,
                                java.io.File destination)
    Copy the resource to another destination

    Parameters:
    source - The file to copy
    destination - The new file