Interface AppMenu

All Superinterfaces:
Component, Component.BelongToFrame, Component.Focusable
All Known Implementing Classes:
AppMenuImpl

@StudioComponent(caption="Menu", category="Main window", xmlElement="menu", icon="io/jmix/ui/icon/mainwindow/menu.svg", canvasBehaviour=BOX, canvasIconSize=LARGE, canvasTextProperty="id", canvasText="Main Menu", unsupportedProperties={"box.expandRatio","css","responsive"}) public interface AppMenu extends Component.BelongToFrame, Component.Focusable
  • Field Details

  • Method Details

    • loadMenu

      void loadMenu()
      Load menu structure from MenuConfig
    • createMenuItem

      AppMenu.MenuItem createMenuItem(String id)
      Create new menu item. Does not add item to menu. Id must be unique for whole menu.
      Parameters:
      id - item id
      Returns:
      menu item instance
    • createMenuItem

      AppMenu.MenuItem createMenuItem(String id, String caption)
      Create new menu item. Does not add item to menu. Id must be unique for whole menu.
      Parameters:
      id - item id
      caption - item caption
      Returns:
      menu item instance
    • createMenuItem

      AppMenu.MenuItem createMenuItem(String id, String caption, @Nullable String icon, @Nullable Consumer<AppMenu.MenuItem> command)
      Create new menu item. Does not add item to menu. Id must be unique for whole menu.
      Parameters:
      id - item id
      caption - item caption
      icon - icon
      command - command
      Returns:
      menu item instance
    • addMenuItem

      void addMenuItem(AppMenu.MenuItem menuItem)
      Add menu item to the end of root items list.
      Parameters:
      menuItem - menu item
    • addMenuItem

      void addMenuItem(AppMenu.MenuItem menuItem, int index)
      Add menu item to specified position in the root items list.
      Parameters:
      menuItem - menu item
      index - target index
    • removeMenuItem

      void removeMenuItem(AppMenu.MenuItem menuItem)
      Remove menu item from the root items list.
      Parameters:
      menuItem - menu item
    • removeMenuItem

      void removeMenuItem(int index)
      Remove menu item from the root items list by index.
      Parameters:
      index - index
    • getMenuItem

      @Nullable AppMenu.MenuItem getMenuItem(String id)
      Parameters:
      id - item id
      Returns:
      item from the menu tree by its id
    • getMenuItemNN

      AppMenu.MenuItem getMenuItemNN(String id)
      Parameters:
      id - item id
      Returns:
      item from the menu tree by its id
      Throws:
      IllegalArgumentException - if not found
    • getMenuItems

      List<AppMenu.MenuItem> getMenuItems()
      Returns:
      root menu items
    • hasMenuItems

      boolean hasMenuItems()
      Returns:
      true if the menu has items
    • createSeparator

      AppMenu.MenuItem createSeparator()
      Creates menu separator
    • setMenuItemShortcutCaption

      void setMenuItemShortcutCaption(AppMenu.MenuItem menuItem, String shortcut)
      Sets caption to MenuItem with value of shortcut key combination.
      Parameters:
      menuItem - MenuItem instance
      shortcut - shortcut key combination string representation