ActionProxy. These actions are created via
ActionMap#register(java.lang.Object) , which delegates the actual instantiation to an AnnotatedActionFactory.
Note that this class maintains a WeakReference to the supplied target object, so the existence of an
AnnotatedAction instance will not prevent the target from being garbage-collected.
| Modifier and Type | Field and Description |
|---|---|
| private final Method | |
| private final WeakReference |
| Access | Constructor and Description |
|---|---|
| public | AnnotatedAction(String text, Method method, Object target)
Instantiates an action that will call the specified method on the specified target. |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: The target object, or null if the target object has been garbage-collected.Returns the target object (the object on which the annotated method will be called). |
| protected void | handleAction(ActionEvent ae)
Handle the action-event by invoking the annotated method on the target object. |
| protected void | handleActionException(ActionEvent ae, Throwable ex)
Called if the annotated method throws an exception when invoked. |
| public String |
| method | back to summary |
|---|---|
| private final Method method | |
| target | back to summary |
|---|---|
| private final WeakReference<Object> target | |
| AnnotatedAction | back to summary |
|---|---|
| public AnnotatedAction(String text, Method method, Object target) Instantiates an action that will call the specified method on the specified target. | |
| getTarget | back to summary |
|---|---|
| public Object getTarget() Returns the target object (the object on which the annotated method will be called).
| |
| handleAction | back to summary |
|---|---|
| protected void handleAction(ActionEvent ae) Handle the action-event by invoking the annotated method on the target object. If an exception is thrown, then the default implementation of this method will call handleActionException(). | |
| handleActionException | back to summary |
|---|---|
| protected void handleActionException(ActionEvent ae, Throwable ex) Called if the annotated method throws an exception when invoked. The default implementation of this method simply prints the stack trace of the specified exception. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Overridden to return the text of this action.
| |