Class ActionMap

  • public class ActionMap
    extends Object
    Action Map provides an ability to create an action map of any object. Attempts to convert methods annotated with ActionProxy to Action.

    Code Example

    Here's a very simple example of how to use ActionMap to register a class (in this class it is the application class itself), and to then retrieve actions out of the ActionMap (via the static action(String) method:
     public class ActionMapDemo extends Application {
         public ActionMapDemo() {
             Action action11 = ActionMap.action("action11");
             Button actionButton = ActionUtils.createButton(action11);
         @ActionProxy(text="Action 1.1", graphic="start.png", accelerator="ctrl+shift+T")
         private void action11() {
             System.out.println( "Action 1.1 is executed");
    If you require more control over the creation of the Action objects, you can either set the global ActionFactory by calling ActionMap.setActionFactory() and/or you can use the factory property on individual @ActionProxy declarations to set the factory on a case-by-case basis.
    See Also:
    ActionProxy, Action
    • Method Detail

      • getActionFactory

        public static AnnotatedActionFactory getActionFactory()
        Returns the action factory used by ActionMap to construct AnnotatedAction instances. By default, this is an instance of DefaultActionFactory.
      • setActionFactory

        public static void setActionFactory​(AnnotatedActionFactory factory)
        Sets the action factory used by ActionMap to construct AnnotatedAction instances. This factory can be overridden on a case-by-case basis by specifying a factory class in ActionProxy.factory()
      • register

        public static void register​(Object target)
        Attempts to convert target's methods annotated with ActionProxy to Actions. Three types of methods are currently converted: parameter-less methods, methods with one parameter of type ActionEvent, and methods with two parameters (ActionEvent, Action). Note that this method supports safe re-registration of a given instance or of another instance of the same class that has already been registered. If another instance of the same class is registered, then those actions will now be associated with the new instance. The first instance is implicitly unregistered. Actions are registered with their id or method name if id is not defined.
        target - object to work on
        IllegalStateException - if a method with unsupported parameters is annotated with ActionProxy.
      • unregister

        public static void unregister​(Object target)
        Removes all the actions associated with target object from the action map.
        target - object to work on
      • action

        public static Action action​(String id)
        Returns action by its id.
        id - action id
        action or null if id was not found