org.argouml.uml.reveng
Class FileImportSupport

java.lang.Object
  |
  +--org.argouml.uml.reveng.FileImportSupport
All Implemented Interfaces:
ArgoModule, Pluggable, PluggableImport
Direct Known Subclasses:
JavaImport

public abstract class FileImportSupport
extends java.lang.Object
implements PluggableImport

This is the base class for import from files. It provides JFileChooser for file selection and other methods common to file import. It assumes that similar classes will be written for other input sources.

Version:
$Revision: 1.3 $

Field Summary
protected  javax.swing.JRadioButton attribute
           
protected  javax.swing.JPanel configPanel
           
protected  javax.swing.JRadioButton datatype
           
protected static java.lang.String separator
           
protected  java.lang.Object theFile
          Object(s) selected in chooser
 
Fields inherited from interface org.argouml.application.api.Pluggable
PLUGIN_PREFIX, PLUGIN_TITLE, PLUGIN_VENDOR
 
Fields inherited from interface org.argouml.application.api.ArgoModule
cat, MODULEFILENAME, MODULEFILENAME_ALTERNATE
 
Constructor Summary
FileImportSupport()
           
 
Method Summary
 javax.swing.JComponent getChooser(Import imp)
          Create chooser for objects we are to import.
 javax.swing.JComponent getConfigPanel()
          Get the panel that lets the user set reverse engineering parameters.
 ClassdiagramLayouter getLayout(UMLDiagram diagram)
          Provide layout for modified class diagram.
 java.util.Vector getList(Import _import)
          This method returns a Vector with objects to import.
 java.lang.String getModuleAuthor()
           
 java.util.Vector getModulePopUpActions(java.util.Vector popUpActions, java.lang.Object context)
           
 java.lang.String getModuleVersion()
           
abstract  SuffixFilter[] getSuffixFilters()
          Provides an array of suffixe filters for the module.
 boolean inContext(java.lang.Object[] context)
          A function which allows a plug-in to decide if it is available under a specific context.
 boolean initializeModule()
           
 boolean isModuleEnabled()
           
 boolean isParseable(java.lang.Object f)
          Tells if the file is parseable or not.
 void parseFile(Project p, java.lang.Object o, DiagramInterface diagram, Import _import)
          This method parses 1 file.
 void setModuleEnabled(boolean tf)
           
 boolean shutdownModule()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.argouml.application.api.ArgoModule
getModuleDescription, getModuleKey, getModuleName
 

Field Detail

configPanel

protected javax.swing.JPanel configPanel

attribute

protected javax.swing.JRadioButton attribute

datatype

protected javax.swing.JRadioButton datatype

separator

protected static final java.lang.String separator
See Also:
Constant Field Values

theFile

protected java.lang.Object theFile
Object(s) selected in chooser

Constructor Detail

FileImportSupport

public FileImportSupport()
Method Detail

getConfigPanel

public javax.swing.JComponent getConfigPanel()
Get the panel that lets the user set reverse engineering parameters.

Specified by:
getConfigPanel in interface PluggableImport
Returns:
the panel with configuration info for plugin or null if no parameters are needed.

parseFile

public void parseFile(Project p,
                      java.lang.Object o,
                      DiagramInterface diagram,
                      Import _import)
               throws java.lang.Exception
This method parses 1 file. Default implementation does nothing.

Specified by:
parseFile in interface PluggableImport
Parameters:
p - - the current project
o - - object to be parsed
diagram - - current class diagram when Import was invoked
_import - - current import session. Use this object to get common settings.
Throws:
java.lang.Exception - Parser exception.

getChooser

public javax.swing.JComponent getChooser(Import imp)
Create chooser for objects we are to import. Default implemented chooser is JFileChooser.

Specified by:
getChooser in interface PluggableImport
Parameters:
imp - - current import session
Returns:
the panel to show in import dialog

getList

public java.util.Vector getList(Import _import)

This method returns a Vector with objects to import.

Processing each file in turn is equivalent to a breadth first search through the directory structure.

Specified by:
getList in interface PluggableImport
Parameters:
_import - - current import session
Returns:
vector of objects, selected by chooser

isParseable

public boolean isParseable(java.lang.Object f)
Tells if the file is parseable or not. Must match with files that are actually parseable.

Specified by:
isParseable in interface PluggableImport
Parameters:
f - file to be tested.
Returns:
true if parseable, false if not.

getLayout

public ClassdiagramLayouter getLayout(UMLDiagram diagram)
Provide layout for modified class diagram.

Specified by:
getLayout in interface PluggableImport

inContext

public boolean inContext(java.lang.Object[] context)
Description copied from interface: Pluggable
A function which allows a plug-in to decide if it is available under a specific context. One example of a plugin with multiple criteria is the PluggableMenu. PluggableMenu requires the first context to be a JMenuItem which wants the PluggableMenu attached to as the context, so that it can determine that it would attach to a menu. The second context is an internal (non-localized) description of the menu such as "File" or "View" so that the plugin can further decide.

Specified by:
inContext in interface Pluggable
Parameters:
context - An identification of the context. The interpretation of criteria is specific to the plug-in type, but must be consistent across that type. The plug-in must want to be exposed to all contexts.
Returns:
True if the plug-in wants to make itself available for this context, otherwise false.

initializeModule

public boolean initializeModule()
Specified by:
initializeModule in interface ArgoModule

shutdownModule

public boolean shutdownModule()
Specified by:
shutdownModule in interface ArgoModule

setModuleEnabled

public void setModuleEnabled(boolean tf)
Specified by:
setModuleEnabled in interface ArgoModule

isModuleEnabled

public boolean isModuleEnabled()
Specified by:
isModuleEnabled in interface ArgoModule

getModuleVersion

public java.lang.String getModuleVersion()
Specified by:
getModuleVersion in interface ArgoModule

getModuleAuthor

public java.lang.String getModuleAuthor()
Specified by:
getModuleAuthor in interface ArgoModule

getModulePopUpActions

public java.util.Vector getModulePopUpActions(java.util.Vector popUpActions,
                                              java.lang.Object context)
Specified by:
getModulePopUpActions in interface ArgoModule

getSuffixFilters

public abstract SuffixFilter[] getSuffixFilters()
Provides an array of suffixe filters for the module. Must be implemented in child class.

Returns:
SuffixFilter[] suffixes for processing


ArgoUML © 1996-2003 (20040229)ArgoUML Project HomeArgoUML Cookbook