edu.cmu.hcii.calo.view.task.TaskPropertyActionListener Class Reference

Collaboration diagram for edu.cmu.hcii.calo.view.task.TaskPropertyActionListener:

Collaboration graph
[legend]
List of all members.

Detailed Description

An ActionListener subclass that will construct TaskStates for some property of the old and new states of a task and fire a TaskState property change on behalf of its view.

When you construct a TaskPropertyActionListener, you pass the view, task, and property that it will use to fire property change events. When the listener detects an action from the component to which it is listening, it will call getOldValue() and getNewValue() to determine what values to put in the TaskStates. Then it will call CALOComponent.firePropertyChange(String, Object, Object) in the view to automatically fire the property change on its behalf.

For example, imagine that there is a toggle button that determines whether or not the task represented by the check box's enclosing view is complete. We could attach a TaskPropertyActionListener to the button, passing it the check box's enclosing view as the view, the task represented by that view as the task, and TaskStateProperty.COMPLETE as the property. When the button is clicked, the TaskPropertyActionListener would call getOldValue() (which we would implement to return the current completed state of the task), then getNewValue() (which we would implement to return the opposite of that state), and then would fire a property change event on behalf of the view with a name of TaskViewPropertyNames.TASK_STATE_PROPERTY_NAME whose old and new values are TaskState instances created from our task and the values we returned from getOldValue() and getNewValue() respectively. This would propagate up the hierarchy of CALOComponents to the controller, which would handle the state change.

Author:
Brian Ellis


Public Member Functions

 TaskPropertyActionListener (CALOComponent view, Task t, TaskState.TaskStateProperty property)
 Constructs a TaskPropertyActionListener with the given view, task, and property.
void actionPerformed (ActionEvent e)
 Fired when the component to which this listener is attached fires an action event.
abstract Object getNewValue ()
 Should be implemented by instances to return the value our property had before the action fired.
abstract Object getOldValue ()
 Should be implemented by instances to return the value our property should have now that the action has fired.

Properties

 TaskStateProperty
 The property of the task that should be marked as changed when the action fires.

Private Attributes

CALOComponent view
 The view on behalf of which we will send property change events.
Task task
 The task represented by the view we are listening to.


Constructor & Destructor Documentation

edu.cmu.hcii.calo.view.task.TaskPropertyActionListener.TaskPropertyActionListener ( CALOComponent  view,
Task  t,
TaskState.TaskStateProperty  property 
)

Constructs a TaskPropertyActionListener with the given view, task, and property.

Parameters:
view the view on behalf of which we will fire a property change event
t the task we will mark as having changed
property the property of the task we will mark as having changed


Member Function Documentation

void edu.cmu.hcii.calo.view.task.TaskPropertyActionListener.actionPerformed ( ActionEvent  e  ) 

Fired when the component to which this listener is attached fires an action event.

Invokes getOldValue() and getNewValue() to get the old and new values of our property, then fires a property change event on behalf of our view with a property name of TaskViewPropertyNames.TASK_STATE_PROPERTY_NAME. The old and new values of the property change event are new TaskState instances whose task is our task, whose property is our property, and whose old and new states are what was returned from getOldValue() and getNewValue().

Parameters:
e the action event

abstract Object edu.cmu.hcii.calo.view.task.TaskPropertyActionListener.getNewValue (  )  [pure virtual]

Should be implemented by instances to return the value our property had before the action fired.

Returns:
the old value

abstract Object edu.cmu.hcii.calo.view.task.TaskPropertyActionListener.getOldValue (  )  [pure virtual]

Should be implemented by instances to return the value our property should have now that the action has fired.

Returns:
the new value


Member Data Documentation

CALOComponent edu.cmu.hcii.calo.view.task.TaskPropertyActionListener.view [private]

The view on behalf of which we will send property change events.

Task edu.cmu.hcii.calo.view.task.TaskPropertyActionListener.task [private]

The task represented by the view we are listening to.


Property Documentation

edu.cmu.hcii.calo.view.task.TaskPropertyActionListener.TaskStateProperty [private]

The property of the task that should be marked as changed when the action fires.


The documentation for this class was generated from the following file:
Generated on Mon Aug 13 15:06:27 2007 for CALO by  doxygen 1.5.2