fdda.plugins.xmlwriter
Class ProjectWriter

java.lang.Object
  |
  +--fdda.plugins.xmlwriter.ProjectWriter
All Implemented Interfaces:
Plugin, SystemWriter

public class ProjectWriter
extends Object
implements SystemWriter

SystemWriter plug-in that writes projects into XML files according to the project.dtd. Works with the components 'swing' and 'java2d'.

Author:
Jörg Rüdenauer

Field Summary
(package private) static String PROJECT_DEFAULT_PATH
          the default save path
(package private) static String PROJECT_PATH_OPTION
          the option for the default save path
 
Fields inherited from interface fdda.plugins.Plugin
ALGORITHM_READER, SYSTEM_READER, SYSTEM_WRITER
 
Constructor Summary
ProjectWriter()
          Constructor
 
Method Summary
 void configure()
          Uses a dialog to determine the default directory for saved files.
 ProjectInformation[] getLastSavedProjectsInformation()
          Returns information about the last stored 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.
 boolean performUI()
          Shows a dialog to select the file that is written.
 boolean setSystemLocation(String location)
          Defines where the project shall be saved (alternative to performUI). If the given location (e.g. a file path) can't be used, false is returned. The location must be a file name or path and end with ".xml".
 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 store its information.
 void writeProject(Project project, ErrorHandler errorHandler)
          Stores a project in a persistent storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROJECT_PATH_OPTION

static final String PROJECT_PATH_OPTION
the option for the default save path

See Also:
Constant Field Values

PROJECT_DEFAULT_PATH

static final String PROJECT_DEFAULT_PATH
the default save path

Constructor Detail

ProjectWriter

public ProjectWriter()
Constructor

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: SystemWriter
Tells the plug-in that the specified graphics component is used and it should store its information.

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

configure

public void configure()
Uses a dialog to determine the default directory for saved files.

Specified by:
configure in interface Plugin
See Also:
Plugin.configure()

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()

performUI

public boolean performUI()
Shows a dialog to select the file that is written.

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

setSystemLocation

public boolean setSystemLocation(String location)
Defines where the project shall be saved (alternative to performUI). If the given location (e.g. a file path) can't be used, false is returned. The location must be a file name or path and end with ".xml".

Specified by:
setSystemLocation in interface SystemWriter
Parameters:
location - the location
Returns:
whether the location can be used.

getLastSavedProjectsInformation

public ProjectInformation[] getLastSavedProjectsInformation()
Description copied from interface: SystemWriter
Returns information about the last stored projects. The size of the array may vary with each plugin.

Specified by:
getLastSavedProjectsInformation in interface SystemWriter
Returns:
information about last stored projects

writeProject

public void writeProject(Project project,
                         ErrorHandler errorHandler)
                  throws MissingOptionsException
Description copied from interface: SystemWriter
Stores a project in a persistent storage. If an error occurs, the appropriate method of the error handler is called. To integrate into fdda, the method should perform several other tasks: Maybe change the project name through the ProjectManager Call project.setChanged(false) Set the preference userRoot.fdda.lastProjectLocation to the location of the stored project

Specified by:
writeProject in interface SystemWriter
Parameters:
project - the project
errorHandler - the error handler
Throws:
MissingOptionsException - if no location was specified


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