Package org.jdesktop.swingx.auth
Class DefaultUserNameStore
java.lang.Object
org.jdesktop.beans.AbstractBean
org.jdesktop.swingx.auth.UserNameStore
org.jdesktop.swingx.auth.DefaultUserNameStore
Saves the user names in Preferences. Because any string could be part
of the user name, for every user name that must be saved a new Preferences
key/value pair must be stored.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addUserName
(String name) Add a username to the store.boolean
containsUserName
(String name) String[]
Gets the current list of users.private void
Creates the default prefs nodevoid
Loads the user names from Preferencesvoid
removeUserName
(String name) Removes a username from the list.void
Saves the user names to Preferencesvoid
setPreferences
(Preferences prefs) void
setUserNames
(String[] userNames) Methods inherited from class org.jdesktop.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
Field Details
-
USER_KEY
The key for one of the preferences- See Also:
-
NUM_KEY
- See Also:
-
prefs
The preferences node -
userNames
Contains the user names. Since the list of user names is not frequently updated, there is no penalty in storing the values in an array.
-
-
Constructor Details
-
DefaultUserNameStore
public DefaultUserNameStore()Creates a new instance of DefaultUserNameStore
-
-
Method Details
-
loadUserNames
public void loadUserNames()Loads the user names from Preferences- Specified by:
loadUserNames
in classUserNameStore
-
saveUserNames
public void saveUserNames()Saves the user names to Preferences- Specified by:
saveUserNames
in classUserNameStore
-
getUserNames
Gets the current list of users.- Specified by:
getUserNames
in classUserNameStore
-
setUserNames
- Specified by:
setUserNames
in classUserNameStore
-
addUserName
Add a username to the store.- Specified by:
addUserName
in classUserNameStore
- Parameters:
name
-
-
removeUserName
Removes a username from the list.- Specified by:
removeUserName
in classUserNameStore
- Parameters:
name
-
-
containsUserName
- Specified by:
containsUserName
in classUserNameStore
-
getPreferences
- Returns:
- Returns Preferences node in which the user names will be stored
-
setPreferences
- Parameters:
prefs
- the Preferences node to store the user names in. If null, or undefined, then they are stored in /org/jdesktop/swingx/auth/DefaultUserNameStore.
-
initPrefs
private void initPrefs()Creates the default prefs node
-