Package docking.menu

# Class MenuManager

java.lang.Object
docking.menu.MenuManager

public class MenuManager extends Object
Class to manage a hierarchy of menus.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MenuManager(String name, char mnemonicKey, String group, boolean usePopupPath, MenuHandler menuHandler, MenuGroupMap menuGroupMap)`
  Constructs a new MenuManager

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAction(DockingActionIf action)`
  Adds an action to this menu.
  `void`
  `dispose()`
  `DockingActionIf`
  `getAction(String actionName)`
  `String`
  `getGroup()`
  `JMenu`
  `getMenu()`
  Returns a Menu hierarchy of all the actions
  `PopupMenuListener`
  `getMenuHandler()`
  `JMenuItem`
  `getMenuItem()`
  `String`
  `getMenuItemText()`
  `static char`
  `getMnemonicKey(String str)`
  Parses the mnemonic key from the menu items text.
  `JPopupMenu`
  `getPopupMenu()`
  Returns a JPopupMenu for the action hierarchy
  `String`
  `getSubGroup()`
  `boolean`
  `isEmpty()`
  Tests if this menu is empty.
  `void`
  `menuGroupChanged(String[] theMenuPath, int i, String localGroup)`
  Notification that a menu item has changed groups.
  `boolean`
  `removeAction(DockingActionIf action)`
  `static String`
  `stripMnemonicAmp(String text)`
  Removes the Mnemonic indicator character (&) from the text
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### MenuManager

    public MenuManager(String name, char mnemonicKey, String group, boolean usePopupPath, MenuHandler menuHandler, MenuGroupMap menuGroupMap)
    Constructs a new MenuManager
    Parameters:
      `name` - the name of the menu.
      `mnemonicKey` - the key to use for the menu mnemonic
      `group` - the group of the menu.
      `usePopupPath` - if true, registers actions with popup paths as popup items.
      `menuHandler` - Listener to be notified of menu behavior.
      `menuGroupMap` - maps menu groups to menu paths

- ## Method Details

  - ### addAction

    public void addAction(DockingActionIf action)
    Adds an action to this menu. Can create subMenus depending on the menuPath of the action
    Parameters:
      `action` - the action to be added

  - ### getAction

    public DockingActionIf getAction(String actionName)

  - ### getMnemonicKey

    public static char getMnemonicKey(String str)
    Parses the mnemonic key from the menu items text.
    Parameters:
      `str` - the menu item text
    Returns:
      the mnemonic key for encoded in the actions menu text. Returns 0 if there is none.

  - ### stripMnemonicAmp

    public static String stripMnemonicAmp(String text)
    Removes the Mnemonic indicator character (&) from the text
    Parameters:
      `text` - the text to strip
    Returns:
      the stripped mnemonic

  - ### isEmpty

    public boolean isEmpty()
    Tests if this menu is empty.

  - ### getMenu

    public JMenu getMenu()
    Returns a Menu hierarchy of all the actions
    Returns:
      the menu

  - ### getMenuItem

    public JMenuItem getMenuItem()
    See Also:
      - `ManagedMenuItem.getMenuItem()`

  - ### getGroup

    public String getGroup()
    See Also:
      - `ManagedMenuItem.getGroup()`

  - ### getSubGroup

    public String getSubGroup()

  - ### dispose

    public void dispose()

  - ### getPopupMenu

    public JPopupMenu getPopupMenu()
    Returns a JPopupMenu for the action hierarchy
    Returns:
      the popup menu

  - ### removeAction

    public boolean removeAction(DockingActionIf action)

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### menuGroupChanged

    public void menuGroupChanged(String[] theMenuPath, int i, String localGroup)
    Notification that a menu item has changed groups.
    Parameters:
      `theMenuPath` - the menu path of the item whose group changed.
      `i` - the index into the menu path of the part that changed groups.
      `localGroup` - the new group.

  - ### getMenuHandler

    public PopupMenuListener getMenuHandler()

  - ### getMenuItemText

    public String getMenuItemText()