|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--gov.sns.application.Commander
The Commander manages the commands (actions and menu handlers) that are used in toolbars, menu items and menus. It creates and returns a menubar and a toolbar based on the menu definition for the application. A default menu definition provides the starting point. A custom menu definition can make changes as needed. This class may optionally be overriden to provide custom commands. Alternatively hooks in ApplicationAdaptor, XalDocument and XalWindow allow custom commands to be specified. The XalWindow creates a commander for its document. The commander builds the menu and toolbar and creates the associated actions. The commander is then disposed.
| Field Summary | |
protected java.util.Map |
buttonModelMap
|
protected java.util.Map |
commands
|
protected java.util.Map |
controlMap
|
| Constructor Summary | |
protected |
Commander()
Creates a new instance of Commander |
protected |
Commander(Commander appCommander,
XalDocument document)
Creates a new instance of Commander from an application wide commander |
| Method Summary | |
javax.swing.Action |
getAction(java.lang.String actionName)
Get the action with the given name. |
javax.swing.JMenuBar |
getMenubar()
Make and return a new menubar based on the menu definition file. |
javax.swing.JToolBar |
getToolbar()
Make and return a new toolbar based on the menu definition file. |
protected void |
loadBundle(java.lang.String path)
Load a bundle specified by the path in Java classpath notation. |
protected void |
loadBundles()
First loads the default menu definition bundle then loads the custom bundle. |
protected void |
loadCustomBundle()
Load a custom bundle if one exists. |
protected void |
loadCustomBundle(XalDocument 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 |
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. |
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.Map controlMap
protected java.util.Map commands
protected java.util.Map buttonModelMap
| Constructor Detail |
protected Commander(Commander appCommander,
XalDocument document)
protected Commander()
| Method Detail |
protected void loadBundles()
protected void loadDefaultBundle()
protected void loadCustomBundle()
protected void loadCustomBundle(XalDocument document)
protected void loadBundle(java.lang.String path)
throws java.util.MissingResourceException
path - Path in Java classpath notation to a properties file excluding the file suffix
java.util.MissingResourceExceptionpublic javax.swing.JMenuBar getMenubar()
public javax.swing.JToolBar getToolbar()
protected void registerCommands()
protected void registerCommands(XalDocument document)
document - The document for which some commands may need to be associatedprotected void registerCustomCommands()
XalDocument.customizeCommands(gov.sns.application.Commander),
XalWindow.customizeCommands(gov.sns.application.Commander),
ApplicationAdaptor.customizeCommands(gov.sns.application.Commander)protected void registerCustomCommands(XalDocument document)
document - The document for which some commands may need to be associatedXalDocument.customizeCommands(gov.sns.application.Commander),
XalWindow.customizeCommands(gov.sns.application.Commander),
ApplicationAdaptor.customizeCommands(gov.sns.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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||