|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.sfac.setting.SubSettingsProxy
public class SubSettingsProxy
Implementation of the Settings interface, allowing to present a subset of the settings as another settings object.
A prefix is added by this proxy to all the keys before to put them in the parent settings. It allows to easily make profiles (=
different set of identical settings saved in the same global settings file).
| Field Summary | |
|---|---|
static String |
SUB_SETTING_NAME
|
| Constructor Summary | |
|---|---|
SubSettingsProxy(Settings parentSettings,
String prefix)
Construct a new settings implementation bound to a given property file. |
|
SubSettingsProxy(Settings parentSettings,
String prefix,
int i)
Construct a new indexed settings implementation bound to a given property file. |
|
| Method Summary | ||
|---|---|---|
void |
addPropertyChangeListener(String settingKey,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific setting. |
|
void |
clear()
Remove all the settings corresponding to this proxy from the parent settings. |
|
int |
compareTo(SubSettingsProxy other)
|
|
boolean |
containsProperty(String key)
Check if there is a property value defined for the given key. |
|
void |
copyValues(Settings other)
Copy all the values of the other settings into this one. |
|
void |
dump()
|
|
boolean |
equals(Object other)
|
|
boolean |
getBooleanProperty(String key,
boolean defaultValue)
Get a boolean property value. |
|
Boolean |
getBooleanProperty(String key,
Boolean defaultValue)
Get a Boolean property value. |
|
Color |
getColorProperty(String key,
Color defaultValue)
Get a Color property value. |
|
Dimension |
getDimensionProperty(String key,
Dimension defaultValue)
Get a Dimension property value. |
|
double |
getDoubleProperty(String key,
double defaultValue)
Get a double property value. |
|
|
getEnumProperty(String key,
T defaultValue)
Get a enumerated property value. |
|
FilePathUtils |
getFilePathUtils()
Get the FilePathUtils used by this settings object. |
|
String |
getFileProperty(String key,
String defaultValue)
Get a absolute File or Directory property value. |
|
String |
getFileProperty(String key,
String defaultValue,
boolean absolute)
Get a File or Directory property value. |
|
int |
getIndex()
|
|
int[] |
getIntArrayProperty(String key,
int[] defaultValue)
Get a int array property value. |
|
Integer |
getIntegerProperty(String key,
Integer defaultValue)
Get a Integer property value. |
|
int |
getIntProperty(String key,
int defaultValue)
Get a int property value. |
|
Iterator<String> |
getKeys()
Return an iterator for all the defined keys. |
|
String |
getName()
|
|
String |
getPasswordProperty(String key,
String defaultValue)
Get a String property value to be used as a password. |
|
|
getProperty(String key,
TypeHelper<T> helper,
T defaultValue)
Get a property of type defined by the helper. |
|
String |
getPropertyAsInternalString(String key)
Get a property as stored internally by the map (as string). |
|
String |
getPropertyFilePath()
Get the path to the property file used to store the settings. |
|
Rectangle |
getRectangleProperty(String key,
Rectangle defaultValue)
Get a Rectangle property value. |
|
String[] |
getStringArrayProperty(String key,
String[] defaultValue)
Get a String array property value. |
|
String |
getStringProperty(String key,
String defaultValue)
Get a String property value. |
|
int |
hashCode()
|
|
void |
load()
Ask the settings implementation to load the settings values. |
|
void |
removeProperty(String key)
Remove the property. |
|
void |
removePropertyChangeListener(String settingKey,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific setting. |
|
void |
save()
Ask the settings implementation to save the settings values. |
|
void |
saveAs(File fil)
Save all the settings to a new property file. |
|
void |
setBooleanProperty(String key,
boolean value)
Set a new value for a boolean property. |
|
void |
setBooleanProperty(String key,
Boolean value)
Set a new value for a Boolean property. |
|
void |
setColorProperty(String key,
Color value)
Set a new value for a Color property. |
|
void |
setDimensionProperty(String key,
Dimension value)
Set a new value for a Dimension property. |
|
void |
setDoubleProperty(String key,
double value)
Set a new value for a double property. |
|
|
setEnumProperty(String key,
T value)
Set a new value for a enumerated property. |
|
void |
setFileProperty(String key,
String value)
Set a new value for a File or Directory property. |
|
void |
setIntArrayProperty(String key,
int[] value)
Set a new value for a int array property. |
|
void |
setIntegerProperty(String key,
Integer value)
Set a new value for a Integer property. |
|
void |
setIntProperty(String key,
int value)
Set a new value for a int property. |
|
void |
setName(String newName)
|
|
void |
setPasswordProperty(String key,
String value)
Set a new value for a String property. |
|
|
setProperty(String key,
TypeHelper<T> helper,
T value)
Set a property of type defined by the helper. |
|
void |
setPropertyAsInternalString(String key,
String value)
Set a property value using its internal string representation. |
|
void |
setPropertyFile(File fil)
Set a new property file to store the settings. |
|
void |
setRectangleProperty(String key,
Rectangle value)
Set a new value for a Rectangle property. |
|
void |
setStringArrayProperty(String key,
String[] value)
Set a new value for a String array property. |
|
void |
setStringProperty(String key,
String value)
Set a new value for a String property. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SUB_SETTING_NAME
| Constructor Detail |
|---|
public SubSettingsProxy(Settings parentSettings,
String prefix)
propertyFile - File where the properties are stored.descr - Description of properties written as header in properties file.
public SubSettingsProxy(Settings parentSettings,
String prefix,
int i)
propertyFile - File where the properties are stored.descr - Description of properties written as header in properties file.i - the index of this SubSettingsProxy (if they are indexed). -1 for non-indexed.| Method Detail |
|---|
public int getIndex()
public void clear()
public void copyValues(Settings other)
clear() before copying.
other - the other settings containing the values to copy.public void dump()
public String toString()
toString in class Objectpublic String getName()
public void setName(String newName)
public int compareTo(SubSettingsProxy other)
compareTo in interface Comparable<SubSettingsProxy>public boolean equals(Object other)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String getPropertyAsInternalString(String key)
Settings
getPropertyAsInternalString in interface Settingskey - Key for the property value.
public void setPropertyAsInternalString(String key,
String value)
Settings
setPropertyAsInternalString in interface Settingskey - Key for the property value.value - The new value of the property to associate to the given key.
public <T> T getProperty(String key,
TypeHelper<T> helper,
T defaultValue)
SettingsTypeHelper classes). For properties using a pre-defined type you should use the type-specific
method.
Note that if you create a new data type the same type helper INSTANCE should be used in all set and get for this type.
getProperty in interface Settingskey - Key for the property value.helper - Helper identifying the value type and knowing how to convert between string and the requested type. If the helper
is null, a string value is returned.
public <T> void setProperty(String key,
TypeHelper<T> helper,
T value)
SettingsTypeHelper classes). For properties using a pre-defined type you should use the type-specific
method. Note that if you create a new data type the same type helper INSTANCE should be used in all set and get for this type.
setProperty in interface Settingskey - Key for the property value.helper - Helper identifying the value type and knowing how to convert between string and the requested type. If the given
helper is null, the property will be stored as string (with basic toString conversion in the backing
properties map). When the given helper is null, no propertyChange event is generated.value - The new value of the property to associate to the given key.public String getPropertyFilePath()
Settings
getPropertyFilePath in interface Settingspublic FilePathUtils getFilePathUtils()
Settings
getFilePathUtils in interface Settings
public void load()
throws IOException
SettingsSettings implementation.)
load in interface SettingsIOException - If something prevents the settings to be loaded.
public void save()
throws IOException
SettingsSettings implementation.)
save in interface SettingsIOException - If something prevents the settings to be saved.public void setPropertyFile(File fil)
Settings
setPropertyFile in interface Settingsfil - The new properties file.
public void saveAs(File fil)
throws IOException
Settings
saveAs in interface Settingsfil - The new properties file.
IOException - If something prevents the settings to be saved.public boolean containsProperty(String key)
Settings
containsProperty in interface Settingskey - Key for the value.
public String getStringProperty(String key,
String defaultValue)
Settings
getStringProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setStringProperty(String key,
String value)
Settings
setStringProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public String getPasswordProperty(String key,
String defaultValue)
Settings
getPasswordProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setPasswordProperty(String key,
String value)
Settings
setPasswordProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public String[] getStringArrayProperty(String key,
String[] defaultValue)
Settings
getStringArrayProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setStringArrayProperty(String key,
String[] value)
Settings
setStringArrayProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public int getIntProperty(String key,
int defaultValue)
Settings
getIntProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setIntProperty(String key,
int value)
Settings
setIntProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public Integer getIntegerProperty(String key,
Integer defaultValue)
Settings
getIntegerProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setIntegerProperty(String key,
Integer value)
Settings
setIntegerProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public double getDoubleProperty(String key,
double defaultValue)
Settings
getDoubleProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setDoubleProperty(String key,
double value)
Settings
setDoubleProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public boolean getBooleanProperty(String key,
boolean defaultValue)
Settings
getBooleanProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setBooleanProperty(String key,
boolean value)
Settings
setBooleanProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public Boolean getBooleanProperty(String key,
Boolean defaultValue)
Settings
getBooleanProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setBooleanProperty(String key,
Boolean value)
Settings
setBooleanProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public int[] getIntArrayProperty(String key,
int[] defaultValue)
Settings
getIntArrayProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setIntArrayProperty(String key,
int[] value)
Settings
setIntArrayProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public Rectangle getRectangleProperty(String key,
Rectangle defaultValue)
Settings
getRectangleProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setRectangleProperty(String key,
Rectangle value)
Settings
setRectangleProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public Dimension getDimensionProperty(String key,
Dimension defaultValue)
Settings
getDimensionProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setDimensionProperty(String key,
Dimension value)
Settings
setDimensionProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public Color getColorProperty(String key,
Color defaultValue)
Settings
getColorProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public void setColorProperty(String key,
Color value)
Settings
setColorProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public <T extends Enum<T>> T getEnumProperty(String key,
T defaultValue)
Settings
getEnumProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key.
public <T extends Enum<T>> void setEnumProperty(String key,
T value)
Settings
setEnumProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
public String getFileProperty(String key,
String defaultValue)
Settings
getFileProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key. (if used, the default value will be processed to
ensure it's absolute)
public String getFileProperty(String key,
String defaultValue,
boolean absolute)
Settings
getFileProperty in interface Settingskey - Key for the value.defaultValue - Default value to be returned if no value is found for the key. (if used, the default value will be processed to
ensure it's relative or absolute as requested)absolute - tells if the returned file should be absolute or relative to the settings base directory.
public void setFileProperty(String key,
String value)
throws InvalidPathException
Settings
setFileProperty in interface Settingskey - Key for the value.value - New value to be associated with the key.
InvalidPathException - if the file set is invalid.
public void addPropertyChangeListener(String settingKey,
PropertyChangeListener listener)
Settings
addPropertyChangeListener in interface SettingssettingKey - The key of the setting to listen on.listener - The PropertyChangeListener to be added
public void removePropertyChangeListener(String settingKey,
PropertyChangeListener listener)
Settings
removePropertyChangeListener in interface SettingssettingKey - The key of the setting that was listened on.listener - The PropertyChangeListener to be removedpublic Iterator<String> getKeys()
Settings
getKeys in interface Settingspublic void removeProperty(String key)
Settings
removeProperty in interface Settingskey - Key of the property to remove.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||