Interface SideMenu

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

@StudioComponent(caption="SideMenu", category="Main window", xmlElement="sideMenu", icon="io/jmix/ui/icon/mainwindow/sideMenu.svg", canvasBehaviour=BOX, canvasIconSize=LARGE, canvasTextProperty="id", canvasText="Side Menu", unsupportedProperties={"box.expandRatio","css","responsive"}) public interface SideMenu extends Component.BelongToFrame, Component.Focusable
Side menu component that shows items as collapsible multi level list.
  • Field Details

  • Method Details

    • loadMenuConfig

      @StudioProperty(name="loadMenuConfig", type=BOOLEAN, defaultValue="true") void loadMenuConfig()
      Load menu structure from MenuConfig
    • setSidePanelToggleButton

      @StudioProperty(type=COMPONENT_REF, options="io.jmix.ui.component.Button") void setSidePanelToggleButton(@Nullable Button button)
      Bind show/hide side panel action to button.
      Parameters:
      button - button that should trigger show/hide of side panel
    • getSidePanelToggleButton

      @Nullable Button getSidePanelToggleButton()
      Returns:
      side panel toggle button
    • setSidePanel

      @StudioProperty(type=COMPONENT_REF) void setSidePanel(@Nullable Component sidePanel)
      Bind side panel for show/hide action.
      Parameters:
      sidePanel - side panel
    • getSidePanel

      @Nullable Component getSidePanel()
      Returns:
      side panel
    • isSelectOnClick

      boolean isSelectOnClick()
      Returns:
      true if an item becomes selected by click
    • setSelectOnClick

      @StudioProperty(defaultValue="false") void setSelectOnClick(boolean selectOnClick)
      Enable or disable automatic selected styling by click.
      Parameters:
      selectOnClick - enable/disable option
    • getSelectedItem

      @Nullable SideMenu.MenuItem getSelectedItem()
      Returns:
      currently selected item
    • setSelectedItem

      void setSelectedItem(SideMenu.MenuItem selectedItem)
      Set selected item.
      Parameters:
      selectedItem - new selected item
    • createMenuItem

      SideMenu.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

      SideMenu.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

      SideMenu.MenuItem createMenuItem(String id, String caption, @Nullable String icon, @Nullable Consumer<SideMenu.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(SideMenu.MenuItem menuItem)
      Add menu item to the end of root items list.
      Parameters:
      menuItem - menu item
    • addMenuItem

      void addMenuItem(SideMenu.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(SideMenu.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
    • removeAllMenuItems

      void removeAllMenuItems()
      Remove all the root menu items.
    • getMenuItem

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

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

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

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

      @StudioProperty(name="showSingleExpandedMenu", defaultValue="false") void setShowSingleExpandedMenu(boolean singleExpandedMenu)
      Set true for collapsing a submenu when another parent menu item is clicked
      Parameters:
      singleExpandedMenu -
    • isShowSingleExpandedMenu

      boolean isShowSingleExpandedMenu()
      Returns:
      true if a submenu is collapsing when another parent menu item is clicked
    • addItemSelectListener

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