java.lang.Object
org.controlsfx.control.action.Action
org.controlsfx.control.action.AnnotatedAction
- All Implemented Interfaces:
EventListener
,javafx.event.EventHandler<javafx.event.ActionEvent>
- Direct Known Subclasses:
AnnotatedCheckAction
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.-
Property Summary
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotatedAction
(String text, Method method, Object target) Instantiates an action that will call the specified method on the specified target. -
Method Summary
Modifier and TypeMethodDescriptionReturns the target object (the object on which the annotated method will be called).protected void
handleAction
(javafx.event.ActionEvent ae) Handle the action-event by invoking the annotated method on the target object.protected void
handleActionException
(javafx.event.ActionEvent ae, Throwable ex) Called if the annotated method throws an exception when invoked.toString()
Overridden to return the text of this action.Methods inherited from class org.controlsfx.control.action.Action
acceleratorProperty, disabledProperty, getAccelerator, getEventHandler, getGraphic, getLongText, getProperties, getStyle, getStyleClass, getText, graphicProperty, handle, isDisabled, isSelected, lock, longTextProperty, selectedProperty, setAccelerator, setDisabled, setEventHandler, setGraphic, setLongText, setSelected, setStyle, setText, styleProperty, textProperty
-
Constructor Details
-
AnnotatedAction
Instantiates an action that will call the specified method on the specified target.
-
-
Method Details
-
getTarget
Returns the target object (the object on which the annotated method will be called).- Returns:
- The target object, or null if the target object has been garbage-collected.
-
handleAction
protected void handleAction(javafx.event.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
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
Overridden to return the text of this action.
-