|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcore.EventNotifier
core.prefs.PrefsNotifier
core.prefs.Prefs
Handle user and wide preferences. I choose to wrap this around java.util.Properties. User prefs are the user specific preferences file. Wide prefs is the prefs file for every user. User prefs has preference over wide prefs.
| Field Summary | |
static java.lang.String |
COMRADE
The string to prepend to user names so they don't conflict with special folders such as ipserver. |
static java.lang.String |
MESSENGER_DIR_NAME
The name of the directory to save files in user's home. |
static java.lang.String |
PREFS_FILE_NAME
The name of preference files. |
| Constructor Summary | |
Prefs()
Creates a new prefs object for no particular user. |
|
Prefs(IPServer ipServer,
java.lang.String name)
Creates a special preference location for an IPServer. |
|
| Method Summary | |
java.io.File |
getMessengerDirectory()
Returns the directory in the user's home that contains this apps files. |
boolean |
getPreference(java.lang.String key,
boolean def)
Returns the preference value associated with the given key, or def if the given key does not exist. |
int |
getPreference(java.lang.String key,
int def)
Returns the preference value associated with the given key, or def if the given key does not exist. |
java.lang.String |
getPreference(java.lang.String key,
java.lang.String def)
Returns the preference value associated with the given key, or def if the given key does not exist. |
java.io.File |
getUserDirectory()
Returns the users directory. |
void |
save()
Saves the user's prefs file and wide prefs file. |
void |
setNewUser(java.lang.String user)
Set preferences to be the preferences for the given user. |
void |
setPreference(java.lang.String key,
boolean value)
Set the user preference with given key to the given value. |
void |
setPreference(java.lang.String key,
int value)
Set the user preference with given key to the given value. |
void |
setPreference(java.lang.String key,
java.lang.String value)
Set the user preference with given key to the given value. |
void |
setWidePreference(java.lang.String key,
boolean value)
Set the wide preference with given key to the given value. |
void |
setWidePreference(java.lang.String key,
int value)
Set the wide preference with given key to the given value. |
void |
setWidePreference(java.lang.String key,
java.lang.String value)
Set the wide preference with given key to the given value. |
| Methods inherited from class core.prefs.PrefsNotifier |
firePrefChangedEvent |
| Methods inherited from class core.EventNotifier |
addListener, removeListener |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String MESSENGER_DIR_NAME
public static final java.lang.String PREFS_FILE_NAME
public static final java.lang.String COMRADE
| Constructor Detail |
public Prefs()
public Prefs(IPServer ipServer,
java.lang.String name)
ipServer - The ipserver to load prefs for.name - The name of the ipserver.| Method Detail |
public void setNewUser(java.lang.String user)
user - The user whose preferences will be loaded.public void save()
public java.io.File getUserDirectory()
public void setPreference(java.lang.String key,
java.lang.String value)
key - The key to access the preference.value - The value to be associated with the given key.
public void setWidePreference(java.lang.String key,
java.lang.String value)
key - The key to access the preference.value - The value to be associated with the given key.
public java.lang.String getPreference(java.lang.String key,
java.lang.String def)
key - The key the preference wanted is associated with.def - The default value to return if no value is found.
public void setPreference(java.lang.String key,
int value)
key - The key to access the preference.value - The value to be associated with the given key.
public void setWidePreference(java.lang.String key,
int value)
key - The key to access the preference.value - The value to be associated with the given key.
public int getPreference(java.lang.String key,
int def)
key - The key the preference wanted is associated with.def - The default value to return if no value is found.
public void setPreference(java.lang.String key,
boolean value)
key - The key to access the preference.value - The value to be associated with the given key.
public void setWidePreference(java.lang.String key,
boolean value)
key - The key to access the preference.value - The value to be associated with the given key.
public boolean getPreference(java.lang.String key,
boolean def)
key - The key the preference wanted is associated with.def - The default value to return if no value is found.
public java.io.File getMessengerDirectory()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||