|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.swfm.mica.core.MiAction
An action has a number of valid action types and an action handler. When assigned to a MiPart (see MiPart#appendActionHandler) this action waits for one of it's valid action types to be dispatched to the MiPart. When one of these valid action types occurs, the MiPart calls this action's action handler with this action as the parameter. Action types consist of two parts. The top 4 bits are reserved for the action's phases bits. The bottom 28 bits are reserved for the action's action type, which is not a mask. This approach allows a single action type and any combination of the 4 action phases to be encoded into a sinlge integer (int). For example: MiiAction dragAndDropActionEvent = new MiAction(this, Mi_DATA_IMPORT_ACTION | Mi_REQUEST_ACTION_PHASE | Mi_EXECUTE_ACTION_PHASE); This action, when assigned to a MiPart, will have it's action handler called whenever a Mi_DATA_IMPORT_ACTION action in a Mi_REQUEST_ACTION_PHASE or a Mi_EXECUTE_ACTION_PHASE is generated.
MiActionManager| Field Summary |
| Constructor Summary | |
MiAction(MiiActionHandler handler,
int validActionType)
Constructs a new MiAction which will dispatch itself to the given action handler whenever the given action type occurs in any MiPart this action is assigned to. |
|
MiAction(MiiActionHandler handler,
int[] validActionTypes,
java.lang.Object userInfo)
Constructs a new MiAction which will dispatch itself to the given action handler whenever the given action types occur in any MiPart this action is assigned to. |
|
MiAction(MiiActionHandler handler,
int validActionType1,
int validActionType2)
Constructs a new MiAction which will dispatch itself to the given action handler whenever the given action types occur in any MiPart this action is assigned to. |
|
MiAction(MiiActionHandler handler,
int validActionType1,
int validActionType2,
int validActionType3)
Constructs a new MiAction which will dispatch itself to the given action handler whenever the given action types occur in any MiPart this action is assigned to. |
|
MiAction(MiiActionHandler handler,
int validActionType1,
int validActionType2,
int validActionType3,
java.lang.Object userInfo)
Constructs a new MiAction which will dispatch itself to the given action handler whenever the given action types occur in any MiPart this action is assigned to. |
|
MiAction(MiiActionHandler handler,
int validActionType1,
int validActionType2,
java.lang.Object userInfo)
Constructs a new MiAction which will dispatch itself to the given action handler whenever the given action types occur in any MiPart this action is assigned to. |
|
MiAction(MiiActionHandler handler,
int validActionType,
java.lang.Object userInfo)
Constructs a new MiAction which will dispatch itself to the given action handler whenever the given action type occurs in any MiPart this action is assigned to. |
|
| Method Summary | |
void |
addValidActions(MiiAction actions)
Adds the valid action types of the given action to the valid action types of this action. |
void |
addValidActionsRequestedFromPartsOfObserved(MiiAction actions)
Adds the valid action types of the given action to the valid action types of this action if they are requested from the parts of the observed MiPart. |
MiiActionHandler |
getActionHandler()
Gets the action handler this action will be dispatched to. |
MiPart |
getActionSource()
Gets the MiPart that originally generated the action. |
static java.lang.String |
getActionSpec(int actionType)
Gets the textual description of the given action type suitable for parsing later into the given type. |
static java.lang.String |
getActionString(int actionType)
Gets the textual description of the given action type. |
java.lang.Object |
getActionSystemInfo()
Gets the system information field of this action. |
int |
getActionType()
Gets the actual type of this dispatched action. |
java.lang.Object |
getActionUserInfo()
Gets the user information field of this action. |
int |
getNumberOfResources()
Gets the number of resources assigned to this MiPart. |
MiPart |
getObservedObject()
Gets the MiPart that dispatched the action to the MiiActionHandler. |
int |
getPhase()
Gets the phase of this dispatched action. |
java.lang.Object |
getResource(java.lang.String name)
Gets the value of the given named resource. |
java.lang.String |
getResourceName(int index)
Gets the name of the ith resource assigned to this MiPart. |
java.lang.String |
getValidActionsString()
For debug, gets a text string describing the action types that this action is watching for/handling. |
boolean |
hasActionType(int actionType)
Gets whether the actual type of this dispatched action is the same as the given type. |
boolean |
isInterestedInActionsOfPartsOfObserved()
Gets whether this action is interested in actions of the parts of the MiPart this action is assigned to. |
boolean |
isPhase(int phase)
Gets whether the given phase is the phase of this dispatched action. |
boolean |
isValidActionType(int actionType)
Gets whether given action type is an action type for which this action will be dispatched to it's action handler. |
boolean |
isVetoed()
Gets whether this action, in the request phase, is saying no to the request. |
boolean |
processAction(MiiAction action)
Processes the given action (probably _this_ MiAction) Default behavior is to call this MiAction's registered action handler. |
void |
removeResource(java.lang.String name)
Removes the named resource. |
void |
setActionHandler(MiiActionHandler handler)
Sets the action handler this action will be dispatched to. |
void |
setActionSource(MiPart source)
Sets the MiPart that originally generated the action. |
void |
setActionSystemInfo(java.lang.Object info)
Sets the system information field of this action. |
void |
setActionType(int actionType)
Sets the actual type of this dispatched action. |
void |
setActionUserInfo(java.lang.Object info)
Sets the user information field of this action. |
void |
setObservedObject(MiPart observed)
Sets the MiPart that dispatched the action to the MiiActionHandler. |
void |
setResource(java.lang.String name,
java.lang.Object value)
Adds (if necessary) and sets the given named resource to the given value. |
void |
setVetoed(boolean flag)
Sets whether this action, in the request phase, is saying no to the request. |
java.lang.String |
toString()
Gets the textual description of action type of this action. |
static int |
typeFromString(java.lang.String spec)
Gets the action corresponding to the given textual description. |
void |
veto()
Specifies that this action, in the request phase, is saying no to the request. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public MiAction(MiiActionHandler handler,
int validActionType)
handler - the action handler for this actionvalidActionType - the action type for this action
public MiAction(MiiActionHandler handler,
int validActionType,
java.lang.Object userInfo)
handler - the action handler for this actionvalidActionType - the action type for this actionuserInfo - the user information for this action
public MiAction(MiiActionHandler handler,
int validActionType1,
int validActionType2)
handler - the action handler for this actionvalidActionType1 - an action type for this actionvalidActionType2 - an action type for this action
public MiAction(MiiActionHandler handler,
int validActionType1,
int validActionType2,
java.lang.Object userInfo)
handler - the action handler for this actionvalidActionType1 - an action type for this actionvalidActionType2 - an action type for this actionuserInfo - the user information for this action
public MiAction(MiiActionHandler handler,
int validActionType1,
int validActionType2,
int validActionType3)
handler - the action handler for this actionvalidActionType1 - an action type for this actionvalidActionType2 - an action type for this actionvalidActionType3 - an action type for this action
public MiAction(MiiActionHandler handler,
int validActionType1,
int validActionType2,
int validActionType3,
java.lang.Object userInfo)
handler - the action handler for this actionvalidActionType1 - an action type for this actionvalidActionType2 - an action type for this actionvalidActionType3 - an action type for this actionuserInfo - the user information for this action
public MiAction(MiiActionHandler handler,
int[] validActionTypes,
java.lang.Object userInfo)
handler - the action handler for this actionvalidActionTypes - the action types for this actionuserInfo - the user information for this action| Method Detail |
public void addValidActionsRequestedFromPartsOfObserved(MiiAction actions)
actions - the action whose valid action types
to add to the valid action types of
this actionpublic void addValidActions(MiiAction actions)
actions - the action whose valid action types
to add to the valid action types of
this actionpublic boolean processAction(MiiAction action)
action - the action to process
public void setActionSource(MiPart source)
setActionSource in interface MiiActionsource - the part that generated the actionpublic MiPart getActionSource()
getActionSource in interface MiiActionpublic void setObservedObject(MiPart observed)
setObservedObject in interface MiiActionobserved - the part that dispatched the actionpublic MiPart getObservedObject()
getObservedObject in interface MiiActionpublic boolean isInterestedInActionsOfPartsOfObserved()
isInterestedInActionsOfPartsOfObserved in interface MiiActionpublic void setActionHandler(MiiActionHandler handler)
setActionHandler in interface MiiActionhandler - the action handler to send this
action topublic MiiActionHandler getActionHandler()
getActionHandler in interface MiiActionpublic void setActionType(int actionType)
setActionType in interface MiiActionisValidActionType(int)public int getActionType()
getActionType in interface MiiActionisValidActionType(int)public boolean hasActionType(int actionType)
hasActionType in interface MiiActiongetActionType(),
isValidActionType(int)public void setActionUserInfo(java.lang.Object info)
setActionUserInfo in interface MiiActioninfo - the information supplied by the
programmer.getActionUserInfo()public java.lang.Object getActionUserInfo()
getActionUserInfo in interface MiiActionsetActionUserInfo(java.lang.Object)public void setActionSystemInfo(java.lang.Object info)
setActionSystemInfo in interface MiiActioninfo - the information supplied by the
generator of the action or null.setActionUserInfo(java.lang.Object),
getActionSystemInfo()public java.lang.Object getActionSystemInfo()
getActionSystemInfo in interface MiiActiongetActionUserInfo(),
setActionSystemInfo(java.lang.Object)public boolean isValidActionType(int actionType)
isValidActionType in interface MiiActionisValidActionType(int)public boolean isPhase(int phase)
isPhase in interface MiiActionphase - the possible phase of this action
public int getPhase()
getPhase in interface MiiActionsetResource(java.lang.String, java.lang.Object)public void veto()
veto in interface MiiActionpublic boolean isVetoed()
isVetoed in interface MiiActionpublic void setVetoed(boolean flag)
setVetoed in interface MiiActionflag - true if vetoed
public void setResource(java.lang.String name,
java.lang.Object value)
setResource in interface MiiActionname - the resource namevalue - the resource value (non-null)getResource(java.lang.String)public java.lang.Object getResource(java.lang.String name)
getResource in interface MiiActionname - the resource namesetResource(java.lang.String, java.lang.Object)public void removeResource(java.lang.String name)
name - the name of the resourcesetResource(java.lang.String, java.lang.Object),
getResource(java.lang.String)public int getNumberOfResources()
getResourceName(int)public java.lang.String getResourceName(int index)
index - the index of the resource
java.lang.IllegalArgumentException - If index
is out of range.getNumberOfResources()public static java.lang.String getActionString(int actionType)
actionType - the action to describe
getActionSpec(int),
#getActionPhasesString,
#getActionTypesStringpublic static java.lang.String getActionSpec(int actionType)
actionType - the action to describe
getActionString(int)public java.lang.String toString()
getActionString(int)
public static int typeFromString(java.lang.String spec)
throws java.lang.IllegalArgumentException
spec - the description
java.lang.IllegalArgumentExceptiongetActionString(int)public java.lang.String getValidActionsString()
getValidActionsString in interface MiiAction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||