VASSAL.preferences
Class Prefs

java.lang.Object
  |
  +--VASSAL.preferences.Prefs

public class Prefs
extends java.lang.Object

A set of preferences. Each set of preferences is identified by a name, and different sets may share a common editor, which is responsible for writing the preferences to disk


Constructor Summary
Prefs(PrefsEditor editor, java.lang.String name)
           
 
Method Summary
 void addOption(Configurer o)
           
 void addOption(java.lang.String category, Configurer o)
           
 void addOption(java.lang.String category, Configurer o, java.lang.String prompt)
          Add a configurable property to the preferences in the given category
 PrefsEditor getEditor()
           
 Configurer getOption(java.lang.String s)
           
 java.lang.String getStoredValue(java.lang.String key)
           
 java.lang.Object getValue(java.lang.String s)
           
 void init(java.lang.String moduleName)
           
 void save()
          Store this set of preferences in the editor, but don't yet save to disk
 void write()
          Save these preferences and write to disk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Prefs

public Prefs(PrefsEditor editor,
             java.lang.String name)
Method Detail

getEditor

public PrefsEditor getEditor()

addOption

public void addOption(Configurer o)

addOption

public void addOption(java.lang.String category,
                      Configurer o)

addOption

public void addOption(java.lang.String category,
                      Configurer o,
                      java.lang.String prompt)
Add a configurable property to the preferences in the given category
Parameters:
category - the tab under which to add the Configurer's controls in the editor window. If null, do not add controls
prompt - If non-null and the value was not read from the preferences file on initialization (i.e. first-time setup), prompt the user for an initial value

getOption

public Configurer getOption(java.lang.String s)

getValue

public java.lang.Object getValue(java.lang.String s)

getStoredValue

public java.lang.String getStoredValue(java.lang.String key)
Parameters:
key - the name of a Preferences option
Returns:
the value for the option that was read from the Preferences file at startup

init

public void init(java.lang.String moduleName)

save

public void save()
          throws java.io.IOException
Store this set of preferences in the editor, but don't yet save to disk

write

public void write()
           throws java.io.IOException
Save these preferences and write to disk