|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.settings.SettingsFactory
Class for handling all LimeWire settings that are stored to disk. To add a new setting, simply add a new public static member to the list of settings. Each setting constructor takes the name of the key and the default value, and all settings are typed. Choose the correct Setting subclass for your setting type. It is also important to choose a unique string key for your setting name -- otherwise there will be conflicts.
Field Summary | |
protected java.util.Properties |
DEFAULT_PROPS
Properties instance for the defualt values. |
protected java.util.Properties |
PROPS
The Properties instance containing all settings. |
Method Summary | |
void |
changeFile(java.io.File toUse)
Changes the backing file to use for this factory. |
BooleanSetting |
createBooleanSetting(java.lang.String key,
boolean defaultValue)
Creates a new BooleanSetting instance with the specified key and default value. |
ByteSetting |
createByteSetting(java.lang.String key,
byte defaultValue)
Creates a new ByteSetting instance with the specified key and default value. |
CharArraySetting |
createCharArraySetting(java.lang.String key,
char[] defaultValue)
Creates a new CharArraySetting instance for a character array setting with the specified key and default value. |
ColorSetting |
createColorSetting(java.lang.String key,
java.awt.Color defaultValue)
Creates a new ColorSetting instance with the specified key and default value. |
BooleanSetting |
createExpirableBooleanSetting(java.lang.String key,
boolean defaultValue)
Creates a new expiring BooleanSetting instance with the specified key and default value. |
IntSetting |
createExpirableIntSetting(java.lang.String key,
int defaultValue)
Creates a new expiring IntSetting instance with the specified key and default value. |
FileArraySetting |
createFileArraySetting(java.lang.String key,
java.io.File[] defaultValue)
Creates a new FileArraySetting instance for a File array setting with the specified key and default value. |
FileSetting |
createFileSetting(java.lang.String key,
java.io.File defaultValue)
Creates a new FileSetting instance with the specified key and default value. |
FloatSetting |
createFloatSetting(java.lang.String key,
float defaultValue)
Creates a new FloatSetting instance with the specified key and default value. |
IntSetting |
createIntSetting(java.lang.String key,
int defaultValue)
Creates a new IntSetting instance with the specified key and default value. |
LongSetting |
createLongSetting(java.lang.String key,
long defaultValue)
Creates a new LongSetting instance with the specified key and default value. |
StringArraySetting |
createStringArraySetting(java.lang.String key,
java.lang.String[] defaultValue)
Creates a new StringArraySetting instance for a String array setting with the specified key and default value. |
StringSetting |
createStringSetting(java.lang.String key,
java.lang.String defaultValue)
Creates a new StringSetting instance with the specified key and default value. |
java.util.Iterator |
iterator()
Returns the iterator over the settings stored in this factory. |
void |
reload()
Reloads the settings with the predefined settings file from disk. |
void |
revertToDefault()
Reverts all settings to their factory defaults. |
void |
save()
Save setting information to property file We want to NOT save any properties which are the default value, as well as any older properties that are no longer in use. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.util.Properties DEFAULT_PROPS
protected final java.util.Properties PROPS
Method Detail |
public java.util.Iterator iterator()
public void reload()
public void changeFile(java.io.File toUse)
public void revertToDefault()
public void save()
public StringSetting createStringSetting(java.lang.String key, java.lang.String defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic BooleanSetting createBooleanSetting(java.lang.String key, boolean defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic IntSetting createIntSetting(java.lang.String key, int defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic ByteSetting createByteSetting(java.lang.String key, byte defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic LongSetting createLongSetting(java.lang.String key, long defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic FileSetting createFileSetting(java.lang.String key, java.io.File defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic ColorSetting createColorSetting(java.lang.String key, java.awt.Color defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic CharArraySetting createCharArraySetting(java.lang.String key, char[] defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic FloatSetting createFloatSetting(java.lang.String key, float defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic StringArraySetting createStringArraySetting(java.lang.String key, java.lang.String[] defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic FileArraySetting createFileArraySetting(java.lang.String key, java.io.File[] defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic BooleanSetting createExpirableBooleanSetting(java.lang.String key, boolean defaultValue)
key
- the key for the settingdefaultValue
- the default value for the settingpublic IntSetting createExpirableIntSetting(java.lang.String key, int defaultValue)
key
- the key for the settingdefaultValue
- the default value for the setting
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |