Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.ip2
Class ItemHandler

    java.lang.Object
      ix.ip2.ItemHandler

Direct Known Subclasses:
  ActivityHandler, ForwardingHandler, IssueHandler, SimpleCompletionHandler

    public abstract class ItemHandler

extends java.lang.Object

Generates HandlerActions for an AgendaItem.

N.B. For Handlers that can handle both issues and activities, extend this class rather than IssueHandler or ActivityHandler.

Field Summary
`protected java.lang.String` | `actionDescription` A short description of the action(s) implemented by this handler.

Constructor Summary
`ItemHandler(java.lang.String actionDescription)` Constructs a handler with the given description.

Method Summary
`void` | `addHandlerActions(AgendaItem item)` Called to add any `HandlerAction`s that this handler regards as appropriate for the specified AgendaItem.
`boolean` | `appliesTo(AgendaItem item)` Gives this handler a say in whether it should add actions to an item.
`java.lang.String` | `getActionDescription()` Returns a short description of the action(s) implemented by this handler.
`java.util.List` | `getSyntaxList()` Returns a list of patterns representing the item pattern syntaxes this handler can process, or null if no particular syntax is required.
`void` | `handle(AgendaItem item)` Called to perform the action implemented by this handler, if the selected HandlerAction so desires.
`boolean` | `isAutomatic()` Indicates whether this handler has the authority to handle items automatically rather than only when explicitly invoked.
`static ItemHandler` | `makeHandler(Ip2 ip2, java.lang.String className)` Constructs an instance of the class with the specified name.
`void` | `reviseHandlerActions(AgendaItem item, java.lang.Object reason)` Called after something has happened that may require new HandlerActions to be added to an item.
`java.lang.String` | `toString()` Returns a textual representation of this handler.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### actionDescription

    protected java.lang.String actionDescription

  A short description of the action(s) implemented by this handler.

Constructor Detail

### ItemHandler

    public ItemHandler(java.lang.String actionDescription)

  Constructs a handler with the given description.

  See Also:
    `getActionDescription()`

Method Detail

### getActionDescription

    public java.lang.String getActionDescription()

  Returns a short description of the action(s) implemented by this handler.

### getSyntaxList

    public java.util.List getSyntaxList()

  Returns a list of patterns representing the item pattern syntaxes this handler can process, or null if no particular syntax is required. Note that this information is not automatically used when determining whether this handler should add actions to an agenda item. Instead, this handler's contribution to that decision is supplied by the `appliesTo(AgendaItem)` method.

  See Also:
    `AgendaItem.getPattern()`

### appliesTo

    public boolean appliesTo(AgendaItem item)

  Gives this handler a say in whether it should add actions to an item. If this method returns false for an AgendaItem, or the item's wantsActionsFrom method returns false for this handler, this handler will not be asked to add actions to that item.

  See Also:
    `AgendaItem.wantsActionsFrom(ItemHandler handler)`

### isAutomatic

    public boolean isAutomatic()

  Indicates whether this handler has the authority to handle items automatically rather than only when explicitly invoked.

### addHandlerActions

    public void addHandlerActions(AgendaItem item)

  Called to add any `HandlerAction`s that this handler regards as appropriate for the specified AgendaItem.

  This method is called only if both this handler's `appliesTo(AgendaItem)` and the specified item's `AgendaItem.wantsActionsFrom(ItemHandler)` methods return true.

  The method provided by the ItemHandler class just adds an action that calls this handler's `handle(AgendaItem)` method. This allows suitably simple handlers to avoid working directly with HandlerActions.

  Note that actions are added by calling an item's `AgendaItem.addAction(HandlerAction)` method.

### reviseHandlerActions

    public void reviseHandlerActions(AgendaItem item,
                                     java.lang.Object reason)

  Called after something has happened that may require new HandlerActions to be added to an item. Typically, this method is called as a consequnce of an ItemHandler -- usually this ItemHandler -- calling the controller's reconsiderHandler method. In other words, the usual case is when an ItemHandler causes its own reviseHandlerActions method to be called; and consequencetly the handler may be able to agree with itself (so to speak) about what various "reason" objects mean.

  The reviseHandlerActions method is very similar to the `addHandlerActions(AgendaItem)` method in terms of its function and the applicability conditions on when it is called. The main difference is that it is called to look at AgendaItems that are not having actions added for the first time and that may already have an appropriate action, so that no new one needs to be added.

  Note that the usual way for an ItemHandler to get HandlerActions removed is for it to call the controller's checkActionValidity method. That results in calls to `HandlerAction.isStillValid()` methods.

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

### handle

    public void handle(AgendaItem item)

  Called to perform the action implemented by this handler, if the selected HandlerAction so desires.

  See Also:
    `addHandlerActions(AgendaItem)`

### toString

    public java.lang.String toString()

  Returns a textual representation of this handler.

  Overrides:
    `toString` in class `java.lang.Object`

### makeHandler

    public static ItemHandler makeHandler(Ip2 ip2,
                                          java.lang.String className)

  Constructs an instance of the class with the specified name. The class must exist and be loadable, must be a subclass of ItemHandler, and must have either a zero-argument constructor (which is tried first) or a one-argument constructor with the argument declared to be of class Ip2.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD