Top Description Methods
org.controlsfx.control.action

public @Interface ActionProxy

extends Annotation
Annotations
@Target:METHOD
@Retention:RUNTIME
Imports
javafx.event.ActionEvent, org.controlsfx.glyphfont.Glyph, java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target

An annotation to allow conversion of class methods to Action instances.

The following steps are required to use ActionProxy annotations:

  1. Annotate your methods with the ActionProxy annotation. For example:
    @ActionProxy(text="Action 1.1", graphic=imagePath, accelerator="ctrl+shift+T")
    private void action11() {
        System.out.println("Action 1.1 is executed");
    }

    The ActionProxy annotation is designed to work with three types of methods:

    1. Methods with no parameters,
    2. Methods with one parameter of type ActionEvent.
    3. Methods that take both an ActionEvent and an Action.

    The ActionProxy annotation graphic() property supports different node types:

    1. Images,
    2. Glyph fonts.

    The ability for ActionProxy to support glyph fonts is part of the ControlsFX Glyph API. For more information on how to specify images and glyph fonts, refer to the ActionProxy#graphic() method.

  2. Register your class in the global ActionMap, preferably in the class constructor:
    ActionMap.register(this); 
    Immediately after that actions will be created according to the provided annotations and are accessible from ActionMap, which provides several convenience methods to access actions by id. Refer to the ActionMap class for more details on how to use it.
  3. ActionCheck annotation is supported on the same method where @ActionProxy is applied}

See Also
Action, ActionMap

Method Summary

Modifier and TypeMethod and Description
public String
accelerator()

Accepts string values such as "ctrl+shift+T" to represent the keyboard shortcut for this action.

public String
factory()

The full class-name of a class that implements AnnotatedActionFactory.

public String
graphic()

The graphic that should be set in Action#graphicProperty().

public String
id()

By default the method name that this annotation is applied to, but if not null then this ID is what you use when requesting the Action out of the ActionMap when using the ActionMap#action(String) method.

public String
longText()

The text that should be set in Action#longTextProperty().

public String
text()

The text that should be set in Action#textProperty().

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

acceleratorback to summary
public String accelerator()

Accepts string values such as "ctrl+shift+T" to represent the keyboard shortcut for this action. By default this is empty if there is no keyboard shortcut desired for this action.

factoryback to summary
public String factory()

The full class-name of a class that implements AnnotatedActionFactory. ActionMap will use this class to instantiate the AnnotatedAction associated with this method, rather than using its own action factory.

graphicback to summary
public String graphic()

The graphic that should be set in Action#graphicProperty().

The graphic can be either image (local path or url) or font glyph.

Because a graphic can come from multiple sources, a simple protocol prefix is used to designate the type. Currently supported prefixes are 'image>' and 'font>'. Default protocol is 'image>'.

The following are the examples of different graphic nodes:

@ActionProxy(text="Teacher", graphic="http://icons.iconarchive.com/icons/custom-icon-design/mini-3/16/teacher-male-icon.png")
@ActionProxy(text="Security", graphic="/org/controlsfx/samples/security-low.png")
@ActionProxy(text="Security", graphic="image>/org/controlsfx/samples/security-low.png")
@ActionProxy(text="Star", graphic="font>FontAwesome|STAR")
idback to summary
public String id()

By default the method name that this annotation is applied to, but if not null then this ID is what you use when requesting the Action out of the ActionMap when using the ActionMap#action(String) method.

longTextback to summary
public String longText()

The text that should be set in Action#longTextProperty().

textback to summary
public String text()

The text that should be set in Action#textProperty().