com.swfm.mica.core
Class MiActionCallback

java.lang.Object
  extended bycom.swfm.mica.core.MiAction
      extended bycom.swfm.mica.core.MiActionCallback
All Implemented Interfaces:
MiiAction, MiiActionHandler, MiiActionNames, MiiActionTypes

public class MiActionCallback
extends MiAction
implements MiiActionHandler, MiiActionTypes

This class is a MiAction that is devoted to supporting the assignment of callbacks to MiParts (see MiPart#appendCommandHandler). It can, of course, be used any time it is desired that an action should trigger a callback (i.e. a call to the processCommand method of a MiiCommandHandler object).

Version:
%I% %G%
Author:
Michael L. Davis

Field Summary
     
Constructor Summary
MiActionCallback(MiiCommandHandler commandHandler, java.lang.String command)
          Constructs a new MiActionCallback, that when assigned to a MiPart, will call the given command handler with the given command whenever the MiPart dispatches a Mi_ACTIVATED_ACTION.
MiActionCallback(MiiCommandHandler commandHandler, java.lang.String command, int actionType)
          Constructs a new MiActionCallback, that when assigned to a MiPart, will call the given command handler with the given command whenever the MiPart dispatches the given action type.
MiActionCallback(MiiCommandHandler commandHandler, java.lang.String command, int actionType, boolean returnCode)
          Constructs a new MiActionCallback, that when assigned to a MiPart, will call the given command handler with the given command whenever the MiPart dispatches the given action type.
 
Method Summary
 java.lang.String getCommand()
          Gets the command of the command handler to call.
 MiiCommandHandler getCommandHandler()
          Gets the command handler to call.
 boolean getReturnCode()
          Gets the code to return after the command handler has been called.
 boolean processAction(MiiAction action)
          Processes the given action (probably _this_ MiAction).
 void setReturnCode(boolean flag)
          Sets the code to return after the command handler has been called.
 java.lang.String toString()
          Returns information about this class.
 
Methods inherited from class com.swfm.mica.core.MiAction
addValidActions, addValidActionsRequestedFromPartsOfObserved, getActionHandler, getActionSource, getActionSpec, getActionString, getActionSystemInfo, getActionType, getActionUserInfo, getNumberOfResources, getObservedObject, getPhase, getResource, getResourceName, getValidActionsString, hasActionType, isInterestedInActionsOfPartsOfObserved, isPhase, isValidActionType, isVetoed, removeResource, setActionHandler, setActionSource, setActionSystemInfo, setActionType, setActionUserInfo, setObservedObject, setResource, setVetoed, typeFromString, veto
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MiActionCallback

public MiActionCallback(MiiCommandHandler commandHandler,
                        java.lang.String command)
Constructs a new MiActionCallback, that when assigned to a MiPart, will call the given command handler with the given command whenever the MiPart dispatches a Mi_ACTIVATED_ACTION.

Parameters:
commandHandler - the command handler to call
command - the paramter to pass to the command handler

MiActionCallback

public MiActionCallback(MiiCommandHandler commandHandler,
                        java.lang.String command,
                        int actionType)
Constructs a new MiActionCallback, that when assigned to a MiPart, will call the given command handler with the given command whenever the MiPart dispatches the given action type.

Parameters:
commandHandler - the command handler to call
command - the paramter to pass to the command handler
actionType - the actionType that triggers the call

MiActionCallback

public MiActionCallback(MiiCommandHandler commandHandler,
                        java.lang.String command,
                        int actionType,
                        boolean returnCode)
Constructs a new MiActionCallback, that when assigned to a MiPart, will call the given command handler with the given command whenever the MiPart dispatches the given action type.

Parameters:
commandHandler - the command handler to call
command - the paramter to pass to the command handler
actionType - the actionType that triggers the call
returnCode - the return code
Method Detail

getCommandHandler

public MiiCommandHandler getCommandHandler()
Gets the command handler to call.

Returns:
the command handler to call

getCommand

public java.lang.String getCommand()
Gets the command of the command handler to call.

Returns:
the command of the command handler

setReturnCode

public void setReturnCode(boolean flag)
Sets the code to return after the command handler has been called. This is most useful, for example, when the trigger action is in the EXECUTE_PHASE and the command handler is to be totally responsable for executing the action (i.e. Mi_WINDOW_DESTROY_ACTION).

Parameters:
flag - the return code

getReturnCode

public boolean getReturnCode()
Gets the code to return after the command handler has been called.

Returns:
the return code

processAction

public boolean processAction(MiiAction action)
Processes the given action (probably _this_ MiAction). Default behavior is to call the previously registered command handler.

Specified by:
processAction in interface MiiActionHandler
Overrides:
processAction in class MiAction
Parameters:
action - the action to process
Returns:
the previously registered return code. true if it is OK to send action to the next action handler false if it is NOT OK to send action to the next action handler
See Also:
setReturnCode(boolean)

toString

public java.lang.String toString()
Returns information about this class.

Overrides:
toString in class MiAction
Returns:
textual information (class name + action type + command handler + command)
See Also:
MiAction.getActionString(int)