dasher.applet
Class JSettings

java.lang.Object
  extended by dasher.CSettingsStore
      extended by dasher.applet.JSettings

public class JSettings
extends CSettingsStore

Extension of CSettingsStore which uses a Java Preferences object to store settings between sessions.

This boils down to using the registry in Windows, and a hidden file in the user's profile on Unix-style systems including MacOSX.

In the current unsigned applet setup this will not get used, as a security exception is thrown on trying to instantiate Preferences and a plain old CSettingsStore will be used in lieu.

Should JDasher ever get converted to a standalone Java application or signed applet, however, this will spring into life and provide persistent settings.

I have not documented these functions, as they all implement precisely the behaviour specified in CSettingsStore.

The only noteworthy feature is that the Constructor will throw a StoreUnavailableException if unable to open the registry and/or user profile.


Field Summary
private  java.util.prefs.Preferences appSettings
           
 
Fields inherited from class dasher.CSettingsStore
m_pEventHandler, ParamBool, ParamInvalid, ParamLong, ParamString, s_oParamTables
 
Constructor Summary
JSettings(CEventHandler handler)
           
 
Method Summary
protected  boolean LoadBoolSetting(java.lang.String Key)
          Loads a given boolean setting from the backing store.
protected  long LoadLongSetting(java.lang.String Key)
          Loads a given integer setting from the backing store.
protected  java.lang.String LoadStringSetting(java.lang.String Key)
          Loads a given String setting from the backing store.
protected  void SaveSetting(java.lang.String Key, boolean Value)
          Saves a given bool parameter to the backing store.
protected  void SaveSetting(java.lang.String Key, long Value)
          Saves a given integer parameter to the backing store.
protected  void SaveSetting(java.lang.String Key, java.lang.String Value)
          Saves a given string parameter to the backing store.
 
Methods inherited from class dasher.CSettingsStore
GetBoolParameter, GetLongParameter, GetParameterName, GetParameterType, GetStringParameter, LoadPersistent, ResetParameter, SetBoolParameter, SetLongParameter, SetStringParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

appSettings

private java.util.prefs.Preferences appSettings
Constructor Detail

JSettings

public JSettings(CEventHandler handler)
          throws StoreUnavailableException
Throws:
StoreUnavailableException
Method Detail

LoadBoolSetting

protected boolean LoadBoolSetting(java.lang.String Key)
                           throws CParameterNotFoundException
Description copied from class: CSettingsStore
Loads a given boolean setting from the backing store.

Overrides:
LoadBoolSetting in class CSettingsStore
Parameters:
Key - Name of parameter to retrieve
Returns:
Value of this setting
Throws:
CParameterNotFoundException - if loading failed, eg. because the backing store did not contain information about this parameter.

LoadLongSetting

protected long LoadLongSetting(java.lang.String Key)
                        throws CParameterNotFoundException
Description copied from class: CSettingsStore
Loads a given integer setting from the backing store.

Overrides:
LoadLongSetting in class CSettingsStore
Parameters:
Key - Name of parameter to retrieve
Returns:
Value of this setting
Throws:
CParameterNotFoundException - if loading failed, eg. because the backing store did not contain information about this parameter.

LoadStringSetting

protected java.lang.String LoadStringSetting(java.lang.String Key)
                                      throws CParameterNotFoundException
Description copied from class: CSettingsStore
Loads a given String setting from the backing store.

Overrides:
LoadStringSetting in class CSettingsStore
Parameters:
Key - Name of parameter to retrieve
Returns:
Value of this setting
Throws:
CParameterNotFoundException - if loading failed, eg. because the backing store did not contain information about this parameter.

SaveSetting

protected void SaveSetting(java.lang.String Key,
                           boolean Value)
Description copied from class: CSettingsStore
Saves a given bool parameter to the backing store. In this base class, this method is a stub; it should be overridden by a subclass if persistent settings are desired.

Overrides:
SaveSetting in class CSettingsStore
Parameters:
Key - Name of the parameter to save
Value - Value of the parameter

SaveSetting

protected void SaveSetting(java.lang.String Key,
                           long Value)
Description copied from class: CSettingsStore
Saves a given integer parameter to the backing store. In this base class, this method is a stub; it should be overridden by a subclass if persistent settings are desired.

Overrides:
SaveSetting in class CSettingsStore
Parameters:
Key - Name of the parameter to save
Value - Value of the parameter

SaveSetting

protected void SaveSetting(java.lang.String Key,
                           java.lang.String Value)
Description copied from class: CSettingsStore
Saves a given string parameter to the backing store. In this base class, this method is a stub; it should be overridden by a subclass if persistent settings are desired.

Overrides:
SaveSetting in class CSettingsStore
Parameters:
Key - Name of the parameter to save
Value - Value of the parameter