|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdasher.CSettingsStore
public class CSettingsStore
SettingsStore is a base implementation of a settings repository. It has no ability to store its settings persistently, and will load the defaults specified in CParamTables every time it is instantiated.
In general the contract of a SettingsStore is to
Implementations wishing for persistent settings should subclass CSettingsStore and, by subclassing CDasherInterfaceBase, ensure that CreateSettingsStore is overridden to create their subclass.
Directly instantiating CSettingsStore will, however, be perfectly functional for testing purposes or environments which cannot save settings.
| Field Summary | |
|---|---|
protected CEventHandler |
m_pEventHandler
Event handler which we should notify whenever a parameter changes |
protected int |
ParamBool
|
protected int |
ParamInvalid
|
protected int |
ParamLong
|
protected int |
ParamString
|
protected CParamTables |
s_oParamTables
Our reference parameter tables |
| Constructor Summary | |
|---|---|
CSettingsStore(CEventHandler pEventHandler)
Same as new CSettingsStore(..., true) |
|
CSettingsStore(CEventHandler pEventHandler,
boolean readyYet)
Creates a new SettingsStore and instructs it to retrieve persistent settings if the backing store is ready to respond. |
|
| Method Summary | |
|---|---|
boolean |
GetBoolParameter(Ebp_parameters iParameter)
Gets the value of a boolean parameter |
long |
GetLongParameter(Elp_parameters iParameter)
Gets the value of an integer parameter |
java.lang.String |
GetParameterName(EParameters iParameter)
Gets the internal name of a parameter |
int |
GetParameterType(EParameters iParameter)
Determines the type of a given parameter. |
java.lang.String |
GetStringParameter(Esp_parameters iParameter)
Gets the value of a String parameter |
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. |
void |
LoadPersistent()
Loads persistent settings by means of the LoadSetting function. |
protected java.lang.String |
LoadStringSetting(java.lang.String Key)
Loads a given String setting from the backing store. |
void |
ResetParameter(EParameters iParameter)
Resets a given parameter to its default value, as given by its entry in CParamTables. |
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. |
void |
SetBoolParameter(Ebp_parameters iParameter,
boolean bValue)
Sets the value of a given boolean parameter. |
void |
SetLongParameter(Elp_parameters iParameter,
long lValue)
Sets the value of a given long parameter. |
void |
SetStringParameter(Esp_parameters iParameter,
java.lang.String sValue)
Sets the value of a given string parameter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected CParamTables s_oParamTables
protected CEventHandler m_pEventHandler
protected final int ParamBool
protected final int ParamLong
protected final int ParamString
protected final int ParamInvalid
| Constructor Detail |
|---|
public CSettingsStore(CEventHandler pEventHandler)
pEventHandler - Event handler which we should notify
of parameter changes
public CSettingsStore(CEventHandler pEventHandler,
boolean readyYet)
pEventHandler - Event handler to notify of parameter changesreadyYet - Is the backing store ready; can we retrieve
persistent settings?| Method Detail |
|---|
public void LoadPersistent()
If loading fails, the default value is retrieved and SaveSetting is called to save this out to our backing store.
public void SetBoolParameter(Ebp_parameters iParameter,
boolean bValue)
This will raise a ParameterNotificationEvent with our event handler.
iParameter - Parameter to setbValue - New value for this parameter
public void SetLongParameter(Elp_parameters iParameter,
long lValue)
This will raise a ParameterNotificationEvent with our event handler.
iParameter - Parameter to setlValue - New value for this parameter
public void SetStringParameter(Esp_parameters iParameter,
java.lang.String sValue)
This will raise a ParameterNotificationEvent with our event handler.
iParameter - Parameter to setsValue - New value for this parameterpublic boolean GetBoolParameter(Ebp_parameters iParameter)
iParameter - Parameter to query
public long GetLongParameter(Elp_parameters iParameter)
iParameter - Parameter to query
public java.lang.String GetStringParameter(Esp_parameters iParameter)
iParameter - Parameter to query
public void ResetParameter(EParameters iParameter)
iParameter - Parameter to resetpublic int GetParameterType(EParameters iParameter)
iParameter - Parameter to query
public java.lang.String GetParameterName(EParameters iParameter)
iParameter - Parameter to query
protected boolean LoadBoolSetting(java.lang.String Key)
throws CParameterNotFoundException
Key - Name of parameter to retrieve
CParameterNotFoundException - if loading failed, eg. because the backing
store did not contain information about this parameter.
protected long LoadLongSetting(java.lang.String Key)
throws CParameterNotFoundException
Key - Name of parameter to retrieve
CParameterNotFoundException - if loading failed, eg. because the backing
store did not contain information about this parameter.
protected java.lang.String LoadStringSetting(java.lang.String Key)
throws CParameterNotFoundException
Key - Name of parameter to retrieve
CParameterNotFoundException - if loading failed, eg. because the backing
store did not contain information about this parameter.
protected void SaveSetting(java.lang.String Key,
boolean Value)
Key - Name of the parameter to saveValue - Value of the parameter
protected void SaveSetting(java.lang.String Key,
long Value)
Key - Name of the parameter to saveValue - Value of the parameter
protected void SaveSetting(java.lang.String Key,
java.lang.String Value)
Key - Name of the parameter to saveValue - Value of the parameter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||