Class ActionManager

java.lang.Object
org.jdesktop.application.AbstractBean
org.jdesktop.application.ActionManager

public class ActionManager extends AbstractBean
The application's ActionManager provides read-only cached access to ActionMaps that contain one entry for each method marked with the @Action annotation in a class.
See Also:
  • Constructor Details

  • Method Details

    • getContext

      protected final ApplicationContext getContext()
    • getActionMap

      public ApplicationActionMap getActionMap()
      The ActionMap chain for the entire Application.

      Returns an ActionMap with the @Actions defined in the application's Application subclass, i.e. the the value of:

       ApplicationContext.getInstance().getApplicationClass()
       
      The remainder of the chain contains one ActionMap for each superclass, up to Application.class. The ActionMap.get() method searches the entire chain, so logically, the ActionMap that this method returns contains all of the application-global actions.

      The value returned by this method is cached.

      Returns:
      the ActionMap chain for the entire Application.
      See Also:
    • getActionMap

      public ApplicationActionMap getActionMap(Class actionsClass, 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.

      Returns:
      the ApplicationActionMap for actionsClass and actionsObject
      See Also: