frysk.gui.prefs
Class PreferenceGroup

java.lang.Object
  extended by frysk.gui.prefs.PreferenceGroup
All Implemented Interfaces:
Saveable
Direct Known Subclasses:
SourceWinPreferenceGroup, SyntaxPreferenceGroup

public class PreferenceGroup
extends Object
implements Saveable

A preference group is a collection of preferences that all belong to the same category.


Constructor Summary
PreferenceGroup(String name, int tabNum)
          Create a new Preference Group.
 
Method Summary
 void addPreference(FryskPreference preference)
          Adds a new preference to this group
 void addSubgroup(PreferenceGroup subgroup)
          Adds a new subgroup to this group
 boolean contains(FryskPreference preference)
          Checks to see if a preference is in this group
 String getName()
           
 FryskPreference getPreference(String name)
           
 Iterator getPreferences()
           
 PreferenceGroup getSubgroup(String name)
           
 Iterator getSubgroups()
           
 int getTabNum()
           
 void load(Preferences prefs)
          Replaces the current value of all preferences in the group with the values in the underlying preferences model.
 void removePreference(FryskPreference preference)
          Removes the preference from the group.
 void removePreference(String prefName)
          Same as removePreference(FryskPreference), except removes the preference by name
 void removeSubgroup(PreferenceGroup group)
          Removes the provided subgroup.
 void removeSubgroup(String name)
          Removes the subgroup with the given name
 void revertAll()
          Reverts all the preferences in this group back to the values in the model
 void save(Preferences prefs)
          Saves the values of the preferences into the preference model.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferenceGroup

public PreferenceGroup(String name,
                       int tabNum)
Create a new Preference Group.

Parameters:
name - The name of the group.
Method Detail

getPreferences

public Iterator getPreferences()
Returns:
An iterator to all the preferences in this group

getPreference

public FryskPreference getPreference(String name)
Parameters:
name - The name of the preference to look up
Returns:
The Preference, or null if no preference is found

getName

public String getName()
Returns:
The name of this group

addPreference

public void addPreference(FryskPreference preference)
Adds a new preference to this group

Parameters:
preference - The preference to add

removePreference

public void removePreference(FryskPreference preference)
Removes the preference from the group. If the preference is not in this group no action is performed

Parameters:
preference - The preference to remvoe

removePreference

public void removePreference(String prefName)
Same as removePreference(FryskPreference), except removes the preference by name

Parameters:
prefName - The name of the preference to remove

save

public void save(Preferences prefs)
Saves the values of the preferences into the preference model. This propagates down through all Preferences in the group.

Specified by:
save in interface Saveable

load

public void load(Preferences prefs)
Replaces the current value of all preferences in the group with the values in the underlying preferences model.

Specified by:
load in interface Saveable

contains

public boolean contains(FryskPreference preference)
Checks to see if a preference is in this group

Parameters:
preference - The preference to look for
Returns:
True iff the preference is in the group.

revertAll

public void revertAll()
Reverts all the preferences in this group back to the values in the model


addSubgroup

public void addSubgroup(PreferenceGroup subgroup)
Adds a new subgroup to this group

Parameters:
subgroup - The subgroup

getSubgroup

public PreferenceGroup getSubgroup(String name)
Parameters:
name - The name of the subgroup to fetch
Returns:
The subgroup, or null if no such subgroup exists

getSubgroups

public Iterator getSubgroups()
Returns:
An iterator to all subgroups

removeSubgroup

public void removeSubgroup(String name)
Removes the subgroup with the given name

Parameters:
name -

removeSubgroup

public void removeSubgroup(PreferenceGroup group)
Removes the provided subgroup.

Parameters:
group - The subgroup to remove

getTabNum

public int getTabNum()
Returns:
The preference window tab number corresponding to this preference