|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uic.model.UICSimpleAction
This class represent the glue between a user event and a piece of controlling logic.
Events based programming creates the need to execute certain pieces of logic based
on the incoming event, conveniently grouped per action. An action can be something
like 'print'.
Notice that the default version uses the SimpleQueuedPolicy
.
Nested Class Summary | |
static class |
UICSimpleAction.DirectPolicy
This policy will execute the action in the calling thread. |
static interface |
UICSimpleAction.ExecutePolicy
Each action that is called 'execute()' on will be executed according to policy. |
static class |
UICSimpleAction.OnlyLastPolicy
This policy will enqueue the action; but will remove others that would call the same target method. |
static class |
UICSimpleAction.QueuedPolicy
This policy will queue each action to be executed serially, while disabling the action when running. |
static class |
UICSimpleAction.SimpleQueuedPolicy
This policy will queue each action to be executed serially. |
Field Summary | |
protected UICSimpleAction.ExecutePolicy |
currentPolicy
|
protected Method |
target
|
protected Object |
targetObject
|
Constructor Summary | |
UICSimpleAction()
Empty constructor; don't forget to do a setTarget later!. |
|
UICSimpleAction(Object targetObject,
String targetMethod)
Constructor with automatic setTarget. |
Method Summary | |
protected void |
doAction(Object source)
Called to actually execute the action on the registered method. |
void |
execute()
Convenience method. |
void |
execute(Object source)
Execute the action. |
void |
setDirect(boolean direct)
UIActions queue their work so actions will have to wait for all others to be finished; unless direct is true. |
void |
setEnabled(boolean enabled)
Enable disable this action and all its registered components. |
void |
setExecutionPolity(UICSimpleAction.ExecutePolicy policy)
Set a new policy for this action. |
void |
setTarget(Object object,
String targetMethod)
The target method that is to be called when the action is fired. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Object targetObject
protected Method target
protected UICSimpleAction.ExecutePolicy currentPolicy
Constructor Detail |
public UICSimpleAction()
public UICSimpleAction(Object targetObject, String targetMethod)
setTarget(java.lang.Object, java.lang.String)
Method Detail |
public void setTarget(Object object, String targetMethod) throws IllegalArgumentException
object
- The object that contains the method we want to connect to.targetMethod
- the name of the method we want to connect to.
IllegalArgumentException
public void setEnabled(boolean enabled)
enabled
- the new state of the action.protected void doAction(Object source)
public void execute()
public void execute(Object source)
source
- an optional source object; this object will be passed as an argument to
the target method.public void setDirect(boolean direct)
direct
- if true the action will be executed directly, inside the calling thread.public void setExecutionPolity(UICSimpleAction.ExecutePolicy policy)
policy
- the new policy
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |