Oracle Help for Java API Reference
Release 4.2.7.0.0
B12198-01

oracle.help.viewer
Class PreferenceManager

java.lang.Object
  |
  +--oracle.help.viewer.PreferenceManager

public class PreferenceManager
extends java.lang.Object

The PreferenceManager class provides a generic way of maintaining a collection of preferences. The PreferenceManager supplies loadPreferences for loading preferences from an XML file, and savePreferences for committing the currently selected preferences to disk. setFilename is used to specify the name of the file which is associated with the PreferenceManager. Preferences may also be set explicitly through setPreference, or setPreferenceNoClobber which will not override a currently existing preference.


Field Summary
static java.lang.String CLOSE
           
static java.lang.String COMMENT
           
static java.lang.String EQUALS
           
static java.lang.String INDENT
           
static java.lang.String NAME
           
static java.lang.String OPEN
           
static java.lang.String PREF
           
static java.lang.String PREFERENCES
           
static java.lang.String QUEST
           
static java.lang.String QUOTE
           
static java.lang.String SLASH
           
static java.lang.String SPACE
           
static java.lang.String VALUE
           
static java.lang.String XML
           
 
Constructor Summary
PreferenceManager()
           
 
Method Summary
static java.lang.String getPreference(java.lang.String name)
          Retrieve the value of a preference.
static void loadPreferences()
          Load the preferences from the file currently associated with the preference manager.
static void savePreferences()
          Save the preferences to the file currently associated with the preference manager in XML format.
static void setFilename(java.lang.String filename)
          Sets the file associated with the preference manager
static void setPreference(java.lang.String name, java.lang.String value)
          Add a preference (a name/value pair) to the current set of preferences.
static void setPreferenceNoClobber(java.lang.String name, java.lang.String value)
          If no preference of the given name exists in the set of preferences already, then create it and set its value; otherwise leave the existing preference alone.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFERENCES

public static final java.lang.String PREFERENCES

PREF

public static final java.lang.String PREF

NAME

public static final java.lang.String NAME

VALUE

public static final java.lang.String VALUE

OPEN

public static final java.lang.String OPEN

CLOSE

public static final java.lang.String CLOSE

SLASH

public static final java.lang.String SLASH

INDENT

public static final java.lang.String INDENT

SPACE

public static final java.lang.String SPACE

EQUALS

public static final java.lang.String EQUALS

QUOTE

public static final java.lang.String QUOTE

QUEST

public static final java.lang.String QUEST

XML

public static final java.lang.String XML

COMMENT

public static final java.lang.String COMMENT
Constructor Detail

PreferenceManager

public PreferenceManager()
Method Detail

setFilename

public static void setFilename(java.lang.String filename)
Sets the file associated with the preference manager
Parameters:
filename - the name of the file from which the PreferenceManager will hereafter attempt to read preferences from and write preferences to

loadPreferences

public static void loadPreferences()
Load the preferences from the file currently associated with the preference manager.

savePreferences

public static void savePreferences()
Save the preferences to the file currently associated with the preference manager in XML format.

setPreference

public static void setPreference(java.lang.String name,
                                 java.lang.String value)
Add a preference (a name/value pair) to the current set of preferences.
Parameters:
name - The name of the preference which is being set.
value - The value of the preference.

setPreferenceNoClobber

public static void setPreferenceNoClobber(java.lang.String name,
                                          java.lang.String value)
If no preference of the given name exists in the set of preferences already, then create it and set its value; otherwise leave the existing preference alone. This is useful for specifying defaults.
Parameters:
name - The name of the preference which is being set.
value - The value of the preference.

getPreference

public static java.lang.String getPreference(java.lang.String name)
Retrieve the value of a preference.
Parameters:
name - The name of a preference already in the preference set.

HELP ${project.version}

Copyright © 1998,2003, Oracle. All Rights Reserved.