|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.arch4j.ui.CommandManager
The CommandManager is used by an application to manage menuItems and toolbars buttons and their associated actions. The CommandManager uses an instance of ResourceManager (or a subclass) which *defines* the menus, toolbars and actions for an application. The CommandManager maintains a dictionary of menuItems keyed by name which can be used by the application to enable and disable menuItems. A similar dictionary of toolbar buttons is maintained. the methods enableCommand(String aCommand) and disableCommand(String aCommand) are used to enable and disable both the menuItem and toolbar button associated with a command. The CommandManager automatcally creates an instance of ActionPerformer for menuItems and toolbar buttons when it instantiates them. ActionPerformer calls a method in the application when the menuItem or toolbar button is selected. The Java reflection mechanism is used to determine if the application implements the method for an action and initiallty disables the menuItem and toolbar button associated with that action if the method is not found in the application. The default ActionPerformer can be overridden by the application by using the addAction(ActionPerformer anAP) method.
Constructor Summary | |
CommandManager()
|
|
CommandManager(ResourceManager aResourceManager)
|
|
CommandManager(ResourceManager aResourceManager,
JApplication anApplication)
|
|
CommandManager(ResourceManager aResourceManager,
JPanel anApplication)
|
Method Summary | |
void |
addAction(Action theAction)
|
boolean |
applicationImplements(String methodName)
|
JMenuBar |
createMenubar()
|
JPopupMenu |
createPopupMenu(String key)
|
JToolBar |
createToolbar()
|
void |
disableAction(String action)
Disable any button(s) and/or menu item(s) associated with an action string. |
void |
disableAction(String action,
String toolTip)
Disable any button(s) and/or menu item(s) associated with an action string. |
void |
enableAction(String action)
Enable any button(s) and/or menu item(s) associated with an action string. |
void |
enableAction(String action,
String toolTip)
Enable any button(s) and/or menu item(s) associated with an action string. |
JMenu |
getMenu(String menu)
Gets a menu for the given menu name. |
JMenuBar |
getMenubar()
This method returns the cached menu bar. |
JToolBar |
getToolbar()
This method returns the cached tool bar. |
Component |
getToolbarButtonAt(int index)
This method was created by a SmartGuide. |
boolean |
isSelected(String action)
Gets whether or not the action is selected. |
void |
setSelected(String action,
boolean isSelected)
Sets the toolbar and menu item(s) to the selected value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CommandManager()
public CommandManager(ResourceManager aResourceManager)
public CommandManager(ResourceManager aResourceManager, JApplication anApplication)
public CommandManager(ResourceManager aResourceManager, JPanel anApplication)
Method Detail |
public void addAction(Action theAction)
public boolean applicationImplements(String methodName)
public JMenuBar createMenubar()
public JPopupMenu createPopupMenu(String key)
public JToolBar createToolbar()
public void disableAction(String action)
action
- The action to disable button(s) and/or menu item(s) for.public void disableAction(String action, String toolTip)
action
- The action to disable button(s) and/or menu item(s) for.toolTip
- A tooltip associated with the disabled button, if one exists.public void enableAction(String action)
action
- The action to enable button(s) and/or menu item(s) for.public void enableAction(String action, String toolTip)
action
- The action to disable button(s) and/or menu item(s) for.toolTip
- A tooltip associated with the disabled button, if one exists.public JMenu getMenu(String menu)
public JMenuBar getMenubar()
createMenuBar()
public JToolBar getToolbar()
createToolbar()
public Component getToolbarButtonAt(int index)
index
- int
public boolean isSelected(String action)
action
- The name of the items that you wish to check.
public void setSelected(String action, boolean isSelected)
action
- The name of the items that you wish to selected/de-selected.isSelected
- true if the item is to be selected.
|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |