rjw.flex.settings
Class Settings

java.lang.Object
  |
  +--rjw.flex.settings.Settings

public class Settings
extends java.lang.Object

Contains all Settings Groups and there settings. The Settings class is the only class which needs to be referenced to add groups, add settings, get settings and get values of settings.

Since:
1.3
Version:
DC0.50
Author:
Robert-Jan van der Waals

Constructor Summary
Settings()
           
 
Method Summary
static void addGroup(java.lang.String sKey, SettingsGroup group)
          Adds a group to the hashtable.
static void addSetting(java.lang.String sGroupKey, Setting setting)
          Adds a setting to a specified group.
static java.util.Vector getFlatSettingsGroups()
          Retrieves all settings groups without an hierarchy
static Setting getSetting(java.lang.String sSettingsKey)
          Retrieves a setting
static java.util.Vector getSettings()
          Retrieves all the settings
static java.io.File getSettingsFile()
           
static java.util.Hashtable getSettingsGroups()
          Retrieves all the top-level groups
static java.lang.Object getValue(java.lang.String sKey)
          Retrieves a value of a setting
static boolean getValueAsBoolean(java.lang.String sKey)
          Returns the value of the setting as a boolean
static java.awt.Color getValueAsColor(java.lang.String sKey)
          Returns the value of the setting as a color object
static java.awt.Dimension getValueAsDimension(java.lang.String sKey)
          Returns the value of the setting as a String
static int getValueAsInt(java.lang.String sKey)
          Returns the value of the setting as an integer
static int[] getValueAsIntegerArray(java.lang.String sKey)
           
static java.lang.String getValueAsString(java.lang.String sKey)
          Returns the value of the setting as a String
static java.lang.String[] getValueAsStringArray(java.lang.String sKey)
          Returns the value of the setting as a String array
static boolean isSettingKeyValid(java.lang.String sKey)
           
static void setSettingsFile(java.io.File file)
          Specifies the location and name of the settings file
static void setStringAsValue(java.lang.String sKey, java.lang.String sValue)
          Sets a string as a value for the setting (by parsing the string)
static void setValue(java.lang.String sKey, java.lang.Object oValue)
          Sets the value of a setting
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Settings

public Settings()
Method Detail

addGroup

public static void addGroup(java.lang.String sKey,
                            SettingsGroup group)
Adds a group to the hashtable. A group may contain sub-groups. Only the parent, to which a sub-group belongs, should be added.

Parameters:
sKey - unique identifier for this group
group - a top-level group (parent)

setSettingsFile

public static void setSettingsFile(java.io.File file)
Specifies the location and name of the settings file

Parameters:
file - the settings file

getSettingsFile

public static java.io.File getSettingsFile()

addSetting

public static void addSetting(java.lang.String sGroupKey,
                              Setting setting)
Adds a setting to a specified group. A group can be either a parent or a child.

Parameters:
sGroupKey - the key of the group
setting - the setting to be added to the specified group

isSettingKeyValid

public static boolean isSettingKeyValid(java.lang.String sKey)

getSetting

public static Setting getSetting(java.lang.String sSettingsKey)
Retrieves a setting

Parameters:
sSettingsKey - the settings key

getValue

public static java.lang.Object getValue(java.lang.String sKey)
Retrieves a value of a setting

Parameters:
sKey - the settings key

getValueAsStringArray

public static java.lang.String[] getValueAsStringArray(java.lang.String sKey)
Returns the value of the setting as a String array

Parameters:
sKey - the settings key

getValueAsIntegerArray

public static int[] getValueAsIntegerArray(java.lang.String sKey)

getValueAsInt

public static int getValueAsInt(java.lang.String sKey)
Returns the value of the setting as an integer

Parameters:
sKey - the settings key

getValueAsBoolean

public static boolean getValueAsBoolean(java.lang.String sKey)
Returns the value of the setting as a boolean

Parameters:
sKey - the settings key

getValueAsColor

public static java.awt.Color getValueAsColor(java.lang.String sKey)
Returns the value of the setting as a color object

Parameters:
sKey - the settings key

getValueAsDimension

public static java.awt.Dimension getValueAsDimension(java.lang.String sKey)
Returns the value of the setting as a String

Parameters:
sKey - the settings key

getValueAsString

public static java.lang.String getValueAsString(java.lang.String sKey)
Returns the value of the setting as a String

Parameters:
sKey - the settings key

setValue

public static void setValue(java.lang.String sKey,
                            java.lang.Object oValue)
Sets the value of a setting

Parameters:
sKey - the settings key
oValue - the value

setStringAsValue

public static void setStringAsValue(java.lang.String sKey,
                                    java.lang.String sValue)
Sets a string as a value for the setting (by parsing the string)

Parameters:
sKey - the settings key
sValue - the string value to be parsed

getSettingsGroups

public static java.util.Hashtable getSettingsGroups()
Retrieves all the top-level groups


getFlatSettingsGroups

public static java.util.Vector getFlatSettingsGroups()
Retrieves all settings groups without an hierarchy


getSettings

public static java.util.Vector getSettings()
Retrieves all the settings