org.xdat
public class Session extends java.lang.Object implements java.io.Serializable
References to the DataSheet
and all active
ParallelCoordinatesChart
s are stored in session class
instances. When the user saves his Session, this information is serialized
and can be retrieved at a later time.
Care has been taken to avoid serializing swing objects. Therefore, no such objects should be referenced from within this class, only the information needed to reconstruct the chart frames.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
sessionFileExtension
The when storing session files this file extension will be used.
|
Constructor and Description |
---|
Session()
Instantiates a new session.
|
Modifier and Type | Method and Description |
---|---|
void |
addChart(Chart chart)
Adds a chart to the session.
|
void |
clearAllCharts()
Clear all charts.
|
Chart |
getChart(int index)
Gets a chart from this session.
|
int |
getChartCount()
Gets the number of charts
|
DataSheet |
getCurrentDataSheet()
Gets the current data sheet.
|
java.lang.String |
getSessionDirectory()
Gets the directory where the session was saved.
|
java.lang.String |
getSessionName()
Gets the session name.
|
static Session |
readFromFile(Main mainWindow,
java.lang.String pathToFile)
Read from file.
|
boolean |
removeChart(Chart chart)
Removes a chart from the session.
|
void |
saveToFile(java.lang.String pathToFile)
Serializes the session to a file.
|
void |
setCurrentDataSheet(DataSheet currentDataSheet)
Sets the current data sheet.
|
void |
setSessionDirectory(java.lang.String sessionDirectory)
Sets the directory where the session is saved.
|
void |
setSessionName(java.lang.String sessionName)
Sets the session name.
|
public static final java.lang.String sessionFileExtension
public void saveToFile(java.lang.String pathToFile) throws java.io.IOException
pathToFile
- the path to filejava.io.IOException
- Signals that an I/O exception has occurred.public static Session readFromFile(Main mainWindow, java.lang.String pathToFile) throws java.io.InvalidClassException, java.io.IOException, java.lang.ClassNotFoundException
mainWindow
- the main windowpathToFile
- the path where the file is savedjava.io.InvalidClassException
- thrown when the selected file is not a valid serialized
sessionjava.io.IOException
- Signals that an I/O exception has occurred.java.lang.ClassNotFoundException
- thrown when the class was not found.public Chart getChart(int index)
index
- the index of the chartpublic int getChartCount()
public void addChart(Chart chart)
chart
- the chartpublic boolean removeChart(Chart chart)
chart
- the chartpublic void clearAllCharts()
public DataSheet getCurrentDataSheet()
public void setCurrentDataSheet(DataSheet currentDataSheet)
currentDataSheet
- the new current data sheetpublic java.lang.String getSessionName()
public void setSessionName(java.lang.String sessionName)
sessionName
- the new session namepublic java.lang.String getSessionDirectory()
public void setSessionDirectory(java.lang.String sessionDirectory)
sessionDirectory
- the new session directory