Class edu.cornell.lassp.mck10.ConfigurePack.Configurable
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class edu.cornell.lassp.mck10.ConfigurePack.Configurable

java.lang.Object
   |
   +----java.util.Observable
           |
           +----edu.cornell.lassp.mck10.ConfigurePack.Configurable

public class Configurable
extends Observable

Configurable is an abstract class which provides the functionality necessary for a variable to be configured in a number of ways:

Every Configurable variable belongs to a tree which gives it a unique name for the purpose of interpreting PARAM tags, and any other purpose where a variable must be uniquely identified. This tree also provides the variable with its position in the menu structure. In order to determine its position in the tree, each variable has a parent of type ConfigurableCollection. ConfigurableCollection is a subclass of Configurable which contains links to other Configurable's and provides functionality for displaying configure menus and interpreting param tags, environment variables, etc.

All configurables must be able to set their values through a set(string val) method, and to return their value as a string through a toString() method. Source code is available.

Version:
0.1
Author:
Matt Kuntz (E-mail: mck10@cornell.edu)
See Also:
ConfigurableCollection

Variable Index

 o IGNORE_PARAMS
If the IGNORE_PARAMS attribute is set, a variable will not try to set itself from the PARAM tags, environment variables, etc.
 o INVISIBLE
If the INVISIBLE attribute is set, a variable will not be displayed in the menus.
 o LOCKED
If the LOCKED attribute is set, a variable may not be changed.
 o MENU_LOCKED
If the MENU_LOCKED attribute is set, even if the variable is unlocked, and visible in a menu, it will not be settable from the menu.
 o checkList
 o numChecks
 o numObservers
 o observers

Constructor Index

 o Configurable(ConfigurableCollection, String, String, int, String)
The constructor for Configurable must perform several actions for every configurable variable.

Method Index

 o addCheck(CheckConfigurable)
addCheck(check) adds the object check to the list of objects which must approve changes in the value of the variable.
 o addObserver(Observer)
addObserver(obs) is overridden to make the notification of observers more eficcient, and more predictable.
 o attributeIsSet(int)
The attributeIsSet(int) method is used to check whether an attribute has been set.
 o attributeSet(int)
The attributeSet(int) method is used to set an attribute.
 o attributeUnSet(int)
The attributeUnSet(int) method is used to unset an attribute.
 o checkValue(Object)
checkValue(value) asks all the registered CheckConfigurable instances whether the value of the variable can be changed to value.
 o createConfigureComponent()
The createConfigureComponent() method returns a component which is designed to edit the Configurable variable.
 o deleteCheck(CheckConfigurable)
deleteCheck(check) removes the object check from the list of objects which must approve changes in the value of the variable.
 o deleteObserver(Observer)
deleteObserver(obs) is overridden to make the notification of observers more eficcient, and more predictable.
 o deleteObservers()
deleteObservers() removes all observers from the notification list.
 o displayFrame()
The displayFrame() method is used to display a frame to configure the variable.
 o getFullName()
The getFullName() method is used to get the full, unique name of a variable.
 o getLongName()
The getLongName() method is used to get the long name of a variable.
 o getShortName()
The getShortName() method is used to get the short name of a variable.
 o hideFrame()
The hideFrame() method is used to hide the frame for a Configurable.
 o newFrame()
 o notifyObservers(Object)
notifyObservers(arg) notifies all observers in the order in which they were added.
 o notifyObservers()
notifyObservers() notifies all observers in the order in which they were added.
 o set(String)
The set(String val) abstract method is used to set the value of a variable.
 o setLongName(String)
The setLongName(String) method is used to reset the long name of a variable.
 o toString()
The toString() abstract method is used to get the value of the variable as a string.

Variables

 o LOCKED
  public final static int LOCKED
If the LOCKED attribute is set, a variable may not be changed.
 o INVISIBLE
  public final static int INVISIBLE
If the INVISIBLE attribute is set, a variable will not be displayed in the menus.
 o IGNORE_PARAMS
  public final static int IGNORE_PARAMS
If the IGNORE_PARAMS attribute is set, a variable will not try to set itself from the PARAM tags, environment variables, etc.
 o MENU_LOCKED
  public final static int MENU_LOCKED
If the MENU_LOCKED attribute is set, even if the variable is unlocked, and visible in a menu, it will not be settable from the menu.
 o observers
  protected Vector observers
 o numObservers
  protected int numObservers
 o checkList
  protected Vector checkList
 o numChecks
  protected int numChecks

Constructors

 o Configurable
  public Configurable(ConfigurableCollection parent,
                      String shortName,
                      String longName,
                      int Att,
                      String defaultVal)
The constructor for Configurable must perform several actions for every configurable variable. It must:

Parameters:
parent - The ConfigurableCollection above the varaible in the tree
shortName - The short name of the variable. This is used to give the variable its unique name.
longName - The long name of the variable. This is the name which is displayed to the user in the menus.
att - An integer bitmask containing various attributes of the variable.
defaultVal - A string containing the default value of the variable.

Methods

 o set
  public abstract boolean set(String val)
The set(String val) abstract method is used to set the value of a variable.
Parameters:
val - A string containing the value to be set.
 o toString
  public abstract String toString()
The toString() abstract method is used to get the value of the variable as a string.
Returns:
A string containing the value of the variable
Overrides:
toString in class Object
 o attributeIsSet
  public boolean attributeIsSet(int Att)
The attributeIsSet(int) method is used to check whether an attribute has been set.
Parameters:
Att - This is a mask containing the attributes to be checked.
Returns:
A boolean containing true if the attribute is set, and false if it is not set.
 o attributeUnSet
  public void attributeUnSet(int Att)
The attributeUnSet(int) method is used to unset an attribute.
Parameters:
Att - This is a mask containing the attributes to be unset.
 o attributeSet
  public void attributeSet(int Att)
The attributeSet(int) method is used to set an attribute.
Parameters:
Att - This is a mask containing the attributes to be set.
 o getFullName
  public String getFullName()
The getFullName() method is used to get the full, unique name of a variable.
Returns:
A String containing the full name of the variable.
 o getLongName
  public String getLongName()
The getLongName() method is used to get the long name of a variable.
Returns:
A String containing the long name of the variable.
 o setLongName
  public void setLongName(String longName)
The setLongName(String) method is used to reset the long name of a variable.
Parameters:
longName - This is a string containing the long name of the variable.
 o getShortName
  public String getShortName()
The getShortName() method is used to get the short name of a variable.
Returns:
A string containing the short name of the variable.
 o newFrame
  protected Frame newFrame()
 o displayFrame
  public void displayFrame()
The displayFrame() method is used to display a frame to configure the variable. The Configurable class provides a default frame, which can be used to modify any type of configurable which has properly implemented toString() and set(String) methods.
 o hideFrame
  public void hideFrame()
The hideFrame() method is used to hide the frame for a Configurable.
 o createConfigureComponent
  public Component createConfigureComponent()
The createConfigureComponent() method returns a component which is designed to edit the Configurable variable.
Returns:
A component for editing the variable.
 o addObserver
  public final void addObserver(Observer obs)
addObserver(obs) is overridden to make the notification of observers more eficcient, and more predictable. It simply adds an observer to the list of observers to be notified. The observers are always notified in the order in which they were added. The method is declared final so that it can be inlined.
Parameters:
obs - The observer to add.
Overrides:
addObserver in class Observable
 o deleteObserver
  public final void deleteObserver(Observer obs)
deleteObserver(obs) is overridden to make the notification of observers more eficcient, and more predictable. It will delete the observer from the list of observers to be notified.
Parameters:
obs - The observer to delete.
Overrides:
deleteObserver in class Observable
 o deleteObservers
  public final void deleteObservers()
deleteObservers() removes all observers from the notification list.
Overrides:
deleteObservers in class Observable
 o notifyObservers
  public final void notifyObservers(Object arg)
notifyObservers(arg) notifies all observers in the order in which they were added. The parameter arg is passed to the observers as the second parameter of the update method.
Parameters:
arg - A parameter which is passed to the observers' update methods.
Overrides:
notifyObservers in class Observable
 o notifyObservers
  public final void notifyObservers()
notifyObservers() notifies all observers in the order in which they were added.
Overrides:
notifyObservers in class Observable
 o addCheck
  public void addCheck(CheckConfigurable check)
addCheck(check) adds the object check to the list of objects which must approve changes in the value of the variable.
Parameters:
check - The instance of CheckConfigurable to be added.
 o deleteCheck
  public void deleteCheck(CheckConfigurable check)
deleteCheck(check) removes the object check from the list of objects which must approve changes in the value of the variable.
Parameters:
check - The instance of CheckConfigurable to be removed.
 o checkValue
  public boolean checkValue(Object value)
checkValue(value) asks all the registered CheckConfigurable instances whether the value of the variable can be changed to value. If any of them return false, checkValue returs false. If they all return true, checkValue returns true, and the value is accepted.
Parameters:
value - The value the variable is supposed to change to.

All Packages  Class Hierarchy  This Package  Previous  Next  Index