Class ActionManager

    • Method Detail

      • getActionMap

        public ApplicationActionMap getActionMap​(java.lang.Class actionsClass,
                                                 java.lang.Object actionsObject)
        Returns the ApplicationActionMap chain for the specified actions class and target object.

        The specified class can contain methods marked with the @Action annotation. Each one will be turned into an ApplicationAction object and all of them will be added to a single ApplicationActionMap. All of the ApplicationActions invoke their actionPerformed method on the specified actionsObject. The parent of the returned ActionMap is the global ActionMap that contains the @Actions defined in this application's Application subclass.

        To bind an @Action to a Swing component, one specifies the @Action's name in an expression like this:

         ApplicationContext ctx = Application.getInstance(MyApplication.class).getContext();
         MyActions myActions = new MyActions();
         myComponent.setAction(ac.getActionMap(myActions).get("myAction"));
         

        The value returned by this method is cached. The lifetime of the cached entry will be the same as the lifetime of the actionsObject and the ApplicationActionMap and ApplicationActions that refer to it. In other words, if you drop all references to the actionsObject, including its ApplicationActions and their ApplicationActionMaps, then the cached ActionMap entry will be cleared.

        Parameters:
        actionsClass -
        actionsObject -
        Returns:
        the ApplicationActionMap for actionsClass and actionsObject
        See Also:
        getActionMap(), ApplicationContext.getActionMap(), ApplicationContext.getActionMap(Class, Object), ApplicationContext.getActionMap(Object)