|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<java.lang.Object,java.lang.Object>
java.util.Properties
org.brains2b.swingext.conf.UserPreference
public class UserPreference
Abstract class extending Properties to use for user preferences in an application.
Properties
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
DEFAULTPATH
Constant defining the default path "user.home"/.java/conf as a String |
Fields inherited from class java.util.Properties |
---|
defaults |
Constructor Summary | |
---|---|
UserPreference(java.io.File file)
Constructor for UserProperties. |
|
UserPreference(java.lang.String filename)
Constructor for UserProperties. |
Method Summary | |
---|---|
java.lang.String |
getFilename()
gets the filename with its path that is used to store the properties |
protected boolean |
isDirty()
Checks to see if the properties have changed. |
void |
load()
loads the properties from the defined file. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
add or modify a property to these UserProperties. |
void |
setDefault(java.lang.String key,
java.lang.String defaultValue)
sets a property as default This means that if a value already exists it is not overwritten and isDirty will stay false |
protected void |
setDirty(boolean dirty)
Mark these properties as having been changed. |
protected void |
setFile(java.io.File f)
|
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
|
void |
store()
|
Methods inherited from class java.util.Properties |
---|
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, store, storeToXML, storeToXML |
Methods inherited from class java.util.Hashtable |
---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULTPATH
Constructor Detail |
---|
public UserPreference(java.lang.String filename)
filename
- String, the filename or relative filepath,including filename
to DEFAULTPATH.
The file does not have to exist. Be aware that if you define a relative path this path will be created if properties need to be saved and path does not exist already. Be aware that you need OS access rights to the location you specified for the properties to be saved.
If you want to define the complete path yourself please use UserProperties(File)
public UserPreference(java.io.File file)
file
- File, file object to a properties location.
The file does not have to exist. Be aware that if you define a path this path will be created if properties need to be saved and path does not exist already. Be aware that you need OS access rights to the location you specified for the properties to be saved.
Method Detail |
---|
public void load()
public void store()
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
setProperty
in class java.util.Properties
public void setDefault(java.lang.String key, java.lang.String defaultValue)
This means that if a value already exists it is not overwritten and isDirty will stay false
key
- String, the key for this propertydefaultValue
- String, the defaultValue to setpublic java.lang.Object put(java.lang.Object key, java.lang.Object value)
prefered is using setProperty instead of this function. Overwritten to track changes.
put
in interface java.util.Map<java.lang.Object,java.lang.Object>
put
in class java.util.Hashtable<java.lang.Object,java.lang.Object>
protected boolean isDirty()
protected void setDirty(boolean dirty)
dirty
- The dirty to setprotected void setFile(java.io.File f)
public java.lang.String getFilename()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |