Class ActionManager
- java.lang.Object
-
- org.jdesktop.application.AbstractBean
-
- org.jdesktop.application.ActionManager
-
public class ActionManager extends AbstractBean
The application'sActionManager
provides read-only cached access toActionMaps
that contain one entry for each method marked with the@Action
annotation in a class.- Author:
- Hans Muller (Hans.Muller@Sun.COM)
- See Also:
ApplicationContext.getActionMap(Object)
,ApplicationActionMap
,ApplicationAction
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ActionManager(ApplicationContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApplicationActionMap
getActionMap()
TheActionMap
chain for the entireApplication
.ApplicationActionMap
getActionMap(java.lang.Class actionsClass, java.lang.Object actionsObject)
Returns theApplicationActionMap
chain for the specified actions class and target object.protected ApplicationContext
getContext()
-
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()
TheActionMap
chain for the entireApplication
.Returns an
ActionMap
with the@Actions
defined in the application'sApplication
subclass, i.e. the the value of:ApplicationContext.getInstance().getApplicationClass()
The remainder of the chain contains oneActionMap
for each superclass, up toApplication.class
. TheActionMap.get()
method searches the entire chain, so logically, theActionMap
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 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 theApplicationActionMap
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 anApplicationAction
object and all of them will be added to a singleApplicationActionMap
. All of theApplicationActions
invoke theiractionPerformed
method on the specifiedactionsObject
. The parent of the returnedActionMap
is the globalActionMap
that contains the@Actions
defined in this application'sApplication
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 theApplicationActionMap
andApplicationActions
that refer to it. In other words, if you drop all references to theactionsObject
, including itsApplicationActions
and theirApplicationActionMaps
, then the cachedActionMap
entry will be cleared.- Parameters:
actionsClass
-actionsObject
-- Returns:
- the
ApplicationActionMap
foractionsClass
andactionsObject
- See Also:
getActionMap()
,ApplicationContext.getActionMap()
,ApplicationContext.getActionMap(Class, Object)
,ApplicationContext.getActionMap(Object)
-
-