Top Description Fields Constructors Methods
org.controlsfx.control.action

public Class AnnotatedAction

extends Action
Class Inheritance
Known Direct Subclasses
org.controlsfx.control.action.AnnotatedCheckAction
Imports
java.lang.ref.WeakReference, java.lang.reflect.Method, java.util.Objects, javafx.event.ActionEvent

An action that invokes a method that has been annotated with 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.

Field Summary

Modifier and TypeField and Description
private final Method
private final WeakReference<Object>

Constructor Summary

AccessConstructor and Description
public
AnnotatedAction(String text, Method method, Object target)

Instantiates an action that will call the specified method on the specified target.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

The target object, or null if the target object has been garbage-collected.
getTarget
()

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
toString()

Overrides java.lang.Object.toString.

Overridden to return the text of this action.

Inherited from org.controlsfx.control.action.Action:
acceleratorPropertydisabledPropertygetAcceleratorgetEventHandlergetGraphicgetLongTextgetPropertiesgetStylegetStyleClassgetTextgraphicPropertyhandleisDisabledisSelectedlocklongTextPropertyselectedPropertysetAcceleratorsetDisabledsetEventHandlersetGraphicsetLongTextsetSelectedsetStylesetTextstylePropertytextProperty

Field Detail

methodback to summary
private final Method method
targetback to summary
private final WeakReference<Object> target

Constructor Detail

AnnotatedActionback to summary
public AnnotatedAction(String text, Method method, Object target)

Instantiates an action that will call the specified method on the specified target.

Method Detail

getTargetback to summary
public Object getTarget()

Returns the target object (the object on which the annotated method will be called).

Returns:Object

The target object, or null if the target object has been garbage-collected.

handleActionback 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().

handleActionExceptionback 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.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Overridden to return the text of this action.

Annotations
@Override