com.jstatcom.project
Class SettingsManager

java.lang.Object
  extended by com.jstatcom.project.SettingsManager

public final class SettingsManager
extends java.lang.Object

Singleton class that manages storing and retrieving of settings that should be kept permanently between two program runs. The methods saveSettings and restoreSettings are automatically being invoked from the TopFrame class when the application is quit or started, respectively.

This class also loads the last state from a special project file. This way the application always restores the project settings that were used when it was quit.

The last state and the settings are store in two different XML files in the users home directory under a name starting with a ".", followed by the title of the application, and the suffix "_settings" and "_laststate", respectively.

Author:
Markus Kraetzig

Field Summary
 java.lang.String LAST_STATE_PATH
           
 
Method Summary
static SettingsManager getInstance()
           
 void restoreLastState()
          The last state is retrieved which is just a project.
 void restoreSettings()
          Invokes deserialization from the settings file.
 void saveLastState()
          Stores the current state to a special project last state .
 void saveSettings()
          Saves all settings elements to an XML.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAST_STATE_PATH

public final java.lang.String LAST_STATE_PATH
Method Detail

getInstance

public static SettingsManager getInstance()

restoreSettings

public void restoreSettings()
Invokes deserialization from the settings file. All settings elements are restored and the setElement method of each instance is called.

Typically this method is invoked at program start.


saveSettings

public void saveSettings()
Saves all settings elements to an XML.


saveLastState

public void saveLastState()
Stores the current state to a special project last state .


restoreLastState

public void restoreLastState()
The last state is retrieved which is just a project.