Logo Search packages:      
Sourcecode: wims version File versions  Download package

edu::hws::jcm::awt::Controller Class Reference

Inheritance diagram for edu::hws::jcm::awt::Controller:

edu::hws::jcm::awt::Computable edu::hws::jcm::awt::InputObject

List of all members.


Detailed Description

Controllers are the focus of all the action in the JCM system. A Controller can be set to listen for changes (generally changes in user input). This is done by registering the Controller with (usally) an InputObject. For example, if a Controller, c, is to respond when the user presses return in a VariableInput, v, then v.setOnUserAction(c) should be called to arrange to have the Controller listen for such actions. VariableSliders, ExpressionInputs, MouseTrackers, Animators have a similar methods. It is also possible to set the Controller to listen for events of type AdjustmentEvent, ActionEvent, TextEvent, or ItemEvent (but this feature is left over from an older version of JCM, and I'm not sure whether it's necessary). Whenever a Controller learns of some change, it will process any InputObjects, Ties, and Computables that have been registered with it.

InputObjects and Computables have to be added to a Controller to be processed, using the Controller's add method. (If you build your inteface out of JCMPanels, then this is done automatically.) (Note that an InputObject is added to a Controller to have its value checked -- This is separate from registering the Controller to listen for changes in the InputObject. Often, you have to do both.) The gatherInputs() method in class JCMPanel can be used to do most of this registration automaticaly.

A Tie that synchronizes two or more Values, to be effective, has to be added to a Controller. See the Tie class for inforamtion about what Ties are and how they are used.

A Controller can have an associated ErrorReporter, which is used to report any errors that occur during the processing. Currently, an ErrorReporter is either a DisplayCanvas or a MessagePopup.

A Controller can be added to another Controller, which then becomes a sub-controller. Whenever the main Controller hears some action, it also notifies all its sub-controllers about the action. Furthermore, it can report errors that occur in the sub-controllers, if they don't have their own error reporters. (Usually, you will just set an error reporter for the top-level Controller.)

Definition at line 65 of file Controller.java.


Public Member Functions

void actionPerformed (ActionEvent evt)
void add (Object obj)
void adjustmentValueChanged (AdjustmentEvent evt)
void checkInput ()
synchronized void compute ()
 Controller ()
void errorCleared ()
void gatherInputs ()
ErrorReporter getErrorReporter ()
void itemStateChanged (ItemEvent evt)
void notifyControllerOnChange (Controller c)
void remove (Object obj)
void removeFromParent ()
void reportError (String message)
void setErrorReporter (ErrorReporter r)
void textValueChanged (TextEvent evt)

Protected Member Functions

void clearErrorMessage ()
void doCompute ()
void doTies ()

Protected Attributes

Vector computables
String errorMessage
ErrorReporter errorReporter
Vector inputs
Controller parent
Vector ties

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index