Documentation of 'com.jstatcom.project.ProjectManager' Java class
ProjectManager
com.jstatcom.project

Class ProjectManager



  • public final class ProjectManager
    extends java.lang.Object
    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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addClassTransformation(java.lang.String oldClassName, java.lang.String newClassName)
      Adds a classname transformation.
      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

      • getInstance

        public static ProjectManager getInstance()
        Gets singleton instance of this class.
        Returns:
        project manager
      • getSerializationAction

        public javax.swing.AbstractAction getSerializationAction()
        Gets an abstract action instance that can be reused by components to invoke project serialization. For example, it could be used by "Save Project" button.
        Returns:
        abstract action
      • getDeSerializationAction

        public javax.swing.AbstractAction getDeSerializationAction()
        Gets an abstract action instance that can be reused by components to invoke project deserialization. For example, it could be used by "Open Project" button.
        Returns:
        abstract action
      • setProjectToFile

        public void setProjectToFile(java.io.File currentProjectFile,
                                     Project project)
        Serializes the fully specified project to the file currentProjectFile.
        Parameters:
        currentProjectFile - file to use for project serialization
        project - fully specified Project instance
        Throws:
        java.lang.IllegalArgumentException - if (currentProjectFile == null || project == null)
      • addPackagePrefix

        public void addPackagePrefix(java.lang.String name,
                                     java.lang.String packageName)
        Adds a package prefix. This can be used to reduce the size of the created XML file. For example, in the XML header it will appear as 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.

        Parameters:
        name -
        packageName -
        Throws:
        java.lang.IllegalArgumentException - if null or empty argument or if name of packageName has already been used.
      • serializeProject

        public void serializeProject(java.io.File currentProjectFile,
                                     java.lang.String name,
                                     java.lang.String description)
        Stores the current state as a project to currentProjectFile.
        Parameters:
        currentProjectFile - the file to store the project to
        name - the name of the project
        description - the project description
        Throws:
        java.lang.IllegalArgumentException - if (currentProjectFile == null)
      • getProjectFromFile

        public Project getProjectFromFile(java.io.File currentProjectFile)
        Gets project from currentProjectFile.
        Parameters:
        currentProjectFile - the file to read the project from
        Returns:
        deserialized project
        Throws:
        java.lang.IllegalArgumentException - if (currentProjectFile == null)
      • deSerializeProject

        public ProjectTreeNode deSerializeProject(java.io.File currentProjectFile)
        Restores project from currentProjectFile.
        Parameters:
        currentProjectFile - the file to read the project from
        Returns:
        reference to the newly created project tree node
        Throws:
        java.lang.IllegalArgumentException - if (currentProjectFile == null)
      • addProjectStateHandler

        public void addProjectStateHandler(ProjectStateHandler handler)
        Adds a project state handler, typically a modelling module, to the list of all handlers. The state will be stored as part of the project and it is restored when the project is deserialized.

        This method should be called at program start when all handlers are being initialized.

        Parameters:
        handler - element of a project that hanldles project states, usually a ModelFrame
        Throws:
        java.lang.IllegalArgumentException - if (handler == null)
      • setTopFrame

        public void setTopFrame(TopFrame topFrame)
        Sets the reference to the TopFrame component that can be used for (de)serializing projects. It is not strictly required to use this setting.
        Parameters:
        topFrame - reference to the TopFrame instance that is used as the main application frame
      • getTopFrame

        public TopFrame getTopFrame()
        Gets the reference to the TopFrame component that has been set earlier.
        Returns:
        reference to the currently set TopFrame instance or null if none has been set before
      • addClassTransformation

        public void addClassTransformation(java.lang.String oldClassName,
                                           java.lang.String newClassName)
        Adds a classname transformation. This is useful to load serialized XML project files after a classname was changed.
        Parameters:
        oldClassName - full classname before renaming
        newClassName - full classname after renaming

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.