Package com.illumon.iris.gui.workspace
Class WorkspaceManager
java.lang.Object
com.illumon.iris.gui.workspace.WorkspaceManager
This class handles all instances of
Workspaces
including the saving and restoring of.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An ISavedWorkspaceData that contains the path to the workspace file.static interface
static enum
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DateTimeFormatter
protected static final WorkspaceManager
protected final com.fishlib.io.logger.Logger
static final String
static final String
static final String
static final DateTimeFormatter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addTranscoder
(WorkspaceTranscoder transcoder) void
addWorkSpace
(String name, Workspace workspace) Add a workspace to be managed, copying any previously stored workspace.void
addWorkSpace
(String name, Workspace workspace, boolean copyPrevious) Add a workspace to be managed, optionally copying any previously stored workspace.void
Save the current workspace to a file with the same name, suffixed with the date and time.void
checkedSave
(Path workspacePath) Save the current workspace to a file with the same name, suffixed with the date and time.void
exportShare
(Path workspacePath, WorkspaceExporter exporter) Exports a subset the current workspace to a file.Get a collection containing all of the loadable auto saved workspaces.static WorkspaceManager
Get a collection containing all of the loadable workspaces.getWorkspace
(String name) void
load()
Load the most recently used workspace.void
load
(SavedWorkspace workspace) Load the specifiedSavedWorkspace
, attempting to convert it to the most recent version if requiredvoid
load
(SavedWorkspace workspace, WorkspaceImporter importer) Load the specifiedSavedWorkspace
, attempting to convert it to the most recent version if requiredvoid
removeWorkspace
(Workspace workspace) void
save()
Save the current workspace to a file with the same name suffixed with the date and time ignoring any exceptions.void
setStandAloneMode
(boolean standAloneMode) void
Starts the periodic execution of Auto Save.void
Stops the periodic execution of Auto Save.tryGetSavedWorkspace
(com.fishlib.io.logger.Logger log, Path path) Try to create a SavedWorkspace at any version from the specified path.tryGetSavedWorkspace
(com.fishlib.io.logger.Logger log, Path path, int desiredVersion) Try to create a SavedWorkspace at the desired version from the specified path.
-
Field Details
-
VERSION_ATTR
- See Also:
-
WRITE_TIME_ATTR
- See Also:
-
TYPE_ATTR
- See Also:
-
writeTimeFormatter
-
fileTimeFormatter
-
instance_
-
log
protected final com.fishlib.io.logger.Logger log
-
-
Constructor Details
-
WorkspaceManager
protected WorkspaceManager()
-
-
Method Details
-
addTranscoder
-
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
Load the specifiedSavedWorkspace
, 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 specifiedSavedWorkspace
, attempting to convert it to the most recent version if required- Parameters:
workspace
- The workspace to loadimporter
- An optional workspace importer, can be null- Throws:
WorkspaceManager.WorkspaceException
- If any problem occurs during the workspace load.
-
load
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. -
checkedSave
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
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
Add a workspace to be managed, copying any previously stored workspace.- Parameters:
name
- The name of the workspaceworkspace
- The workspace to be saved.
-
addWorkSpace
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
- Iftrue
any previous workspace will be copied.
-
getWorkspace
-
removeWorkspace
-
addLoadingWorkspaceListener
-
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
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 loggerpath
- The path to the workspace to try to parsedesiredVersion
- the desired version of the workspace- Returns:
- A SavedWorkspace or null if the workspace couldn't be parsed.
-
tryGetSavedWorkspace
Try to create a SavedWorkspace at any version from the specified path.- Parameters:
log
- the loggerpath
- The path to the workspace to try to parse- Returns:
- A SavedWorkspace or null if the workspace couldn't be parsed.
-