Class ListMenu.MenuItem

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

public static class ListMenu.MenuItem extends Object implements MenuItem
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
    • shortcutCombination

      protected KeyCombination shortcutCombination
    • prefixComponent

      protected com.vaadin.flow.component.Component prefixComponent
    • suffixComponent

      protected com.vaadin.flow.component.Component suffixComponent
    • propertyChangeSupport

      protected PropertyChangeSupport propertyChangeSupport
  • 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()
      Specified by:
      getTitle in interface MenuItem
      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 @Deprecated(since="2.2", forRemoval=true) public com.vaadin.flow.component.icon.VaadinIcon getIcon()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      icon or null if not set
    • withIcon

      @Deprecated(since="2.2", forRemoval=true) public ListMenu.MenuItem withIcon(@Nullable com.vaadin.flow.component.icon.VaadinIcon icon)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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)
    • getShortcutCombination

      @Nullable public KeyCombination getShortcutCombination()
    • withShortcutCombination

      public ListMenu.MenuItem withShortcutCombination(@Nullable KeyCombination shortcutCombination)
    • getSuffixComponent

      @Nullable public com.vaadin.flow.component.Component getSuffixComponent()
      Returns:
      suffix component of the item
    • withSuffixComponent

      public ListMenu.MenuItem withSuffixComponent(@Nullable com.vaadin.flow.component.Component suffixComponent)
      Sets suffix component of the item.
      Parameters:
      suffixComponent - component to set
      Returns:
      current menu item instance
    • setSuffixComponent

      public void setSuffixComponent(@Nullable com.vaadin.flow.component.Component suffixComponent)
      Sets suffix component of the item.
      Parameters:
      suffixComponent - component to set
    • getPrefixComponent

      public com.vaadin.flow.component.Component getPrefixComponent()
      Returns:
      prefix component of the item
    • withPrefixComponent

      public ListMenu.MenuItem withPrefixComponent(com.vaadin.flow.component.Component prefixComponent)
      Sets prefix component of the item.
      Parameters:
      prefixComponent - component to set
      Returns:
      current menu item instance
    • setPrefixComponent

      public void setPrefixComponent(com.vaadin.flow.component.Component prefixComponent)
      Sets prefix component of the item.
      Parameters:
      prefixComponent - component to set
    • isMenu

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

      public boolean isSeparator()
    • 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
    • addPropertyChangeListener

      protected void addPropertyChangeListener(PropertyChangeListener listener)
    • removePropertyChangeListener

      protected void removePropertyChangeListener(PropertyChangeListener listener)
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object