| java.lang.Object org.netbeans.actions.spi.ActionProvider
All known Subclasses: org.netbeans.actions.spi.ProxyActionProvider, org.netbeans.actions.simple.SimpleActionProvider,
ActionProvider | abstract public class ActionProvider (Code) | | The heart of the actions framework from the application author's perspective -
the implementation of this class supplies the available actions in a given
context. Note that this class neither constructs Action objects, nor menu
items or other visual components - these are only needed when something
needs to be shown or updated, and the engine will provide
items to display them as needed.
This works as follows: When menus or toolbars need to be displayed/created/
updated, the Engine will ask its master ActionProvider for the actionNames
for each container context. A container context is simply a programmatic
name for a menu, toolbar, etc. It will then iterate those names, calling
the other methods like getDisplayName, to get the relevant data that is
needed by the presenter to display them, and use that information to
correctly configure the presenters.
The programmatic names that will be passed in are a private contract between
an implementation and its method of registering actions in the system. For
example, an implementation may allow components to register menus and
toolbars in an XML file; so the names for, e.g., menus will be provided
there. An application's documentation will specify how to register
actions, contexts, etc. and its implementation of ActionProvider will
use this registry to look up information about actions.
The only method that is passed any state information about the application
is getState(). This call is used to determine if a presenter is visible
and enabled or disabled, which is all the information that is needed to
display a presenter correctly. It is passed a Map which contains all
the available information about the current user context (what object
is selected, what window is focused, etc.) The implementation can query
the map, to decide what to display and its state. The actual contents of this map are
a private contract with a given implementation. For example, in NetBeans,
the Map will probably be a wrapper for the selected node and its Lookup.
author: Tim Boudreau |
Method Summary | |
abstract public String[] | getActionNames(String containerCtx) Get the programmatic names (not display names) for all of the actions
in a given context. | abstract public int | getActionType(String actionName, String containerCtx) Get the action type. | abstract public String | getDescription(String actionName, String containerCtx) Get a description for an action appropriate for use in a tooltip. | abstract public String | getDisplayName(String actionName, String containerCtx) | abstract public Icon | getIcon(String actionName, String containerCtx, int type) Get the icon, if any, for a given action. | abstract public int | getMnemonic(String actionName, String containerCtx) | abstract public int | getMnemonicIndex(String actionName, String containerCtx) | abstract public int | getState(String actionName, String containerCtx, Map context) Get the enablement/visibility state of the named action, given the
passed user context map. |
ACTION_TYPE_ITEM | final public static int ACTION_TYPE_ITEM(Code) | | |
ACTION_TYPE_SUBCONTEXT | final public static int ACTION_TYPE_SUBCONTEXT(Code) | | |
ACTION_TYPE_TOGGLE | final public static int ACTION_TYPE_TOGGLE(Code) | | |
STATE_ENABLED | final public static int STATE_ENABLED(Code) | | |
STATE_SELECTED | final public static int STATE_SELECTED(Code) | | |
STATE_VISIBLE | final public static int STATE_VISIBLE(Code) | | |
getActionNames | abstract public String[] getActionNames(String containerCtx)(Code) | | Get the programmatic names (not display names) for all of the actions
in a given context. The result should include all
actions registered for that context whether or not they're enabled/displayed/etc.
getState() will be called later for each to decide if they should be
presented currently, or hidden.
|
getActionType | abstract public int getActionType(String actionName, String containerCtx)(Code) | | Get the action type. This will not be called for toolbars, but will be
called for menus to determine if a submenu presenter or a menu item
presenter is needed
|
getDescription | abstract public String getDescription(String actionName, String containerCtx)(Code) | | Get a description for an action appropriate for use in a tooltip. Used
for toolbar presenters.
|
getDisplayName | abstract public String getDisplayName(String actionName, String containerCtx)(Code) | | Get the display name for a given action name returned from getActionNames,
in a given logical action container (toolbar, menu, etc)
|
getIcon | abstract public Icon getIcon(String actionName, String containerCtx, int type)(Code) | | Get the icon, if any, for a given action. The type argument is as defined
in BeanInfo
|
getMnemonic | abstract public int getMnemonic(String actionName, String containerCtx)(Code) | | Get the mnemonic to be used for action text
|
getMnemonicIndex | abstract public int getMnemonicIndex(String actionName, String containerCtx)(Code) | | Get the displayed mnemonic index for action text
|
getState | abstract public int getState(String actionName, String containerCtx, Map context)(Code) | | Get the enablement/visibility state of the named action, given the
passed user context map.
|
|
|