Class ListMenu.MenuItem

java.lang.Object
io.jmix.flowui.kit.component.main.ListMenu.MenuItem
Direct Known Subclasses:
JmixListMenu.ViewMenuItem, ListMenu.MenuBarItem
Enclosing class:
ListMenu

public static class ListMenu.MenuItem extends Object
Describes menu item.
  • Field Details

    • id

      protected String id
    • title

      protected String title
    • description

      protected String description
    • icon

      protected com.vaadin.flow.component.icon.VaadinIcon icon
    • classNames

      protected List<String> classNames
    • clickHandler

      protected Consumer<ListMenu.MenuItem> clickHandler
  • Constructor Details

    • MenuItem

      public MenuItem(String id)
  • Method Details

    • create

      public static ListMenu.MenuItem create(String id)
      Creates menu item with provided id.
      Parameters:
      id - menu item id
      Returns:
      menu item
    • createMenuBar

      public static ListMenu.MenuBarItem createMenuBar(String id)
      Creates menu bar that can contains other menu items.
      Parameters:
      id - menu item id
      Returns:
      menu bar
    • getId

      public String getId()
    • getTitle

      @Nullable public String getTitle()
      Returns:
      title or null if not set
    • withTitle

      public ListMenu.MenuItem withTitle(@Nullable String title)
      Sets displayed menu item text.
      Parameters:
      title - displayed text
      Returns:
      current menu instance
    • getDescription

      @Nullable public String getDescription()
      Returns:
      menu item description or null if not set.
    • withDescription

      public ListMenu.MenuItem withDescription(@Nullable String description)
      Sets menu item description that should be shown when the user moves cursor on item.
      Parameters:
      description - description to set
      Returns:
      current menu instance
    • getIcon

      @Nullable public com.vaadin.flow.component.icon.VaadinIcon getIcon()
      Returns:
      icon or null if not set
    • withIcon

      public ListMenu.MenuItem withIcon(@Nullable com.vaadin.flow.component.icon.VaadinIcon icon)
      Sets icon that should be displayed to the left of the getTitle().
      Parameters:
      icon - icon to set
      Returns:
      current menu instance
    • getClassNames

      public List<String> getClassNames()
      Returns:
      class names or empty list
    • withClassNames

      public ListMenu.MenuItem withClassNames(List<String> classNames)
      Sets class names that should be added to the menu item.
      Parameters:
      classNames - class names to add
      Returns:
      current menu instance
    • addClassNames

      public void addClassNames(String... classNames)
      Adds class names that should be added to the menu item.
      Parameters:
      classNames - class names to add
    • getClickHandler

      @Nullable public Consumer<ListMenu.MenuItem> getClickHandler()
    • withClickHandler

      public ListMenu.MenuItem withClickHandler(@Nullable Consumer<ListMenu.MenuItem> clickHandler)
    • isMenu

      public boolean isMenu()
      Returns:
      true if menu item is ListMenu.MenuBarItem that contains other items, false otherwise
    • getMenuComponent

      @Nullable public ListMenu getMenuComponent()
      Returns:
      menu component that contains given menu item
    • setMenuComponent

      protected void setMenuComponent(@Nullable ListMenu menu)
    • isAttachedToMenu

      public boolean isAttachedToMenu()
      Returns:
      true if menu item is attached to the menu component, false otherwise
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object