public class Workspace extends java.lang.Object implements Dirtyable
It provides the means to track changes, persist and reload a state in between usage session of the application
| Type | Property and Description |
|---|---|
javafx.beans.property.BooleanProperty |
dirty
A
BooleanProperty that observes the changes made to the Dirtyable instance |
javafx.beans.property.Property<java.nio.file.Path> |
path
Returns the property that observes the
Path for the serialized form of the Workspace |
| Modifier and Type | Field and Description |
|---|---|
static Version |
MINIMUM_SUPPORTED_SCHEMA_VERSION |
static java.lang.String |
WORKSPACE_SCHEMA_VERSION |
| Constructor and Description |
|---|
Workspace()
Initializes a new instance of the
Workspace class |
| Modifier and Type | Method and Description |
|---|---|
void |
addSource(Source sourceToAdd) |
void |
addSources(java.util.Collection<Source> sourcesToAdd)
/**
Add all the elements in the provided collection to the list of
Source instances |
void |
addWorksheets(java.util.Collection<Worksheet<?>> worksheetsToAdd)
Add all the elements in the provided collection to the list of
Worksheet instances |
void |
addWorksheets(Worksheet<?>... worksheetsToAdd) |
void |
cleanUp()
Clear the dirty status of the
Dirtyable instance |
void |
clear()
Clear all the properties of the
Workspace instance |
void |
clearSources()
Clear the
Source list |
void |
clearWorksheets()
Clear the
Worksheet list |
javafx.beans.property.BooleanProperty |
dirtyProperty()
A
BooleanProperty that observes the changes made to the Dirtyable instance |
static Workspace |
from(java.io.File file)
Deserializes the content of the provided file as a new instance of the
Workspace class |
java.nio.file.Path |
getPath()
Returns the
Path for the serialized form of the Workspace |
java.lang.Iterable<Source> |
getSources()
|
java.lang.Iterable<Worksheet> |
getWorksheets()
|
boolean |
hasPath()
Returns true is the
Workspace has a valid Path, false otherwise |
java.lang.Boolean |
isDirty()
Gets the value of the property dirty.
|
javafx.beans.property.Property<java.nio.file.Path> |
pathProperty()
Returns the property that observes the
Path for the serialized form of the Workspace |
void |
removeSource(Source sourceToRemove) |
void |
removeSources(java.util.Collection<Source> sourcesToRemove)
Remove all the elements in the provided collection from the list of
Source instances |
void |
removeWorksheets(Worksheet... worksheetsToRemove)
Remove all the elements in the provided collection from the list of
Worksheet instances |
void |
save()
Commits the current state of the
Workspace instance to its persistence layer |
void |
save(java.io.File file)
Commits the current state of the
Workspace instance to the provided file |
void |
setPath(java.nio.file.Path path)
Sets the
Path for the serialized form of the Workspace |
java.lang.String |
toString() |
public javafx.beans.property.Property<java.nio.file.Path> pathProperty
Path for the serialized form of the WorkspacegetPath(),
setPath(Path)public javafx.beans.property.BooleanProperty dirtyProperty
dirtyProperty in interface DirtyableisDirty()public static final java.lang.String WORKSPACE_SCHEMA_VERSION
public static final Version MINIMUM_SUPPORTED_SCHEMA_VERSION
public Workspace()
Workspace classpublic void addWorksheets(java.util.Collection<Worksheet<?>> worksheetsToAdd)
Worksheet instancesworksheetsToAdd - the list of Worksheet instances to addpublic void addWorksheets(Worksheet<?>... worksheetsToAdd)
public void removeWorksheets(Worksheet... worksheetsToRemove)
Worksheet instancesworksheetsToRemove - the list of Worksheet instances to removepublic void clearWorksheets()
Worksheet listpublic void clearSources()
Source listpublic void addSources(java.util.Collection<Source> sourcesToAdd)
Source instancessourcesToAdd - the list of Source instances to addpublic void addSource(Source sourceToAdd)
public void removeSources(java.util.Collection<Source> sourcesToRemove)
Source instancessourcesToRemove - the list of Source instances to removepublic void removeSource(Source sourceToRemove)
public java.lang.Iterable<Worksheet> getWorksheets()
public java.lang.Iterable<Source> getSources()
public java.nio.file.Path getPath()
Path for the serialized form of the WorkspacePath for the serialized form of the Workspacepublic javafx.beans.property.Property<java.nio.file.Path> pathProperty()
Path for the serialized form of the WorkspacegetPath(),
setPath(Path)public boolean hasPath()
Workspace has a valid Path, false otherwiseWorkspace has a valid Path, false otherwisepublic void setPath(java.nio.file.Path path)
Path for the serialized form of the Workspacepath - the Path for the serialized form of the Workspacepublic java.lang.String toString()
toString in class java.lang.Objectpublic void clear()
Workspace instancepublic void save()
throws java.io.IOException,
javax.xml.bind.JAXBException
Workspace instance to its persistence layerjava.io.IOException - if an IO error occurs with the persistence layerjavax.xml.bind.JAXBException - if an error occurs while serializing the current state of the Workspacepublic void save(java.io.File file)
throws java.io.IOException,
javax.xml.bind.JAXBException
Workspace instance to the provided filepublic static Workspace from(java.io.File file) throws java.io.IOException, javax.xml.bind.JAXBException, CannotLoadWorkspaceException
Workspace classfile - the file to deserializeWorkspace classjava.io.IOException - if an IO error occurs when accessing the filejavax.xml.bind.JAXBException - if an error occurs while deserializing the fileCannotLoadWorkspaceExceptionpublic java.lang.Boolean isDirty()
public javafx.beans.property.BooleanProperty dirtyProperty()
DirtyableBooleanProperty that observes the changes made to the Dirtyable instancedirtyProperty in interface DirtyableisDirty()Copyright © 2018 Frederic Thevenet. All rights reserved.