fdda.plugins.xmlreader
Class ProjectReader

java.lang.Object
  |
  +--fdda.plugins.xmlreader.ProjectReader
All Implemented Interfaces:
Plugin, SystemReader

public class ProjectReader
extends Object
implements SystemReader

Plug-in that reads projects from XML files according to the project.dtd. Works with the 'swing' and 'java2d' components.

Author:
Jörg Rüdenauer

Field Summary
static String PROJECT_DEFAULT_PATH
          the default default storage path
static String PROJECT_PATH_OPTION
          name of the option for the default storage path
 
Fields inherited from interface fdda.plugins.Plugin
ALGORITHM_READER, SYSTEM_READER, SYSTEM_WRITER
 
Constructor Summary
ProjectReader()
           
 
Method Summary
 void configure()
          This method is used to configure the plug-in by user interaction.
 ProjectInformation[] getLastLoadedProjectsInformation()
          Returns information about the last loaded projects.
 String getName()
          Returns the name of the plug-in.
 int getType()
          Returns the type of the plug-in (one of the constants of this interface)
 boolean hasOptions()
          Returns true.
 void loadProject(ErrorHandler errorHandler, Project project)
          Loads a project.
 boolean performUI()
          Interacts with the user to define options for the load operation.
 boolean setSystemLocation(String location)
          Sets the storage location of the project.
 void useDialog(String component)
          Tells the plug-in to use the specified dialog component for its interactions with the user.
 void useGraphic(String component)
          Tells the plug-in that the specified graphics component is used and it should load its information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROJECT_PATH_OPTION

public static final String PROJECT_PATH_OPTION
name of the option for the default storage path

See Also:
Constant Field Values

PROJECT_DEFAULT_PATH

public static final String PROJECT_DEFAULT_PATH
the default default storage path

Constructor Detail

ProjectReader

public ProjectReader()
Method Detail

useDialog

public void useDialog(String component)
               throws ComponentNotSupportedException
Description copied from interface: Plugin
Tells the plug-in to use the specified dialog component for its interactions with the user.

Specified by:
useDialog in interface Plugin
Parameters:
component - name of the dialog component (e.g. "swing")
Throws:
ComponentNotSupportedException - if the plug-in can't use this component

useGraphic

public void useGraphic(String component)
                throws ComponentNotSupportedException
Description copied from interface: SystemReader
Tells the plug-in that the specified graphics component is used and it should load its information.

Specified by:
useGraphic in interface SystemReader
Parameters:
component - identifier of the graphics component (e.g. "java2d")
Throws:
ComponentNotSupportedException - if the plug-in doesn't support the loading of the data for this component

performUI

public boolean performUI()
Description copied from interface: SystemReader
Interacts with the user to define options for the load operation. E.g a dialog to select a file could be shown. Either this method or setSystemLocation must be called before calling loadProject. If the user cancels the operation, the method returns false and loadProject mustn't be called.

Specified by:
performUI in interface SystemReader
Returns:
false, iff the user canceled the operation
See Also:
SystemReader.performUI()

setSystemLocation

public boolean setSystemLocation(String location)
Description copied from interface: SystemReader
Sets the storage location of the project. If the location can't be used by this plug-in, returns false.

Specified by:
setSystemLocation in interface SystemReader
Parameters:
location - the location
Returns:
true iff the location can be used
See Also:
SystemReader.setSystemLocation(java.lang.String)

loadProject

public void loadProject(ErrorHandler errorHandler,
                        Project project)
                 throws MissingOptionsException
Description copied from interface: SystemReader
Loads a project. PerformUI or setSystemLocation must be called earlier to set the location. If an error occurs, the appropriate method of the error handler is called. To integrate into fdda, the method must set the preference userRoot .fdda.lastProjectLocation to the used location.

Specified by:
loadProject in interface SystemReader
Parameters:
errorHandler - the errorHandler
project - the project that is filled with the loaded data
Throws:
MissingOptionsException - if no location was specified
See Also:
SystemReader.loadProject(fdda.plugins.ErrorHandler, fdda.core.projects.Project)

getName

public String getName()
Description copied from interface: Plugin
Returns the name of the plug-in.

Specified by:
getName in interface Plugin
Returns:
the name

getType

public int getType()
Description copied from interface: Plugin
Returns the type of the plug-in (one of the constants of this interface)

Specified by:
getType in interface Plugin
Returns:
the type

hasOptions

public boolean hasOptions()
Returns true.

Specified by:
hasOptions in interface Plugin
Returns:
true, iff the plug-in can be configured
See Also:
Plugin.hasOptions()

configure

public void configure()
Description copied from interface: Plugin
This method is used to configure the plug-in by user interaction. It may show a dialog.

Specified by:
configure in interface Plugin

getLastLoadedProjectsInformation

public ProjectInformation[] getLastLoadedProjectsInformation()
Description copied from interface: SystemReader
Returns information about the last loaded projects. The size of the array may vary with the plug-in.

Specified by:
getLastLoadedProjectsInformation in interface SystemReader
Returns:
information about the last loaded projects


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.