ix.ip2
Class HandlerAction

java.lang.Object
  extended by ix.ip2.HandlerAction
Direct Known Subclasses:
CompletionHandler.DoneAction, ConditionHandler.SatisfyAction, ExpandHandler.ExpandAction, ForwardingHandler.ForwardingAction, HandlerAction.Automatic, HandlerAction.Manual, HandlerAction.NoAction, IPlanConditionHandler.SatisfyAction, LoadDomainHandler.AbstractLoadDomainAction, LoadPlanHandler.LoadPlanAction, MatchChoiceHandler.MatchChoiceAction, MatchStateHandler.MatchStateAction, QueryHandler.AnswerHandler.AnswerAction, QueryHandler.QueryAction

public class HandlerAction
extends java.lang.Object

One of the ways in which an agenda item might be handled. HandlerActions are added to AgendaItems by ItemHandlers.


Nested Class Summary
static class HandlerAction.Automatic
          Handles an item by invoking an item-handler's handle method.
static class HandlerAction.AutomaticWhenBound
          Handles an item by invoking an item-handler's handle method, but does not become ready until all of the variables in its AgendaItem's pattern are bound.
static class HandlerAction.Manual
          Indicates that the item has been handled by the user.
static class HandlerAction.NoAction
          Handles an item by doing nothing.
static class HandlerAction.NotApplicable
          Used to indicate the the item does not apply in the current situation.
 
Field Summary
protected  java.lang.String shortDescription
          Briefly describes what this action does.
 
Constructor Summary
HandlerAction()
          Constructor used by subclasses.
 
Method Summary
 boolean canAlwaysBeTakenNow()
          Indicates whether this action can be taken now regardless of the current status of the AgendaItem.
 void computeStatus()
          Called when something has happened that might have changed this action's ready status.
 java.lang.String getActionDescription()
          Returns a brief description of how this action would handle an item.
 ActionUnreadyReason getUnreadyReason()
          Returns an object that explains why this handler is not ready to be used.
 void handle(AgendaItem item)
          Handle the item in the manner appropriate to this handler-action.
 boolean isReady()
          Indicates whether this action is ready to be used or else is waiting for something that would enable it to be used.
 boolean isStillValid()
          Called when something has happened that might mean this action no longer makes sense and should be deleted.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

shortDescription

protected java.lang.String shortDescription
Briefly describes what this action does.

Constructor Detail

HandlerAction

public HandlerAction()
Constructor used by subclasses.

Method Detail

getActionDescription

public java.lang.String getActionDescription()
Returns a brief description of how this action would handle an item.


handle

public void handle(AgendaItem item)
Handle the item in the manner appropriate to this handler-action. The method in the HandlerAction class merely changes the item's status to COMPLETE and is overridden in subclasses that handle the item in more interesting ways.


canAlwaysBeTakenNow

public boolean canAlwaysBeTakenNow()
Indicates whether this action can be taken now regardless of the current status of the AgendaItem. It is called by the item's AgendaItem.actionCanBeTakenNow(HandlerAction) method and, if it returns true, overrides the value that would be returned by that method.

The method defined in the HandlerAction class returns false.


isStillValid

public boolean isStillValid()
Called when something has happened that might mean this action no longer makes sense and should be deleted. The method in the HandlerAction class just returns true and is overridden in subclasses that have instances that may cease to be valid.

Typically, this method is called as a consequence of an ItemHandler calling the controllers's checkActionValidity method.

See Also:
PanelController.checkActionValidity(ItemHandler handler, Object reason)

isReady

public boolean isReady()
Indicates whether this action is ready to be used or else is waiting for something that would enable it to be used. The method in the HandlerAction class just returns true and is overridden in subclasses that have instances that are not always ready.

See Also:
getUnreadyReason()

computeStatus

public void computeStatus()
Called when something has happened that might have changed this action's ready status. The method in the HandlerAction class does nothing and is overridden in subclasses that have instances that are not always ready.


getUnreadyReason

public ActionUnreadyReason getUnreadyReason()
Returns an object that explains why this handler is not ready to be used.

See Also:
isReady()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object