|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jstatcom.project.ProjectManager
public final class ProjectManager
Manages storing and retrieving project data and project states for all
modules. This class is a Singleton. All modules taking part in the project
management system must register with this object with the method
addProjectStateHandler
at program start. On deserialization of
projects, the data is restored and the modules states are set.
Method Summary | |
---|---|
void |
addPackagePrefix(java.lang.String name,
java.lang.String packageName)
Adds a package prefix. |
void |
addProjectStateHandler(ProjectStateHandler handler)
Adds a project state handler, typically a modelling module, to the list of all handlers. |
ProjectTreeNode |
deSerializeProject(java.io.File currentProjectFile)
Restores project from currentProjectFile . |
javax.swing.AbstractAction |
getDeSerializationAction()
Gets an abstract action instance that can be reused by components to invoke project deserialization. |
static ProjectManager |
getInstance()
Gets singleton instance of this class. |
Project |
getProjectFromFile(java.io.File currentProjectFile)
Gets project from currentProjectFile . |
javax.swing.AbstractAction |
getSerializationAction()
Gets an abstract action instance that can be reused by components to invoke project serialization. |
TopFrame |
getTopFrame()
Gets the reference to the TopFrame component that has been
set earlier. |
void |
serializeProject(java.io.File currentProjectFile,
java.lang.String name,
java.lang.String description)
Stores the current state as a project to currentProjectFile . |
void |
setProjectToFile(java.io.File currentProjectFile,
Project project)
Serializes the fully specified project to the file
currentProjectFile . |
void |
setTopFrame(TopFrame topFrame)
Sets the reference to the TopFrame component that can be
used for (de)serializing projects. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ProjectManager getInstance()
public javax.swing.AbstractAction getSerializationAction()
public javax.swing.AbstractAction getDeSerializationAction()
public void setProjectToFile(java.io.File currentProjectFile, Project project)
project
to the file
currentProjectFile
.
currentProjectFile
- file to use for project serializationproject
- fully specified Project
instance
java.lang.IllegalArgumentException
- if (currentProjectFile == null || project == null)public void addPackagePrefix(java.lang.String name, java.lang.String packageName)
xmlns:jstatcom="java:com.jstatcom"
, where "jstatcom" is
the name and "com.jstatcom" the package name. The package name will be
replaced by the name in all classes of that package in the XML file.
The package name "jstatcom" and "com.jstatcom" is reserved and must not be used.
name
- packageName
-
java.lang.IllegalArgumentException
- if null
or empty argument or if
name
of packageName
has already
been used.public void serializeProject(java.io.File currentProjectFile, java.lang.String name, java.lang.String description)
currentProjectFile
.
currentProjectFile
- the file to store the project toname
- the name of the projectdescription
- the project description
java.lang.IllegalArgumentException
- if (currentProjectFile == null)public Project getProjectFromFile(java.io.File currentProjectFile)
currentProjectFile
.
currentProjectFile
- the file to read the project from
java.lang.IllegalArgumentException
- if (currentProjectFile == null)public ProjectTreeNode deSerializeProject(java.io.File currentProjectFile)
currentProjectFile
.
currentProjectFile
- the file to read the project from
java.lang.IllegalArgumentException
- if (currentProjectFile == null)public void addProjectStateHandler(ProjectStateHandler handler)
This method should be called at program start when all handlers are being initialized.
handler
- element of a project that hanldles project states, usually a
ModelFrame
java.lang.IllegalArgumentException
- if (handler == null)
public void setTopFrame(TopFrame topFrame)
TopFrame
component that can be
used for (de)serializing projects. It is not strictly required to use
this setting.
topFrame
- reference to the TopFrame
instance that is used
as the main application framepublic TopFrame getTopFrame()
TopFrame
component that has been
set earlier.
TopFrame
instance
or null
if none has been set before
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |