|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectbe.saltwater.jaqel.settings.SettingsManager
This is the main class for accessing and modifying the settings of the application. Every setting has a name (the key) and a value. It also has permissions whether modification is allowed and whether the setting should be stored by when passed to a SettingsWriter. There can be only one instance of a SettingsManager and you can get it with the static method getInstance(). You can read settings of several types (Integer, String, ...), but make sure that the value attached to the key you pass is of the type the method returns, otherwise null is returned. If uncertain, use readSetting(). There are readXXX(String key) and writeXXX(String key, XXX value) methods. Respectivly for reading and writing a setting of type XXX. When the application starts, create the neccesary SettingsReader objects and pass the only instance of this object to it's read() method. When the application terminates, create a SettingsWriter and pass the SettingsManager to it's write method. Below are the keys of some settings with some description:
| Key | Type | Description |
|---|---|---|
| language String | The current language. Is modifiable but should be "en", "fr", "nl" or "de". | |
| data_path | String | The path where all the data (models, textures, ...) are stored. |
| creature_path | String | The path where all creature files are stored. |
| weapon_path | String | The path where all weapon files are stored. |
| maze_path | String | The path where all maze files are stored. |
SettingsReader,
SettingsWriter| Method Summary | |
protected void |
addSetting(java.lang.String key,
java.lang.Object value,
byte permissions)
|
void |
addSettingChangeListener(java.lang.String key,
SettingChangeListener listener)
'listener' will be notified (his settingChanged method will be called) if the setting with key 'key' is modified. |
static SettingsManager |
getInstance()
|
protected java.util.Iterator |
getIterator()
Get the iterator of the setting keys, meant for SettingsWriter to iterate through all the keys. |
protected be.saltwater.jaqel.settings.Setting |
getSetting(java.lang.String key)
|
java.lang.Boolean |
readBoolean(java.lang.String key)
Read the value associated with key. |
java.lang.Integer |
readInteger(java.lang.String key)
Read the value associated with key. |
java.lang.Object |
readSetting(java.lang.String key)
Read the value associated with key, you will have to determine the type yourself. |
java.lang.String |
readString(java.lang.String key)
Read the value associated with key. |
void |
writeBoolean(java.lang.String key,
java.lang.Boolean value)
Set the value of setting 'key' to value. |
void |
writeInteger(java.lang.String key,
java.lang.Integer value)
Set the value of setting 'key' to value. |
void |
writeString(java.lang.String key,
java.lang.String value)
Set the value of setting 'key' to value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
protected void addSetting(java.lang.String key,
java.lang.Object value,
byte permissions)
protected be.saltwater.jaqel.settings.Setting getSetting(java.lang.String key)
public java.lang.Object readSetting(java.lang.String key)
public void writeString(java.lang.String key,
java.lang.String value)
java.lang.IllegalAccessException - When this setting may not be modified.public java.lang.String readString(java.lang.String key)
public void writeInteger(java.lang.String key,
java.lang.Integer value)
java.lang.IllegalAccessException - When this setting cannot be modified.public java.lang.Integer readInteger(java.lang.String key)
public java.lang.Boolean readBoolean(java.lang.String key)
public void writeBoolean(java.lang.String key,
java.lang.Boolean value)
java.lang.IllegalAccessException - When this setting may not be modified.
public void addSettingChangeListener(java.lang.String key,
SettingChangeListener listener)
SettingChangeListenerprotected java.util.Iterator getIterator()
public static SettingsManager getInstance()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||