|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmain.Session
public class Session
Stores all relevant information of a session.
References to the DataSheet
and all active Chart
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.
Field Summary | |
---|---|
private java.util.Vector<Chart> |
charts
All active charts. |
private DataSheet |
currentDataSheet
The current data sheet. |
(package private) static boolean |
printLog
Flag to enable debug message printing for this class. |
(package private) static long |
serialVersionUID
The version tracking unique identifier for Serialization. |
private java.lang.String |
sessionDirectory
The directory where the session was saved. |
static java.lang.String |
sessionFileExtension
The when storing session files this file extension will be used. |
private java.lang.String |
sessionName
The session name. |
Constructor Summary | |
---|---|
Session()
Instantiates a new session. |
Method Summary | |
---|---|
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. |
private void |
log(java.lang.String message)
Prints debug information to stdout when printLog is set to true. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
static final boolean printLog
public static final java.lang.String sessionFileExtension
private java.lang.String sessionName
private java.lang.String sessionDirectory
private DataSheet currentDataSheet
private java.util.Vector<Chart> charts
Constructor Detail |
---|
public Session()
Method Detail |
---|
public void saveToFile(java.lang.String pathToFile) throws java.io.IOException
pathToFile
- the path to file
java.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 saved
InvalidClassException
- thrown when the selected file is not a valid serialized session
java.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 chart
public int getChartCount()
public void addChart(Chart chart)
chart
- the chartpublic boolean removeChart(Chart chart)
chart
- the chart
public 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 directoryprivate void log(java.lang.String message)
message
- the message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |