org.scopemvc.core
Class Control

java.lang.Object
  |
  +--org.scopemvc.core.Control

public class Control
extends java.lang.Object

A token passed up the chain of Controllers to invoke a piece of presentation logic. Controllers match against the ID of a Control passed into handleControl If the ID is recognised then the Controller can execute some presentation logic. If the Control ID is not recognised, the Control should be sent back on its journey up the chain of responsibility by passing it to the parent Controller. See Controller.handleControl() and BasicController.passControlToParent().

Controls are received by a Controller from either a View or a child Controller.

Controls can optionally contain an Object parameter: see getParameter()

The Control ID is used by Controllers to recognise a Control and also as a key to the user-readable version of the the Control's name in UIStrings presented to the user by the default error-handling mechanism in BasicController.

Version:
$Revision: 1.8 $ $Date: 2002/09/11 19:12:29 $
Author:
Steve Meyfroidt
See Also:
View, Controller

Constructor Summary
Control(java.lang.String inID)
          Create a Control with a unique String ID and no parameter.
Control(java.lang.String inID, java.lang.Object inParameter)
          Create a Control with a unique String ID and a parameter.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tests for equality
 java.lang.String getName()
          Deprecated. use matchesID(java.lang.String) not this method which will be removed at some point.
 java.lang.Object getParameter()
          Get the parameter for the Control
 int hashCode()
          Returns the hashCode
 boolean isMatched()
          Has this Control been matched by a Controller yet?
 void markMatched()
          Mark the Control as matched.
 void markUnmatched()
          Mark the Control as unmatched.
 boolean matchesID(java.lang.String inID)
          Tests if this Control matches the given ID.
 void populateControlException(ControlException inException)
          For use by a ControlException handler only, not for application writers.
 void setParameter(java.lang.Object inParameter)
          Set a parameter for the Control
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Control

public Control(java.lang.String inID)
Create a Control with a unique String ID and no parameter.

Parameters:
inID - The unique ID identifying the Control

Control

public Control(java.lang.String inID,
               java.lang.Object inParameter)
Create a Control with a unique String ID and a parameter.

Parameters:
inID - The unique ID identifying the Control
inParameter - A parameter for the Control
Method Detail

getName

public final java.lang.String getName()
Deprecated. use matchesID(java.lang.String) not this method which will be removed at some point.

For matching a Control in a Controller's doHandleControl, always use matchesID(java.lang.String) not this method.

Returns:
The name value

isMatched

public final boolean isMatched()
Has this Control been matched by a Controller yet?

Returns:
The matched value

getParameter

public final java.lang.Object getParameter()
Get the parameter for the Control

Returns:
The parameter value

setParameter

public final void setParameter(java.lang.Object inParameter)
Set a parameter for the Control

Parameters:
inParameter - The new parameter value

markUnmatched

public final void markUnmatched()
Mark the Control as unmatched.


markMatched

public final void markMatched()
Mark the Control as matched.
Matched controls won't be handled to the parent controller.


matchesID

public final boolean matchesID(java.lang.String inID)
Tests if this Control matches the given ID.
Use this method in Controller's doHandleControl to discover Controls that you want to handle.

Parameters:
inID - The ID to test against
Returns:
true if this control ID matches the passed ID.

populateControlException

public void populateControlException(ControlException inException)
For use by a ControlException handler only, not for application writers.

Parameters:
inException - exception to populate with info from this Control.

equals

public boolean equals(java.lang.Object obj)
Tests for equality

Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns the hashCode

Overrides:
hashCode in class java.lang.Object
Returns:
the hashCode

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.


Copyright © 2000-2002 The Scope Team. All Rights Reserved.