org.argouml.uml.reveng
Class FileImportSupport

java.lang.Object
  extended byorg.argouml.uml.reveng.FileImportSupport
All Implemented Interfaces:
org.argouml.application.api.ArgoModule, org.argouml.application.api.Pluggable, org.argouml.application.api.PluggableImport

public abstract class FileImportSupport
extends Object
implements org.argouml.application.api.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: 3313 $

Field Summary
 
Fields inherited from interface org.argouml.application.api.Pluggable
PLUGIN_PREFIX, PLUGIN_TITLE, PLUGIN_VENDOR
 
Fields inherited from interface org.argouml.application.api.ArgoModule
MODULEFILENAME, MODULEFILENAME_ALTERNATE
 
Constructor Summary
FileImportSupport()
           
 
Method Summary
protected  JRadioButton getAttribute()
           
 JComponent getChooser(Import imp)
          Create chooser for objects we are to import.
 JComponent getConfigPanel()
          Get the panel that lets the user set reverse engineering parameters.
protected  JRadioButton getDatatype()
           
 org.argouml.uml.diagram.static_structure.layout.ClassdiagramLayouter getLayout(org.argouml.uml.diagram.ui.UMLDiagram diagram)
          Provide layout for modified class diagram.
 Vector getList(Import theImport)
          This method returns a Vector with objects to import.
 String getModuleAuthor()
          The module author.
 Vector getModulePopUpActions(Vector popUpActions, Object context)
          Calls all modules to let them add to a popup menu.
 String getModuleVersion()
          The module version.
abstract  org.argouml.util.SuffixFilter[] getSuffixFilters()
          Provides an array of suffixe filters for the module.
 boolean inContext(Object[] context)
          A function which allows a plug-in to decide if it is available under a specific context.
 boolean initializeModule()
          Method called when Argo is loading a module.
 boolean isModuleEnabled()
          Allows determination if a module is enabled or disabled.
 boolean isParseable(Object f)
          Tells if the file is parseable or not.
 void parseFile(org.argouml.kernel.Project p, Object o, DiagramInterface diagram, Import theImport)
          This method parses 1 file.
 void setModuleEnabled(boolean tf)
          Called to enable or disable a module programmatically.
 boolean shutdownModule()
          Method called when Argo is unloading a module.
 
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
 

Constructor Detail

FileImportSupport

public FileImportSupport()
Method Detail

getConfigPanel

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

Specified by:
getConfigPanel in interface org.argouml.application.api.PluggableImport
Returns:
the panel with configuration info for plugin or null if no parameters are needed.
See Also:
PluggableImport.getConfigPanel()

parseFile

public void parseFile(org.argouml.kernel.Project p,
                      Object o,
                      DiagramInterface diagram,
                      Import theImport)
               throws Exception
This method parses 1 file. Default implementation does nothing.

Specified by:
parseFile in interface org.argouml.application.api.PluggableImport
Parameters:
p - the project
o - the object
diagram - the diagram interface
theImport - the import
Throws:
Exception - Parser exception.
See Also:
PluggableImport.parseFile( org.argouml.kernel.Project, java.lang.Object, org.argouml.uml.reveng.DiagramInterface, org.argouml.uml.reveng.Import)

getChooser

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

Specified by:
getChooser in interface org.argouml.application.api.PluggableImport
Parameters:
imp - The current import session.
Returns:
The panel to show in import dialog.
See Also:
PluggableImport.getChooser(org.argouml.uml.reveng.Import)

getList

public Vector getList(Import theImport)
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 org.argouml.application.api.PluggableImport
Parameters:
theImport - object called by this method.
Returns:
the list
See Also:
PluggableImport.getList(org.argouml.uml.reveng.Import)

isParseable

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

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

getLayout

public org.argouml.uml.diagram.static_structure.layout.ClassdiagramLayouter getLayout(org.argouml.uml.diagram.ui.UMLDiagram diagram)
Provide layout for modified class diagram.

Specified by:
getLayout in interface org.argouml.application.api.PluggableImport
Parameters:
diagram - to layout.
Returns:
the layouter.
See Also:
PluggableImport.getLayout(org.argouml.uml.diagram.ui.UMLDiagram)

inContext

public boolean inContext(Object[] context)
Description copied from interface: org.argouml.application.api.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 org.argouml.application.api.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.
See Also:
Pluggable.inContext(java.lang.Object[])

initializeModule

public boolean initializeModule()
Description copied from interface: org.argouml.application.api.ArgoModule
Method called when Argo is loading a module.

Specified by:
initializeModule in interface org.argouml.application.api.ArgoModule
Returns:
true if the module initialized properly.
See Also:
ArgoModule.initializeModule()

shutdownModule

public boolean shutdownModule()
Description copied from interface: org.argouml.application.api.ArgoModule
Method called when Argo is unloading a module.

Specified by:
shutdownModule in interface org.argouml.application.api.ArgoModule
Returns:
true if the module terminated properly.
See Also:
ArgoModule.shutdownModule()

setModuleEnabled

public void setModuleEnabled(boolean tf)
Description copied from interface: org.argouml.application.api.ArgoModule
Called to enable or disable a module programmatically.

Specified by:
setModuleEnabled in interface org.argouml.application.api.ArgoModule
Parameters:
tf - true to enable module, false to disable
See Also:
ArgoModule.setModuleEnabled(boolean)

isModuleEnabled

public boolean isModuleEnabled()
Description copied from interface: org.argouml.application.api.ArgoModule
Allows determination if a module is enabled or disabled.

Specified by:
isModuleEnabled in interface org.argouml.application.api.ArgoModule
Returns:
true if the module is enabled, otherwise false
See Also:
ArgoModule.isModuleEnabled()

getModuleVersion

public String getModuleVersion()
Description copied from interface: org.argouml.application.api.ArgoModule
The module version. There is no specified format.

Specified by:
getModuleVersion in interface org.argouml.application.api.ArgoModule
Returns:
a string containing the module version
See Also:
ArgoModule.getModuleVersion()

getModuleAuthor

public String getModuleAuthor()
Description copied from interface: org.argouml.application.api.ArgoModule
The module author.

Specified by:
getModuleAuthor in interface org.argouml.application.api.ArgoModule
Returns:
a string containing the module author
See Also:
ArgoModule.getModuleAuthor()

getModulePopUpActions

public Vector getModulePopUpActions(Vector popUpActions,
                                    Object context)
Calls all modules to let them add to a popup menu.

Specified by:
getModulePopUpActions in interface org.argouml.application.api.ArgoModule
Parameters:
popUpActions - Vector of actions
context - which the actions are valid for
Returns:
Vector containing pop-up actions
See Also:
ArgoModule.getModulePopUpActions( java.util.Vector, java.lang.Object)

getSuffixFilters

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

Returns:
SuffixFilter[] suffixes for processing

getAttribute

protected JRadioButton getAttribute()
Returns:
Returns the attribute.

getDatatype

protected JRadioButton getDatatype()
Returns:
Returns the datatype.


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook