Package megamek.common.preference
Interface IPreferenceStore
- All Known Implementing Classes:
ButtonOrderPreferences,ClientPreferences,GUIPreferences,PreferenceStore,PreferenceStoreProxy,UnitDisplayOrderPreferences
public interface IPreferenceStore
The
IPreferenceStore interface represents a mapping of named preferences to values. In case of absence
of the value for a given name the default value is returned. If there is no default value for that preference, then
predefined default value for the preference type is returned. Predefined default values for the primitive types
follows:
boolean=falseint=0long=0String=""(the empty string)float=0.0fdouble=0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe predefined default value forbooleanpreferencestatic final doubleThe predefined default value fordoublepreferencestatic final StringThe string representation used forfalsestatic final floatThe predefined default value forfloatpreferencestatic final intThe predefined default value forintpreferencestatic final longThe predefined default value forlongpreferencestatic final StringThe predefined default value forStringpreferencestatic final StringThe string representation used fortrue -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a preference change listener to this store.String[]booleangetBoolean(String name) Returns the value of thebooleanpreference with the given name.booleangetDefaultBoolean(String name) Returns the default value for thebooleanpreference with the given name.doublegetDefaultDouble(String name) Returns the default value for thedoublepreference with the given name.floatgetDefaultFloat(String name) Returns the default value for thefloatpreference with the given name.intgetDefaultInt(String name) Returns the default value for theintpreference with the given name.longgetDefaultLong(String name) Returns the default value for thelongpreference with the given name.getDefaultString(String name) Returns the default value for theStringpreference with the given name.doubleReturns the value of thedoublepreference with the given name.floatReturns the value of thefloatpreference with the given name.intReturns the value of theintpreference with the given name.longReturns the value of thelongpreference with the given name.Returns the value of theStringpreference with the given name.booleanhasProperty(String name) voidJust sets the current value of the preference with the given name.voidRemoves the given listener from this store.voidsetDefault(String name, boolean value) Sets the default value for thebooleanpreference with the given name.voidsetDefault(String name, double value) Sets the default value for thedoublepreference with the given name.voidsetDefault(String name, float value) Sets the default value for thefloatpreference with the given name.voidsetDefault(String name, int value) Sets the default value for theintpreference with the given name.voidsetDefault(String name, long value) Sets the default value for thelongpreference with the given name.voidsetDefault(String name, String value) Sets the default value for thestringpreference with the given name.voidSets the current value of thebooleanpreference with the given name.voidSets the current value of thedoublepreference with the given name.voidSets the current value of thefloatpreference with the given name.voidSets the current value of theintpreference with the given name.voidSets the current value of thelongpreference with the given name.voidSets the current value of theStringpreference with the given name.
-
Field Details
-
BOOLEAN_DEFAULT
static final boolean BOOLEAN_DEFAULTThe predefined default value forbooleanpreference- See Also:
-
INT_DEFAULT
static final int INT_DEFAULTThe predefined default value forintpreference- See Also:
-
LONG_DEFAULT
static final long LONG_DEFAULTThe predefined default value forlongpreference- See Also:
-
STRING_DEFAULT
The predefined default value forStringpreference- See Also:
-
FLOAT_DEFAULT
static final float FLOAT_DEFAULTThe predefined default value forfloatpreference- See Also:
-
DOUBLE_DEFAULT
static final double DOUBLE_DEFAULTThe predefined default value fordoublepreference- See Also:
-
TRUE
The string representation used fortrue- See Also:
-
FALSE
The string representation used forfalse- See Also:
-
-
Method Details
-
getDefaultBoolean
Returns the default value for thebooleanpreference with the given name. -
getDefaultInt
Returns the default value for theintpreference with the given name. -
getDefaultLong
Returns the default value for thelongpreference with the given name. -
getDefaultString
Returns the default value for theStringpreference with the given name. -
getDefaultDouble
Returns the default value for thedoublepreference with the given name. -
getDefaultFloat
Returns the default value for thefloatpreference with the given name. -
setDefault
Sets the default value for thebooleanpreference with the given name. -
setDefault
Sets the default value for theintpreference with the given name. -
setDefault
Sets the default value for thelongpreference with the given name. -
setDefault
Sets the default value for thestringpreference with the given name. -
setDefault
Sets the default value for thefloatpreference with the given name. -
setDefault
Sets the default value for thedoublepreference with the given name. -
getBoolean
Returns the value of thebooleanpreference with the given name. Returns the predefined default value in case if there is no preference with the given name, or if the current value cannot be treated as a boolean. -
getInt
Returns the value of theintpreference with the given name. Returns the predefined default value in case if there is no preference with the given name, or if the current value cannot be treated as an int. -
getLong
Returns the value of thelongpreference with the given name. Returns the predefined default value in case if there is no preference with the given name, or if the current value cannot be treated as a long. -
getString
Returns the value of theStringpreference with the given name. Returns the predefined default value in case if there is no preference with the given name, or if the current value cannot be treated as a String. -
getFloat
Returns the value of thefloatpreference with the given name. Returns the predefined default value in case if there is no preference with the given name, or if the current value cannot be treated as a float. -
getDouble
Returns the value of thedoublepreference with the given name. Returns the predefined default value in case if there is no preference with the given name, or if the current value cannot be treated as a double. -
setValue
Sets the current value of thebooleanpreference with the given name. A preference change event is reported if the current value of the preference changes from its previous value. -
setValue
Sets the current value of theintpreference with the given name. A preference change event is reported if the current value of the preference changes from its previous value. -
setValue
Sets the current value of thelongpreference with the given name. A preference change event is reported if the current value of the preference changes from its previous value. -
setValue
Sets the current value of theStringpreference with the given name. A preference change event is reported if the current value of the preference changes from its previous value. -
setValue
Sets the current value of thefloatpreference with the given name. A preference change event is reported if the current value of the preference changes from its previous value. -
setValue
Sets the current value of thedoublepreference with the given name. A preference change event is reported if the current value of the preference changes from its previous value. -
addPreferenceChangeListener
Adds a preference change listener to this store.- Parameters:
listener- a preference change listener
-
removePreferenceChangeListener
Removes the given listener from this store. -
putValue
Just sets the current value of the preference with the given name. does not fire preference change event -
getAdvancedProperties
String[] getAdvancedProperties() -
hasProperty
-