com.fullspan.pwkeep.gui
Class PwkActionMgr

java.lang.Object
  extended by com.fullspan.pwkeep.gui.PwkActionMgr
All Implemented Interfaces:
IPwkActionDispatcher

public class PwkActionMgr
extends java.lang.Object
implements IPwkActionDispatcher

This class contains a list of the actions that can be performed in the user interface. It uses reflection to locate the appropriate handler method for each action. When an action is performed by the user, the dispatchAction method looks up the handler method and invokes it.

Actions handler methods are looked up based on a naming convention that is described in the IPwkActionHandler interface. For an example of an action handler, see the class PwkGui.PwkActionHandler.

Version:
$Revision: 1.4 $, $Date: 2004/01/18 08:09:06 $
Author:
Mitch Stuart, $Author: mitch $
See Also:
IPwkActionHandler, PwkAction

Field Summary
protected static PwkAction[] ACTIONS
           
 
Constructor Summary
PwkActionMgr(IPwkActionHandler actionHandler)
          Creates a new action manager that will invoke the specified action handler each time an action is performed.
 
Method Summary
 void dispatchAction(PwkAction action, java.awt.event.ActionEvent actionEvent)
          Dispatches the given action by invoking the action handler method for the given action.
 void enableActions(int selectionMask)
          Enables or disables each action associated with this action manager based on the selection mask.
 PwkAction getAction(java.lang.String actionName)
          Returns the action for the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTIONS

protected static final PwkAction[] ACTIONS
Constructor Detail

PwkActionMgr

public PwkActionMgr(IPwkActionHandler actionHandler)
             throws java.lang.NoSuchMethodException
Creates a new action manager that will invoke the specified action handler each time an action is performed.

The action handler must conform to the interface and the action handler method naming conventions described by the IPwkActionHandler interface.

Parameters:
actionHandler - the action handler
Throws:
java.lang.NoSuchMethodException - if the action handler does not have a method for each action in the list of actions associated with this action manager
See Also:
IPwkActionHandler, ACTIONS
Method Detail

getAction

public PwkAction getAction(java.lang.String actionName)
Returns the action for the given name.

Parameters:
actionName - the action name
Returns:
the action for the given name

dispatchAction

public void dispatchAction(PwkAction action,
                           java.awt.event.ActionEvent actionEvent)
Dispatches the given action by invoking the action handler method for the given action.

If an exception occurs when invoking the handler method, calls the handleException method

Specified by:
dispatchAction in interface IPwkActionDispatcher
Parameters:
action - the action
actionEvent - the action event
See Also:
IPwkActionDispatcher.dispatchAction(PwkAction, ActionEvent), PwkAction.actionPerformed(ActionEvent)

enableActions

public void enableActions(int selectionMask)
Enables or disables each action associated with this action manager based on the selection mask.

Parameters:
selectionMask - the selection mask that describes the current selection in the user interface
See Also:
PwkAction.PwkAction(String, int)