Class ActionManager
- java.lang.Object
-
- org.jdesktop.application.AbstractBean
-
- org.jdesktop.application.ActionManager
-
public class ActionManager extends AbstractBean
The application'sActionManagerprovides read-only cached access toActionMapsthat contain one entry for each method marked with the@Actionannotation in a class.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedActionManager(ApplicationContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApplicationActionMapgetActionMap()TheActionMapchain for the entireApplication.ApplicationActionMapgetActionMap(java.lang.Class actionsClass, java.lang.Object actionsObject)Returns theApplicationActionMapchain for the specified actions class and target object.protected ApplicationContextgetContext()-
Methods inherited from class org.jdesktop.application.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
ActionManager
protected ActionManager(ApplicationContext context)
-
-
Method Detail
-
getContext
protected final ApplicationContext getContext()
-
getActionMap
public ApplicationActionMap getActionMap()
TheActionMapchain for the entireApplication.Returns an
ActionMapwith the@Actionsdefined in the application'sApplicationsubclass, i.e. the the value of:ApplicationContext.getInstance().getApplicationClass()
The remainder of the chain contains oneActionMapfor each superclass, up toApplication.class. TheActionMap.get()method searches the entire chain, so logically, theActionMapthat this method returns contains all of the application-global actions.The value returned by this method is cached.
- Returns:
- the
ActionMapchain for the entireApplication. - See Also:
getActionMap(Class, Object),ApplicationContext.getActionMap(),ApplicationContext.getActionMap(Class, Object),ApplicationContext.getActionMap(Object)
-
getActionMap
public ApplicationActionMap getActionMap(java.lang.Class actionsClass, java.lang.Object actionsObject)
Returns theApplicationActionMapchain for the specified actions class and target object.The specified class can contain methods marked with the
@Actionannotation. Each one will be turned into anApplicationActionobject and all of them will be added to a singleApplicationActionMap. All of theApplicationActionsinvoke theiractionPerformedmethod on the specifiedactionsObject. The parent of the returnedActionMapis the globalActionMapthat contains the@Actionsdefined in this application'sApplicationsubclass.To bind an
@Actionto a Swing component, one specifies the@Action'sname 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
actionsObjectand theApplicationActionMapandApplicationActionsthat refer to it. In other words, if you drop all references to theactionsObject, including itsApplicationActionsand theirApplicationActionMaps, then the cachedActionMapentry will be cleared.- Returns:
- the
ApplicationActionMapforactionsClassandactionsObject - See Also:
getActionMap(),ApplicationContext.getActionMap(),ApplicationContext.getActionMap(Class, Object),ApplicationContext.getActionMap(Object)
-
-