Package docking.menu

Class MenuManager

java.lang.Object
docking.menu.MenuManager

public class MenuManager extends Object
Class to manage a hierarchy of menus.
  • 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
    • getMenuHandler

      public PopupMenuListener getMenuHandler()
    • getMenuItemText

      public String getMenuItemText()