public class Commander
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MENU_DEFINITION_RESOURCE
name for the menu definition resource which may or may not exist
|
Modifier | Constructor and Description |
---|---|
protected |
Commander(Application application)
Constructor for generating an application commander.
|
protected |
Commander(Commander appCommander,
xal.extension.application.XalAbstractDocument document)
Primary Constructor for generating a document commander.
|
protected |
Commander(Commander appCommander,
XalDocument document)
Constructor for generating a document commander.
|
protected |
Commander(Commander appCommander,
XalInternalDocument document)
Constructor for generating a document commander.
|
protected |
Commander(DesktopApplication application)
Constructor for generating a desktop application commander.
|
protected |
Commander(XalInternalDocument document)
Constructor for generating a document commander.
|
Modifier and Type | Method and Description |
---|---|
javax.swing.Action |
getAction(java.lang.String actionName)
Get the action with the given name.
|
java.lang.String |
getActionKey(java.lang.String menuItemKey)
Get the action key for the specified menu or menu item by its ID.
|
javax.swing.Icon |
getIcon(java.lang.String itemID)
Get the icon for the specified item.
|
java.lang.String[] |
getItemsAfter(java.lang.String itemID)
Get the array of items following the specified item
|
java.lang.String[] |
getItemsBefore(java.lang.String itemID)
Get the array of items preceding the specified item
|
java.lang.String |
getLabel(java.lang.String itemID)
Get the label for the specified item by its ID.
|
javax.swing.JMenuBar |
getMenubar()
Make and return a new menubar based on the menu definition file.
|
javax.swing.ButtonModel |
getModel(java.lang.String actionKey)
Get the button model corresponding to the specified action key.
|
xal.extension.application.ItemState |
getState(java.lang.String itemID)
Get the state of the item.
|
javax.swing.JToolBar |
getToolbar()
Make and return a new toolbar based on the menu definition file.
|
protected void |
loadBundle(java.net.URL resourceURL)
Load a bundle at the specified URL.
|
protected void |
loadCustomBundle(Application application)
Load a custom bundle if one exists.
|
protected void |
loadCustomBundle(Application application,
java.lang.String resourceName)
Load a custom bundle if one exists.
|
protected void |
loadCustomBundle(xal.extension.application.XalAbstractDocument document)
Load a custom bundle for the document if one exists.
|
protected void |
loadCustomDocumentBundle(XalInternalDocument document)
Load a custom bundle for the document if one exists.
|
protected void |
loadDefaultBundle()
Load the default bundle.
|
void |
registerAction(javax.swing.Action action)
Register the action to be used by the commander.
|
void |
registerAction(javax.swing.Action action,
javax.swing.ButtonModel model)
Register the action and button model to be used by the commander.
|
protected void |
registerCommands()
Register all application commands (default and custom).
|
protected void |
registerCommands(XalDocument document)
Register all document commands (default and custom).
|
protected void |
registerCommands(XalInternalDocument document)
Register all document commands (default and custom).
|
protected void |
registerCustomCommands()
Subclasses may override this method to provide custom application commands.
|
protected void |
registerCustomCommands(XalDocument document)
Subclasses may override this method to provide custom document commands.
|
protected void |
registerCustomCommands(XalInternalDocument document)
Subclasses may override this method to provide custom document commands.
|
protected void |
registerDesktopCommands()
Register all application commands (default and custom).
|
void |
registerMenuHandler(javax.swing.event.MenuListener handler,
java.lang.String name)
Register the menu handler to be used by the commander.
|
void |
registerModel(java.lang.String name,
javax.swing.ButtonModel model)
Register the action to be used by the commander.
|
protected void |
registerTextCommands()
Register the actions associated with text components.
|
public static final java.lang.String MENU_DEFINITION_RESOURCE
protected Commander(Commander appCommander, xal.extension.application.XalAbstractDocument document)
protected Commander(Commander appCommander, XalDocument document)
protected Commander(Commander appCommander, XalInternalDocument document)
protected Commander(XalInternalDocument document)
protected Commander(Application application)
protected Commander(DesktopApplication application)
protected void loadDefaultBundle()
protected void loadCustomBundle(Application application)
application
- the application for which to load the custom bundle.protected void loadCustomBundle(Application application, java.lang.String resourceName)
application
- the application for which to load the custom bundle.resourceName
- name of the properites resource to load.protected void loadCustomBundle(xal.extension.application.XalAbstractDocument document)
document
- the document for which to load the custom bundle.protected void loadCustomDocumentBundle(XalInternalDocument document)
document
- the document for which to load the custom bundle.protected void loadBundle(java.net.URL resourceURL)
resourceURL
- URL to the resource bundle to loadpublic javax.swing.JMenuBar getMenubar()
public javax.swing.JToolBar getToolbar()
public javax.swing.ButtonModel getModel(java.lang.String actionKey)
actionKey
- the key for which to get the button model.public java.lang.String getActionKey(java.lang.String menuItemKey)
menuItemKey
- the ID of the menu item for which to get the labelpublic java.lang.String getLabel(java.lang.String itemID)
itemID
- the ID of the menu item for which to get the labelpublic java.lang.String[] getItemsBefore(java.lang.String itemID)
public java.lang.String[] getItemsAfter(java.lang.String itemID)
public javax.swing.Icon getIcon(java.lang.String itemID)
itemID
- the ID of the menu item for which to get the labelpublic xal.extension.application.ItemState getState(java.lang.String itemID)
protected void registerCommands()
protected void registerDesktopCommands()
protected void registerCommands(XalDocument document)
document
- The document for which some commands may need to be associatedprotected void registerCommands(XalInternalDocument document)
document
- The document for which some commands may need to be associatedprotected void registerCustomCommands()
XalAbstractDocument.customizeCommands(xal.extension.application.Commander)
,
XalWindow.customizeCommands(xal.extension.application.Commander)
,
AbstractApplicationAdaptor.customizeCommands(xal.extension.application.Commander)
protected void registerCustomCommands(XalDocument document)
document
- The document for which some commands may need to be associatedXalAbstractDocument.customizeCommands(xal.extension.application.Commander)
,
XalWindow.customizeCommands(xal.extension.application.Commander)
,
AbstractApplicationAdaptor.customizeCommands(xal.extension.application.Commander)
protected void registerCustomCommands(XalInternalDocument document)
document
- The document for which some commands may need to be associatedXalAbstractDocument.customizeCommands(xal.extension.application.Commander)
,
XalWindow.customizeCommands(xal.extension.application.Commander)
,
AbstractApplicationAdaptor.customizeCommands(xal.extension.application.Commander)
public javax.swing.Action getAction(java.lang.String actionName)
actionName
- The name of the action to get.public void registerAction(javax.swing.Action action)
action
- The action to register.public void registerAction(javax.swing.Action action, javax.swing.ButtonModel model)
action
- The action to register.model
- The button model to associate with the action.public void registerModel(java.lang.String name, javax.swing.ButtonModel model)
name
- The name to key the model with a button or menu item.model
- The button model to associate with the action.public void registerMenuHandler(javax.swing.event.MenuListener handler, java.lang.String name)
handler
- The handler to registername
- The unique name to associate with the handlerprotected void registerTextCommands()