frysk.gui.prefs
Class BooleanPreference

java.lang.Object
  extended by frysk.gui.prefs.FryskPreference
      extended by frysk.gui.prefs.BooleanPreference
All Implemented Interfaces:
Saveable

public class BooleanPreference
extends FryskPreference

BoleanPreference models a boolean-valued preference within Frysk


Nested Class Summary
static interface BooleanPreference.BooleanPreferenceListener
           
 
Constructor Summary
BooleanPreference(String name, boolean fallback)
          Creates a new BooleanPreference
 
Method Summary
 void addListener(BooleanPreference.BooleanPreferenceListener listener)
          Adds a listener that will be notified whenever the value of the preference is changed
 boolean getCurrentValue()
           
 void load(Preferences prefs)
          Sets the preference to use the provided model and loads the value from it
 void revert()
          Restores the preference from the value in the model.
 void save(Preferences prefs)
          Saves the value into the model and notifies the attached listeners.
 void setCurrentValue(boolean val)
          Sets the value of the preference.
 
Methods inherited from class frysk.gui.prefs.FryskPreference
getName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanPreference

public BooleanPreference(String name,
                         boolean fallback)
Creates a new BooleanPreference

Parameters:
name - The name of the preference
fallback - The default value of the preference
Method Detail

getCurrentValue

public boolean getCurrentValue()
Returns:
The current value of the preference

setCurrentValue

public void setCurrentValue(boolean val)
Sets the value of the preference. Note that this is not saved in the preferences model permanently until save(Preferences) is called.

Parameters:
val - The new value

save

public void save(Preferences prefs)
Saves the value into the model and notifies the attached listeners.


load

public void load(Preferences prefs)
Sets the preference to use the provided model and loads the value from it


addListener

public void addListener(BooleanPreference.BooleanPreferenceListener listener)
Adds a listener that will be notified whenever the value of the preference is changed

Parameters:
listener - The object to notify

revert

public void revert()
Restores the preference from the value in the model.

Specified by:
revert in class FryskPreference