|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.generic.util.prefs.PreferenceUtilities
Class PreferenceUtilities provides several helpful utility methods.
These static methods are useful in situations when dealing with lists of attributes.
| Method Summary | |
static void |
addToFifoList(Preferences prefs,
java.lang.String key,
java.lang.String value,
int listLength)
Adds the given value to the list of values set for key key.
|
static void |
removeFromFifoList(Preferences prefs,
java.lang.String key,
java.lang.String value)
Removes value value from the list associated with the
given key. |
static void |
resizeList(Preferences prefs,
java.lang.String key,
int newSize)
Resizes the list associated to key key to the given size by
dropping out all items coming after index newSize. |
static java.lang.String |
shortenFileName(java.lang.String fileName,
int len)
Shortens the given filename to fit length len. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static final void addToFifoList(Preferences prefs,
java.lang.String key,
java.lang.String value,
int listLength)
key.
The element is added with a FIFO-strategy.
If the list length exceeds listLength, the first added element
in the list will be dropped out. This method is useful, if you want to offer a list
of recently used files in your application using the preferences. The value
will not be added, if the list already contains it.
prefs - The preferences instance to work onkey - the key of the value list.value - the value to add to the list.listLength - the maximum list length.
public static final void removeFromFifoList(Preferences prefs,
java.lang.String key,
java.lang.String value)
value from the list associated with the
given key.
prefs - The preferences instance to work onkey - the key of the list.value - the value to be removed.
public static final void resizeList(Preferences prefs,
java.lang.String key,
int newSize)
key to the given size by
dropping out all items coming after index newSize. Nothing
will be done if the new size is greater than the number of elements
currently stored in the list associated with the given key.
prefs - The preferences instance to work onkey - the key associated to the list.newSize - the new size of the list.
public static final java.lang.String shortenFileName(java.lang.String fileName,
int len)
len. It tries to
get as much of the original filename into the shortened version as
possible.
fileName - the filename to shorten.len - the desired length.
InvalidArgumentException - if fileName is null or
len lesser than a minimum length.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||