com.threerings.toybox.client
Class ToyBoxPrefs

java.lang.Object
  extended by com.threerings.toybox.client.ToyBoxPrefs

public class ToyBoxPrefs
extends Object

Maintains preferences for the ToyBox client.


Field Summary
static PrefsConfig config
          Defines the location in the preference system of our prefs.
protected static String PASSWORD_KEY
          The configuration key for the user's password.
protected static String PASSWORD_LEN_KEY
          The configuration key for the user's password length.
protected static String REMEMBER_PASSWORD_KEY
          The configuration key for whether the user's password is remembered.
protected static String USERNAME_KEY
          The configuration key for the user's username.
 
Constructor Summary
ToyBoxPrefs()
           
 
Method Summary
static Rectangle getClientBounds(String gameId, String username)
          Returns the preferred bounds for the client frame.
static String getPassword()
          Returns the user's (encrypted) password.
static int getPasswordLength()
          Gets the length of the unencrypted password.
static boolean getRememberPassword()
          Returns whether we're remembering the user's password.
static String getUsername()
          Returns the user's username.
protected static String makeKey(String gameId, String username)
          A helper function.
static void setClientBounds(String gameId, String username, Rectangle bounds)
          Updates our stored setting of the preferred bounds for the client frame.
static void setPassword(String value)
          Sets the user's (encrypted) password.
static void setPasswordLength(int len)
          Sets the length of the unencrypted password.
static void setRememberPassword(boolean value)
          Sets whether we're remembering the user's password.
static void setUsername(String value)
          Sets the user's username.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

public static PrefsConfig config
Defines the location in the preference system of our prefs.


USERNAME_KEY

protected static final String USERNAME_KEY
The configuration key for the user's username.

See Also:
Constant Field Values

PASSWORD_KEY

protected static final String PASSWORD_KEY
The configuration key for the user's password.

See Also:
Constant Field Values

PASSWORD_LEN_KEY

protected static final String PASSWORD_LEN_KEY
The configuration key for the user's password length.

See Also:
Constant Field Values

REMEMBER_PASSWORD_KEY

protected static final String REMEMBER_PASSWORD_KEY
The configuration key for whether the user's password is remembered.

See Also:
Constant Field Values
Constructor Detail

ToyBoxPrefs

public ToyBoxPrefs()
Method Detail

getClientBounds

public static Rectangle getClientBounds(String gameId,
                                        String username)
Returns the preferred bounds for the client frame.

Parameters:
gameId - the id of the game we are playing.
username - the developer override username if one was provided or null otherwise.
Returns:
null if no saved bounds exist for this game and user combination or a rectangle indicating the bounds if they do.

setClientBounds

public static void setClientBounds(String gameId,
                                   String username,
                                   Rectangle bounds)
Updates our stored setting of the preferred bounds for the client frame.

Parameters:
gameId - the id of the game we are playing.
username - the developer override username if one was provided or null otherwise.
bounds - the new frame bounds.

getUsername

public static String getUsername()
Returns the user's username.


setUsername

public static void setUsername(String value)
Sets the user's username.


getPassword

public static String getPassword()
Returns the user's (encrypted) password.


setPassword

public static void setPassword(String value)
Sets the user's (encrypted) password.


getPasswordLength

public static int getPasswordLength()
Gets the length of the unencrypted password.


setPasswordLength

public static void setPasswordLength(int len)
Sets the length of the unencrypted password.


getRememberPassword

public static boolean getRememberPassword()
Returns whether we're remembering the user's password.


setRememberPassword

public static void setRememberPassword(boolean value)
Sets whether we're remembering the user's password.


makeKey

protected static String makeKey(String gameId,
                                String username)
A helper function.