|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Dictionary java.util.Hashtable java.util.Properties net.sf.jomic.tools.BasicSettings
public class BasicSettings
Extended Properties
with additional features.
getIntProperty()
java -D
option)
setDefault()
. This simplifies writing
specialized getters and setters conforming to the Java Beans naming conventions with
predictable default value behavior. (The original Properties
allow to specify
default properties to the constructor, but it is not documented if the can be changed at run
time.)
Properties
,
PropertyChangeSupport
,
Serialized FormField Summary |
---|
Fields inherited from class java.util.Properties |
---|
defaults |
Constructor Summary | |
---|---|
protected |
BasicSettings()
|
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
|
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
|
void |
applyComponentAreaProperty(java.lang.String propertyName,
java.awt.Component component)
Apply the component location and dimension stored in propertyName on component
. |
void |
clear()
Reset all settings to their default value. |
protected void |
firePropertyChangeEvent(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Notify all listeners that have registered interest for notification on this event type. |
boolean |
getBooleanProperty(java.lang.String key)
|
java.lang.String |
getChoiceProperty(java.lang.String propertyName,
java.lang.String[] possibleChoices)
|
java.awt.Color |
getColorProperty(java.lang.String propertyName)
|
java.io.File |
getFileProperty(java.lang.String propertyName)
|
int |
getIntProperty(java.lang.String propertyName)
|
int |
getLimitedIntProperty(java.lang.String propertyName,
int minValue,
int maxValue)
Get property propertyName and make sure that it is within
minValue and maxValue . |
java.lang.String |
getProperty(java.lang.String name)
|
java.lang.String |
getProperty(java.lang.String name,
java.lang.String defaultValue)
Deprecated. use setDefault() to specify a default value |
java.lang.String |
getSystemPropertyName(java.lang.String name)
Get name of system property corresponding to application property name . |
protected boolean |
isValidPropertyName(java.lang.String propertyName)
True if propertyName is valid. |
void |
remove(java.lang.String key)
Remove the property key . |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
|
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
|
void |
setBooleanProperty(java.lang.String key,
boolean value)
|
void |
setChoiceProperty(java.lang.String key,
java.lang.String newValue,
java.lang.String[] possibleChoices)
Set property key to newValue , and notify
all listeners about the change. |
void |
setColorProperty(java.lang.String key,
java.awt.Color newColor)
Sets property key to a string representation of newColor , and
notifies all listeners about the change. |
void |
setComponentAreaProperty(java.lang.String propertyName,
java.awt.Component component)
Set property propertyName to store the location and dimension of component
. |
protected void |
setDefault(java.lang.String key,
boolean value)
Set the default value for boolean property key to value . |
protected void |
setDefault(java.lang.String key,
int value)
Set the default value for integer property key to value . |
protected void |
setDefault(java.lang.String key,
java.lang.String value)
Set the default value for property key to value . |
void |
setFileProperty(java.lang.String propertyName,
java.io.File newValue)
|
void |
setIntProperty(java.lang.String key,
int value)
|
void |
setLimitedIntProperty(java.lang.String key,
int value,
int minValue,
int maxValue)
|
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Set property with name key to value . |
void |
setSystemPropertyPrefix(java.lang.String newSystemPropertyPrefix)
|
Methods inherited from class java.util.Properties |
---|
list, list, load, load, loadFromXML, propertyNames, save, store, store, storeToXML, storeToXML, stringPropertyNames |
Methods inherited from class java.util.Hashtable |
---|
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected BasicSettings()
Method Detail |
---|
public void setBooleanProperty(java.lang.String key, boolean value)
public void setChoiceProperty(java.lang.String key, java.lang.String newValue, java.lang.String[] possibleChoices)
key
to newValue
, and notify
all listeners about the change.
java.lang.IllegalArgumentException
- if newValue
is not within possibleChoices
.public void setColorProperty(java.lang.String key, java.awt.Color newColor)
key
to a string representation of newColor
, and
notifies all listeners about the change.
public void setComponentAreaProperty(java.lang.String propertyName, java.awt.Component component)
propertyName
to store the location and dimension of component
.
public void setFileProperty(java.lang.String propertyName, java.io.File newValue)
public void setIntProperty(java.lang.String key, int value)
public void setLimitedIntProperty(java.lang.String key, int value, int minValue, int maxValue)
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
key
to value
.
setProperty
in class java.util.Properties
public void setSystemPropertyPrefix(java.lang.String newSystemPropertyPrefix)
protected void setDefault(java.lang.String key, java.lang.String value)
key
to value
.
protected void setDefault(java.lang.String key, int value)
key
to value
.
protected void setDefault(java.lang.String key, boolean value)
key
to value
.
public boolean getBooleanProperty(java.lang.String key)
public java.lang.String getChoiceProperty(java.lang.String propertyName, java.lang.String[] possibleChoices)
public java.awt.Color getColorProperty(java.lang.String propertyName)
public java.io.File getFileProperty(java.lang.String propertyName)
public int getIntProperty(java.lang.String propertyName)
public int getLimitedIntProperty(java.lang.String propertyName, int minValue, int maxValue)
propertyName
and make sure that it is within
minValue
and maxValue
. If it is not, fix
it by resetting it to its default. If there is no default for this
property, reset it to the average of minValue
and
maxValue
.
public java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
getProperty
in class java.util.Properties
setDefault(String, String)
public java.lang.String getProperty(java.lang.String name)
getProperty
in class java.util.Properties
public java.lang.String getSystemPropertyName(java.lang.String name)
name
.
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
public void applyComponentAreaProperty(java.lang.String propertyName, java.awt.Component component)
propertyName
on component
.
public void clear()
clear
in interface java.util.Map
clear
in class java.util.Hashtable
public void remove(java.lang.String key)
key
. This either resets it to the internal default, or the
value optionally specified in the corresponding system property.
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
protected boolean isValidPropertyName(java.lang.String propertyName)
True
if propertyName
is valid. Invalid names cause an error
message to be logged that explains why the name was rejected.
protected void firePropertyChangeEvent(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |