Class WorkspaceManager

java.lang.Object
com.illumon.iris.gui.workspace.WorkspaceManager

public class WorkspaceManager extends Object
This class handles all instances of Workspaces including the saving and restoring of.
  • Field Details

  • Constructor Details

    • WorkspaceManager

      protected WorkspaceManager()
  • Method Details

    • addTranscoder

      public void addTranscoder(WorkspaceTranscoder transcoder)
    • getInstance

      public static WorkspaceManager getInstance()
    • setStandAloneMode

      public void setStandAloneMode(boolean standAloneMode)
    • startAutoSave

      public void startAutoSave()
      Starts the periodic execution of Auto Save.
    • stopAutoSave

      public void stopAutoSave()
      Stops the periodic execution of Auto Save.
    • load

      public void load(SavedWorkspace workspace) throws WorkspaceManager.WorkspaceException
      Load the specified SavedWorkspace, attempting to convert it to the most recent version if required
      Parameters:
      workspace - The workspace to load
      Throws:
      WorkspaceManager.WorkspaceException - If any problem occurs during the workspace load.
    • load

      public void load(SavedWorkspace workspace, WorkspaceImporter importer) throws WorkspaceManager.WorkspaceException
      Load the specified SavedWorkspace, attempting to convert it to the most recent version if required
      Parameters:
      workspace - The workspace to load
      importer - An optional workspace importer, can be null
      Throws:
      WorkspaceManager.WorkspaceException - If any problem occurs during the workspace load.
    • load

      public void load() throws WorkspaceManager.WorkspaceException
      Load the most recently used workspace.
      Throws:
      WorkspaceManager.WorkspaceException - If a problem occurred during the load.
    • save

      public void save()
      Save the current workspace to a file with the same name suffixed with the date and time ignoring any exceptions.
    • exportShare

      public void exportShare(Path workspacePath, WorkspaceExporter exporter) throws WorkspaceManager.WorkspaceException
      Exports a subset the current workspace to a file.
      Parameters:
      workspacePath - the path to save the workspace
      exporter - the Workspace Export to perform the export
      Throws:
      WorkspaceManager.WorkspaceException - If any problem occurred during the save.
    • checkedSave

      public void checkedSave() throws WorkspaceManager.WorkspaceException
      Save the current workspace to a file with the same name, suffixed with the date and time.
      Throws:
      WorkspaceManager.WorkspaceException - If any problem occurred during the save.
    • checkedSave

      public void checkedSave(Path workspacePath) throws WorkspaceManager.WorkspaceException
      Save the current workspace to a file with the same name, suffixed with the date and time.
      Parameters:
      workspacePath - the path to save the workspace
      Throws:
      WorkspaceManager.WorkspaceException - If any problem occurred during the save.
    • addWorkSpace

      public void addWorkSpace(String name, Workspace workspace)
      Add a workspace to be managed, copying any previously stored workspace.
      Parameters:
      name - The name of the workspace
      workspace - The workspace to be saved.
    • addWorkSpace

      public void addWorkSpace(String name, Workspace workspace, boolean copyPrevious)
      Add a workspace to be managed, optionally copying any previously stored workspace.
      Parameters:
      name - The name of the workspace.
      workspace - The workspace to be saved.
      copyPrevious - If true any previous workspace will be copied.
    • getWorkspace

      public Workspace getWorkspace(String name)
    • removeWorkspace

      public void removeWorkspace(Workspace workspace)
    • addLoadingWorkspaceListener

      public void addLoadingWorkspaceListener(WorkspaceManager.LoadingWorkspaceListener listener)
    • getSavedWorkspaces

      public Collection<SavedWorkspace> getSavedWorkspaces()
      Get a collection containing all of the loadable workspaces.
      Returns:
      All of the workspaces that can be directly loaded, or converted and loaded.
    • getAutoSavedWorkspaces

      public Collection<SavedWorkspace> getAutoSavedWorkspaces()
      Get a collection containing all of the loadable auto saved workspaces.
      Returns:
      All of the auto saved workspaces that can be directly loaded, or converted and loaded.
    • tryGetSavedWorkspace

      public SavedWorkspace tryGetSavedWorkspace(com.fishlib.io.logger.Logger log, @NotNull Path path, int desiredVersion)
      Try to create a SavedWorkspace at the desired version from the specified path.
      Parameters:
      log - the logger
      path - The path to the workspace to try to parse
      desiredVersion - the desired version of the workspace
      Returns:
      A SavedWorkspace or null if the workspace couldn't be parsed.
    • tryGetSavedWorkspace

      public SavedWorkspace tryGetSavedWorkspace(com.fishlib.io.logger.Logger log, @NotNull Path path)
      Try to create a SavedWorkspace at any version from the specified path.
      Parameters:
      log - the logger
      path - The path to the workspace to try to parse
      Returns:
      A SavedWorkspace or null if the workspace couldn't be parsed.