Package com.illumon.iris.gui.workspace
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.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWorkspaceManager.ContextAn ISavedWorkspaceData that contains the path to the workspace file.static interfaceWorkspaceManager.LoadingWorkspaceListenerstatic classWorkspaceManager.SaveTypestatic classWorkspaceManager.WorkspaceException -
Field Summary
Fields Modifier and Type Field Description static DateTimeFormatterfileTimeFormatterprotected static WorkspaceManagerinstance_protected com.fishlib.io.logger.Loggerlogstatic StringTYPE_ATTRstatic StringVERSION_ATTRstatic StringWRITE_TIME_ATTRstatic DateTimeFormatterwriteTimeFormatter -
Constructor Summary
Constructors Modifier Constructor Description protectedWorkspaceManager() -
Method Summary
Modifier and Type Method Description voidaddLoadingWorkspaceListener(WorkspaceManager.LoadingWorkspaceListener listener)voidaddTranscoder(WorkspaceTranscoder transcoder)voidaddWorkSpace(String name, Workspace workspace)Add a workspace to be managed, copying any previously stored workspace.voidaddWorkSpace(String name, Workspace workspace, boolean copyPrevious)Add a workspace to be managed, optionally copying any previously stored workspace.voidcheckedSave()Save the current workspace to a file with the same name, suffixed with the date and time.voidcheckedSave(Path workspacePath)Save the current workspace to a file with the same name, suffixed with the date and time.voidexportShare(Path workspacePath, WorkspaceExporter exporter)Exports a subset the current workspace to a file.Collection<SavedWorkspace>getAutoSavedWorkspaces()Get a collection containing all of the loadable auto saved workspaces.static WorkspaceManagergetInstance()Collection<SavedWorkspace>getSavedWorkspaces()Get a collection containing all of the loadable workspaces.WorkspacegetWorkspace(String name)voidload()Load the most recently used workspace.voidload(SavedWorkspace workspace)Load the specifiedSavedWorkspace, attempting to convert it to the most recent version if requiredvoidload(SavedWorkspace workspace, WorkspaceImporter importer)Load the specifiedSavedWorkspace, attempting to convert it to the most recent version if requiredvoidremoveWorkspace(Workspace workspace)voidsave()Save the current workspace to a file with the same name suffixed with the date and time ignoring any exceptions.voidsetStandAloneMode(boolean standAloneMode)voidstartAutoSave()Starts the periodic execution of Auto Save.voidstopAutoSave()Stops the periodic execution of Auto Save.SavedWorkspacetryGetSavedWorkspace(com.fishlib.io.logger.Logger log, Path path)Try to create a SavedWorkspace at any version from the specified path.SavedWorkspacetryGetSavedWorkspace(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:
- Constant Field Values
-
WRITE_TIME_ATTR
- See Also:
- Constant Field Values
-
TYPE_ATTR
- See Also:
- Constant Field Values
-
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.WorkspaceExceptionLoad 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. -
exportShare
public void exportShare(Path workspacePath, WorkspaceExporter exporter) throws WorkspaceManager.WorkspaceExceptionExports a subset the current workspace to a file.- Parameters:
workspacePath- the path to save the workspaceexporter- the Workspace Export to perform the export- 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.- 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- Iftrueany 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.
-