Class AppMenuImpl

java.lang.Object
io.jmix.ui.component.impl.AbstractComponent<JmixMenuBar>
io.jmix.ui.component.mainwindow.impl.AppMenuImpl
All Implemented Interfaces:
AttachNotifier, Component, Component.BelongToFrame, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper, HasContextHelp, HasDebugId, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer, AppMenu

public class AppMenuImpl extends AbstractComponent<JmixMenuBar> implements AppMenu
  • Field Details

  • Constructor Details

    • AppMenuImpl

      public AppMenuImpl()
  • Method Details

    • handleAttach

      protected void handleAttach(com.vaadin.server.ClientConnector.AttachEvent event)
    • setStyleName

      public void setStyleName(@Nullable String name)
      Description copied from interface: Component
      Sets one or more style names of the component, replacing any previous styles. Multiple styles can be specified as a space-separated list of style names. Styles implementation is client-type-specific.
      Specified by:
      setStyleName in interface Component
      Overrides:
      setStyleName in class AbstractComponent<JmixMenuBar>
      Parameters:
      name - one or more style names separated by space.
    • getStyleName

      public String getStyleName()
      Description copied from interface: Component
      Styles implementation is client-type-specific.
      Specified by:
      getStyleName in interface Component
      Overrides:
      getStyleName in class AbstractComponent<JmixMenuBar>
      Returns:
      current style name.
    • loadMenu

      public void loadMenu()
      Description copied from interface: AppMenu
      Load menu structure from MenuConfig
      Specified by:
      loadMenu in interface AppMenu
    • createMenuItem

      public AppMenu.MenuItem createMenuItem(String id)
      Description copied from interface: AppMenu
      Create new menu item. Does not add item to menu. Id must be unique for whole menu.
      Specified by:
      createMenuItem in interface AppMenu
      Parameters:
      id - item id
      Returns:
      menu item instance
    • createMenuItem

      public AppMenu.MenuItem createMenuItem(String id, String caption)
      Description copied from interface: AppMenu
      Create new menu item. Does not add item to menu. Id must be unique for whole menu.
      Specified by:
      createMenuItem in interface AppMenu
      Parameters:
      id - item id
      caption - item caption
      Returns:
      menu item instance
    • createMenuItem

      public AppMenu.MenuItem createMenuItem(String id, String caption, @Nullable String icon, @Nullable Consumer<AppMenu.MenuItem> command)
      Description copied from interface: AppMenu
      Create new menu item. Does not add item to menu. Id must be unique for whole menu.
      Specified by:
      createMenuItem in interface AppMenu
      Parameters:
      id - item id
      caption - item caption
      icon - icon
      command - command
      Returns:
      menu item instance
    • assignJTestIds

      protected void assignJTestIds(AppMenu.MenuItem menuItem, String id)
    • addMenuItem

      public void addMenuItem(AppMenu.MenuItem menuItem)
      Description copied from interface: AppMenu
      Add menu item to the end of root items list.
      Specified by:
      addMenuItem in interface AppMenu
      Parameters:
      menuItem - menu item
    • addMenuItem

      public void addMenuItem(AppMenu.MenuItem menuItem, int index)
      Description copied from interface: AppMenu
      Add menu item to specified position in the root items list.
      Specified by:
      addMenuItem in interface AppMenu
      Parameters:
      menuItem - menu item
      index - target index
    • registerMenuItem

      protected void registerMenuItem(AppMenu.MenuItem menuItem)
    • removeMenuItem

      public void removeMenuItem(AppMenu.MenuItem menuItem)
      Description copied from interface: AppMenu
      Remove menu item from the root items list.
      Specified by:
      removeMenuItem in interface AppMenu
      Parameters:
      menuItem - menu item
    • removeMenuItem

      public void removeMenuItem(int index)
      Description copied from interface: AppMenu
      Remove menu item from the root items list by index.
      Specified by:
      removeMenuItem in interface AppMenu
      Parameters:
      index - index
    • unregisterItem

      protected void unregisterItem(AppMenu.MenuItem menuItem)
    • getMenuItem

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

      public AppMenu.MenuItem getMenuItemNN(String id)
      Specified by:
      getMenuItemNN in interface AppMenu
      Parameters:
      id - item id
      Returns:
      item from the menu tree by its id
    • getMenuItems

      public List<AppMenu.MenuItem> getMenuItems()
      Specified by:
      getMenuItems in interface AppMenu
      Returns:
      root menu items
    • hasMenuItems

      public boolean hasMenuItems()
      Specified by:
      hasMenuItems in interface AppMenu
      Returns:
      true if the menu has items
    • checkItemIdDuplicate

      protected void checkItemIdDuplicate(String id)
    • checkItemOwner

      protected void checkItemOwner(AppMenu.MenuItem item)
    • createSeparator

      public AppMenu.MenuItem createSeparator()
      Description copied from interface: AppMenu
      Creates menu separator
      Specified by:
      createSeparator in interface AppMenu
    • setMenuItemShortcutCaption

      public void setMenuItemShortcutCaption(AppMenu.MenuItem menuItem, String shortcut)
      Description copied from interface: AppMenu
      Sets caption to MenuItem with value of shortcut key combination.
      Specified by:
      setMenuItemShortcutCaption in interface AppMenu
      Parameters:
      menuItem - MenuItem instance
      shortcut - shortcut key combination string representation
    • focus

      public void focus()
      Description copied from interface: Component.Focusable
      Sets focus to this component
      Specified by:
      focus in interface Component.Focusable
    • getTabIndex

      public int getTabIndex()
      Description copied from interface: Component.Focusable
      Gets the tabulator index of the HasTabIndex component.
      Specified by:
      getTabIndex in interface Component.Focusable
      Returns:
      tab index set for the HasTabIndex component
    • setTabIndex

      public void setTabIndex(int tabIndex)
      Description copied from interface: Component.Focusable
      Sets the tabulator index of the Focusable component. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index.
      Specified by:
      setTabIndex in interface Component.Focusable
      Parameters:
      tabIndex - tab index