Class AbstractWorkspaceHelper<P extends AbstractWorkspacePanel,​M extends AbstractWorkspaceManagerPanel<P>>

    • Constructor Detail

      • AbstractWorkspaceHelper

        public AbstractWorkspaceHelper()
    • Method Detail

      • serialize

        protected abstract Object serialize​(P panel)
                                     throws Exception
        Returns the object that represents the panel's serialized state.
        Parameters:
        panel - the panel to serialize
        Returns:
        the object to serialize
        Throws:
        Exception - if serialization fails
      • write

        public String write​(M manager,
                            File file,
                            AbstractObjectWriter writer)
                     throws Exception
        Saves the panel session to the given file.
        Parameters:
        manager - the panel to save
        file - the file to save the workspace to
        Returns:
        null if successful, otherwise error message
        Throws:
        Exception - if serialization/saving fails
      • deserialize

        protected abstract void deserialize​(P panel,
                                            Object data,
                                            MessageCollection errors)
                                     throws Exception
        Deserializes the data for the panel.
        Parameters:
        panel - the panel to populate
        data - the data to deserialize
        errors - for storing errors
        Throws:
        Exception - if deserialization fails
      • read

        public void read​(File file,
                         AbstractObjectReader reader,
                         M manager,
                         MessageCollection errors)
                  throws Exception
        Reads the session and initializes the manager panel.
        Parameters:
        file - the file to load the session from
        reader - the reader to use for loading the serialized file
        manager - the manager panel to initialize with the session
        errors - for storing errors
        Throws:
        Exception - if loading fails
      • copy

        public P copy​(M manager,
                      P panel,
                      MessageCollection errors)
               throws Exception
        Copies a panel.
        Parameters:
        manager - the manager panel to use
        panel - the panel to copy
        errors - for storing errors
        Returns:
        the copy
        Throws:
        Exception - if copying fails
      • newFileChooser

        public SerializationFileChooser newFileChooser()
        Creates a filechooser for loading/saving workspaces.
        Returns:
        the filechooser