Class SideMenuImpl

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

public class SideMenuImpl extends AbstractComponent<JmixSideMenu> implements SideMenu
  • Field Details

  • Constructor Details

    • SideMenuImpl

      public SideMenuImpl()
  • Method Details

    • handleAttach

      protected void handleAttach(com.vaadin.server.ClientConnector.AttachEvent attachEvent)
    • loadMenuConfig

      public void loadMenuConfig()
      Description copied from interface: SideMenu
      Load menu structure from MenuConfig
      Specified by:
      loadMenuConfig in interface SideMenu
    • setSidePanelToggleButton

      public void setSidePanelToggleButton(@Nullable Button toggleButton)
      Description copied from interface: SideMenu
      Bind show/hide side panel action to button.
      Specified by:
      setSidePanelToggleButton in interface SideMenu
      Parameters:
      toggleButton - button that should trigger show/hide of side panel
    • toggleSidePanel

      protected void toggleSidePanel()
    • getSidePanelToggleButton

      @Nullable public Button getSidePanelToggleButton()
      Specified by:
      getSidePanelToggleButton in interface SideMenu
      Returns:
      side panel toggle button
    • setSidePanel

      public void setSidePanel(@Nullable Component sidePanel)
      Description copied from interface: SideMenu
      Bind side panel for show/hide action.
      Specified by:
      setSidePanel in interface SideMenu
      Parameters:
      sidePanel - side panel
    • getSidePanel

      @Nullable public Component getSidePanel()
      Specified by:
      getSidePanel in interface SideMenu
      Returns:
      side panel
    • isSelectOnClick

      public boolean isSelectOnClick()
      Specified by:
      isSelectOnClick in interface SideMenu
      Returns:
      true if an item becomes selected by click
    • setSelectOnClick

      public void setSelectOnClick(boolean selectOnClick)
      Description copied from interface: SideMenu
      Enable or disable automatic selected styling by click.
      Specified by:
      setSelectOnClick in interface SideMenu
      Parameters:
      selectOnClick - enable/disable option
    • getSelectedItem

      @Nullable public SideMenu.MenuItem getSelectedItem()
      Specified by:
      getSelectedItem in interface SideMenu
      Returns:
      currently selected item
    • setSelectedItem

      public void setSelectedItem(SideMenu.MenuItem selectedItem)
      Description copied from interface: SideMenu
      Set selected item.
      Specified by:
      setSelectedItem in interface SideMenu
      Parameters:
      selectedItem - new selected item
    • checkItemIdDuplicate

      protected void checkItemIdDuplicate(String id)
    • checkItemOwner

      protected void checkItemOwner(SideMenu.MenuItem item)
    • createMenuItem

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

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

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

      protected void assignJTestId(SideMenu.MenuItem menuItem)
    • assignJTestIdInternal

      protected void assignJTestIdInternal(SideMenu.MenuItem menuItem)
    • addMenuItem

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

      protected void registerMenuItem(SideMenu.MenuItem menuItem)
    • unregisterItem

      protected void unregisterItem(SideMenu.MenuItem menuItem)
    • addMenuItem

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

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

      public void removeAllMenuItems()
      Description copied from interface: SideMenu
      Remove all the root menu items.
      Specified by:
      removeAllMenuItems in interface SideMenu
    • removeMenuItem

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

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

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

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

      public boolean hasMenuItems()
      Specified by:
      hasMenuItems in interface SideMenu
      Returns:
      true if the menu has items
    • 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
    • setShowSingleExpandedMenu

      public void setShowSingleExpandedMenu(boolean singleExpandedMenu)
      Description copied from interface: SideMenu
      Set true for collapsing a submenu when another parent menu item is clicked
      Specified by:
      setShowSingleExpandedMenu in interface SideMenu
    • isShowSingleExpandedMenu

      public boolean isShowSingleExpandedMenu()
      Specified by:
      isShowSingleExpandedMenu in interface SideMenu
      Returns:
      true if a submenu is collapsing when another parent menu item is clicked
    • addItemSelectListener

      public Subscription addItemSelectListener(Consumer<SideMenu.ItemSelectEvent> listener)
      Description copied from interface: SideMenu
      Adds a listener that will be fired when leaf (non-expandable) menu item is clicked.
      Specified by:
      addItemSelectListener in interface SideMenu
      Parameters:
      listener - a listener to add
      Returns:
      a Subscription object