frysk.gui.prefs
Class ColorPreference

java.lang.Object
  extended by frysk.gui.prefs.FryskPreference
      extended by frysk.gui.prefs.ColorPreference
All Implemented Interfaces:
Saveable
Direct Known Subclasses:
SyntaxPreference

public class ColorPreference
extends FryskPreference

ColorPreference models a color-values preference for Frysk


Nested Class Summary
static interface ColorPreference.ColorPreferenceListener
           
 
Field Summary
protected  org.gnu.gdk.Color currentColor
           
protected  org.gnu.gdk.Color fallback
           
protected  LinkedList listeners
           
 
Fields inherited from class frysk.gui.prefs.FryskPreference
model, name
 
Constructor Summary
ColorPreference(String name, org.gnu.gdk.Color fallback)
          Creates a new ColorPreference
 
Method Summary
 void addListener(ColorPreference.ColorPreferenceListener listener)
          Adds a listener to this preference that will get notified whenever the value of this preference changes
 org.gnu.gdk.Color getCurrentColor()
           
 void load(Preferences prefs)
          Sets the preference to use the provided model and loads the values from it.
 void revert()
          Restores the current value of this preference from the model.
 void save(Preferences prefs)
          Saves the value of this preference into the preference model and notify all attached listeners
 void setCurrentColor(org.gnu.gdk.Color currentColor)
          Sets the current color for this preference.
 
Methods inherited from class frysk.gui.prefs.FryskPreference
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentColor

protected org.gnu.gdk.Color currentColor

fallback

protected org.gnu.gdk.Color fallback

listeners

protected LinkedList listeners
Constructor Detail

ColorPreference

public ColorPreference(String name,
                       org.gnu.gdk.Color fallback)
Creates a new ColorPreference

Parameters:
name - The name of the preference
fallback - The default color to use
Method Detail

setCurrentColor

public void setCurrentColor(org.gnu.gdk.Color currentColor)
Sets the current color for this preference. Note that this is not saved into the model until save(Preferences) is called.

Parameters:
currentColor - The new color

getCurrentColor

public org.gnu.gdk.Color getCurrentColor()
Returns:
The current value of this preference

save

public void save(Preferences prefs)
Saves the value of this preference into the preference model and notify all attached listeners


load

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


addListener

public void addListener(ColorPreference.ColorPreferenceListener listener)
Adds a listener to this preference that will get notified whenever the value of this preference changes

Parameters:
listener - The object to notify when the preference changes.

revert

public void revert()
Restores the current value of this preference from the model.

Specified by:
revert in class FryskPreference