jsynoptic.builtin
Class Builtin

java.lang.Object
  extended by jsynoptic.base.Plugin
      extended by jsynoptic.builtin.Builtin

public class Builtin
extends Plugin

Default plugin, actually built in jsynoptic

Version:
1.0 2001
Author:
Nicolas Brodu

Nested Class Summary
static class Builtin.ASCIIFileOptionComponent
           
 class Builtin.ExecutableFileProcess
           
 
Field Summary
static MenuResourceBundle.FileFilter asciiFileFilter
           
protected static javax.swing.filechooser.FileFilter[] bothFilters
           
protected static boolean hasAlreadyPutProviders
           
static MenuResourceBundle.FileFilter jsynopticFilter
           
protected static javax.swing.filechooser.FileFilter[] jsynopticOnlyFilters
           
static BasicMessageWriter messageWriter
           
protected  Builtin.ASCIIFileOptionComponent optionPanel
           
protected static java.lang.String[] providedComponents
           
protected static java.lang.String[] providedSources
           
static MenuResourceBundle resources
          Resources
static MenuResourceBundle.FileFilter shellFileFilter
           
 
Fields inherited from class jsynoptic.base.Plugin
EXPORT, IMPORT, OPEN, SAVE
 
Constructor Summary
Builtin()
           
 
Method Summary
 java.lang.String about()
          The information returned here will be displayed in the about box.
 AbstractShape createShape(java.lang.String name, DiagramComponent diagram)
          The plugin is asked to create a new shape for one of the name it provided with getShapes().
 DataSource createSource(java.lang.String name, java.lang.String instanceName)
          The plugin is asked to create a new source from one of the templates it declared with getSources().
 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.
 java.lang.String[] getShapes()
          Shape factory: this plugin may bring its own shapes to put in the shape list.
 java.util.HashMap getShapesMap()
          Get a map that links the plugin shapes classes with the corresponding shapes names.
 java.lang.String[] getSources()
          Source factory: this plugin may bring its own source templates to put in the predefined sources list.
 Template[] getTemplates()
          Template factory: this plugin may bring templates to put in the template list.
protected  boolean processAsciiFile(java.io.File f, int action)
           
 boolean processFile(java.io.File f, int action)
          See getFileFilters for usage description.
protected  boolean processJSynopticFile(java.io.File f, int action)
           
protected  boolean processShellFile(java.io.File f)
          Execute a shell file.
 boolean saveShapeContainer(ShapesContainer sc, java.io.File f)
          Save Shape container into a specified file.
 
Methods inherited from class jsynoptic.base.Plugin
addPluginHashMap, exit, getDataSourceIcons, getHelp, getShapeName, 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
Resources


messageWriter

public static BasicMessageWriter messageWriter

jsynopticFilter

public static MenuResourceBundle.FileFilter jsynopticFilter

asciiFileFilter

public static MenuResourceBundle.FileFilter asciiFileFilter

shellFileFilter

public static MenuResourceBundle.FileFilter shellFileFilter

bothFilters

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

jsynopticOnlyFilters

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

providedComponents

protected static java.lang.String[] providedComponents

hasAlreadyPutProviders

protected static boolean hasAlreadyPutProviders

optionPanel

protected Builtin.ASCIIFileOptionComponent optionPanel

providedSources

protected static java.lang.String[] providedSources
Constructor Detail

Builtin

public Builtin()
Method Detail

getShapes

public java.lang.String[] getShapes()
Description copied from class: Plugin
Shape factory: this plugin may bring its own shapes to put in the shape list. It will then be asked to create a new shape when requested. As an example, the plot is a basic shape provided with JSynoptic.

Overrides:
getShapes in class Plugin
Returns:
An array of shape names, or null if this plugin does not provide any shape.

getShapesMap

public java.util.HashMap getShapesMap()
Description copied from class: Plugin
Get a map that links the plugin shapes classes with the corresponding shapes names.

Overrides:
getShapesMap in class Plugin
Returns:
the hash map if the plugin is able to create shapes, or null if this plugin does not provide any shape.

createShape

public AbstractShape createShape(java.lang.String name,
                                 DiagramComponent diagram)
Description copied from class: Plugin
The plugin is asked to create a new shape for one of the name it provided with getShapes(). Note that the newly created shape will be inserted in a diagram set up with an ActionPopup popup menu. Thus, it may implement JSynoptic ContextualActionProvider interface to interact with the user.

Overrides:
createShape in class Plugin
Parameters:
name - The name of the shape to create.
diagram - The diagram this shape will be inserted into.

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

processJSynopticFile

protected boolean processJSynopticFile(java.io.File f,
                                       int action)

saveShapeContainer

public boolean saveShapeContainer(ShapesContainer sc,
                                  java.io.File f)
                           throws java.io.IOException
Save Shape container into a specified file.

Parameters:
sc, - the shape container
f, - the file where to save shape container contents
Returns:
Throws:
java.io.IOException

processAsciiFile

protected boolean processAsciiFile(java.io.File f,
                                   int action)

processShellFile

protected boolean processShellFile(java.io.File f)
Execute a shell file. Shell execution is performed in another thread

Parameters:
shell - file
Returns:
true if shell file could be launched

processFile

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

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

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)

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..

  • getTemplates

    public Template[] getTemplates()
    Description copied from class: Plugin
    Template factory: this plugin may bring templates to put in the template list.

    Overrides:
    getTemplates in class Plugin
    Returns:
    An array of templates, or null if this plugin does not provide any template.

    getSources

    public java.lang.String[] getSources()
    Description copied from class: Plugin
    Source factory: this plugin may bring its own source templates to put in the predefined sources list. It will then be asked to create a new source when requested. How it does it is at the plugin discretion (for example, if the source template needs arguments, it's up to the plugin to open a dialog box/whatever to get them).

    Overrides:
    getSources in class Plugin
    Returns:
    An array of source template names, or null if this plugin does not provide any source template (default).
    See Also:
    Plugin.getShapes()

    createSource

    public DataSource createSource(java.lang.String name,
                                   java.lang.String instanceName)
    Description copied from class: Plugin
    The plugin is asked to create a new source from one of the templates it declared with getSources(). The newly created source will be inserted at top level in the source tree, unless the plugin already set it in a collection.

    Overrides:
    createSource in class Plugin
    Parameters:
    name - The name of the source template.
    instanceName - The desired name of the source created from this template.
    Returns:
    the newly created source, or null if this plugin cannot create a source of this type