Class MenuItem

java.lang.Object
io.jmix.flowui.menu.MenuItem

public class MenuItem extends Object
Main menu item descriptor.
  • Field Details

    • parent

      protected MenuItem parent
    • children

      protected List<MenuItem> children
    • id

      protected String id
    • view

      protected String view
    • bean

      protected String bean
    • beanMethod

      protected String beanMethod
    • classNames

      protected String classNames
    • icon

      protected com.vaadin.flow.component.Component icon
    • iconName

      protected String iconName
    • title

      protected String title
    • description

      protected String description
    • descriptor

      protected org.dom4j.Element descriptor
    • separator

      protected boolean separator
    • opened

      protected boolean opened
    • visible

      protected boolean visible
    • shortcutCombination

      protected KeyCombination shortcutCombination
    • isMenu

      protected boolean isMenu
    • properties

      protected List<MenuItem.MenuItemProperty> properties
    • urlQueryParameters

      protected List<MenuItem.MenuItemParameter> urlQueryParameters
    • routeParameters

      protected List<MenuItem.MenuItemParameter> routeParameters
  • Constructor Details

    • MenuItem

      public MenuItem(@Nullable MenuItem parent, String id)
    • MenuItem

      public MenuItem(String id)
  • Method Details

    • isMenu

      public boolean isMenu()
      Returns whether the menu item represents a menu that contains other menu items.
      Returns:
      true if the menu item is a menu; false otherwise.
    • setMenu

      public void setMenu(boolean isMenu)
      Sets whether this menu item represents a menu that contains other menu items.
      Parameters:
      isMenu - true if the menu item is a menu; false otherwise
    • getParent

      @Nullable public MenuItem getParent()
      Parent item. Null if this is root item.
    • getChildren

      public List<MenuItem> getChildren()
      Children items
    • getId

      public String getId()
      Menu item ID as defined in menu-config.xml
    • getDescriptor

      public org.dom4j.Element getDescriptor()
      Returns the descriptor of this menu item.
      Returns:
      the Element representing the descriptor
    • setDescriptor

      public void setDescriptor(org.dom4j.Element descriptor)
      Sets the descriptor of this menu item.
      Parameters:
      descriptor - the Element representing the descriptor
    • getTitle

      public String getTitle()
      Returns:
      a raw string from menu XML config, can be a reference to localization message, e.g. mainMsg://menuitem.title
      See Also:
    • setTitle

      public void setTitle(String caption)
      Sets the given caption to menu item.
      Parameters:
      caption - menu item caption
      See Also:
    • getDescription

      public String getDescription()
      Returns:
      a raw string from menu XML config, can be a reference to localization message, e.g. mainMsg://menuitem.description
    • setDescription

      public void setDescription(String description)
      Sets the given description to menu item.
      Parameters:
      description - menu item description
    • getClassNames

      public String getClassNames()
      Returns the CSS class names associated with this menu item.
      Returns:
      a string containing the CSS class names
    • setClassNames

      public void setClassNames(String classNames)
      Sets the CSS class names associated with this menu item.
      Parameters:
      classNames - a string containing the CSS class names to be set for this menu item
    • getShortcutCombination

      @Nullable public KeyCombination getShortcutCombination()
      Returns the keyboard shortcut combination associated with this menu item.
      Returns:
      the KeyCombination representing the shortcut combination, or null if no shortcut is defined
    • setShortcutCombination

      public void setShortcutCombination(@Nullable KeyCombination shortcutCombination)
      Sets the keyboard shortcut combination associated with this menu item.
      Parameters:
      shortcutCombination - the KeyCombination representing the shortcut combination, or null if no shortcut is to be defined
    • isSeparator

      public boolean isSeparator()
      Returns whether the menu item is a separator.
      Returns:
      true if the menu item is a separator; false otherwise.
    • setSeparator

      public void setSeparator(boolean separator)
      Sets whether this menu item is a separator.
      Parameters:
      separator - true if the menu item is a separator; false otherwise
    • getIcon

      @Deprecated(since="2.8", forRemoval=true) @Nullable public String getIcon()
      Deprecated, for removal: This API element is subject to removal in a future version.
      use getIconComponent() instead
      Returns the icon associated with this menu item.
      Returns:
      the icon as a string, or null if no icon is associated
    • setIcon

      @Deprecated(since="2.8", forRemoval=true) public void setIcon(@Nullable String iconName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the icon associated with this menu item.
      Parameters:
      iconName - the icon to associate with the menu item, or null if no icon is to be set
    • getIconComponent

      @Nullable public com.vaadin.flow.component.Component getIconComponent()
    • setIconComponent

      public void setIconComponent(@Nullable com.vaadin.flow.component.Component icon)
    • isOpened

      public boolean isOpened()
      Returns whether this menu item is currently in an expanded (opened) state.
      Returns:
      true if the menu item is opened; false otherwise.
    • setOpened

      public void setOpened(boolean expanded)
      Sets whether this menu item is currently in an expanded (opened) state.
      Parameters:
      expanded - true if the menu item is to be opened; false otherwise
    • isVisible

      public boolean isVisible()
      Returns whether this menu item is visible.
      Returns:
      true if the menu item is visible; false otherwise
    • setVisible

      public void setVisible(boolean visible)
      Sets whether this menu item is visible.
      Parameters:
      visible - true if the menu item is to be visible; false otherwise
    • getView

      @Nullable public String getView()
      Returns the view id associated with this menu item.
      Returns:
      the view id, or null if no view is associated
    • setView

      public void setView(@Nullable String view)
      Sets the view ID associated with this menu item.
      Parameters:
      view - the view ID to associate with this menu item, or null if no view is to be associated
    • getBean

      @Nullable public String getBean()
      Returns the bean name associated with this menu item.
      Returns:
      the bean name, or null if no bean is associated
    • setBean

      public void setBean(@Nullable String bean)
      Sets the bean name associated with this menu item.
      Parameters:
      bean - the bean name to associate with this menu item, or null if no bean is to be associated
    • getBeanMethod

      @Nullable public String getBeanMethod()
      Returns the bean method name associated with this menu item.
      Returns:
      the bean method name, or null if no bean method is associated
    • setBeanMethod

      public void setBeanMethod(@Nullable String beanMethod)
      Sets the bean method name associated with this menu item.
      Parameters:
      beanMethod - the bean method name to associate with this menu item, or null if no bean method is to be associated
    • getProperties

      public List<MenuItem.MenuItemProperty> getProperties()
      Returns the list of properties associated with this menu item.
      Returns:
      the list of MenuItem.MenuItemProperty objects
    • setProperties

      public void setProperties(List<MenuItem.MenuItemProperty> properties)
      Sets the list of properties associated with this menu item.
      Parameters:
      properties - the list of MenuItem.MenuItemProperty objects to associate with this menu item, or null if no properties are to be set
    • getUrlQueryParameters

      public List<MenuItem.MenuItemParameter> getUrlQueryParameters()
      Returns the list of URL query parameters associated with this menu item. If no parameters are associated, an empty list is returned.
      Returns:
      a list of MenuItem.MenuItemParameter objects representing the URL query parameters
    • setUrlQueryParameters

      public void setUrlQueryParameters(List<MenuItem.MenuItemParameter> urlQueryParameters)
      Sets the list of URL query parameters associated with this menu item.
      Parameters:
      urlQueryParameters - a list of MenuItem.MenuItemParameter objects representing the URL query parameters to associate with this menu item
    • getRouteParameters

      public List<MenuItem.MenuItemParameter> getRouteParameters()
      Returns the list of route parameters associated with this menu item. If no parameters are associated, an empty list is returned.
      Returns:
      a list of MenuItem.MenuItemParameter objects representing the route parameters
    • setRouteParameters

      public void setRouteParameters(List<MenuItem.MenuItemParameter> routeParameters)
      Sets the list of route parameters associated with this menu item.
      Parameters:
      routeParameters - a list of MenuItem.MenuItemParameter objects representing the route parameters to associate with this menu item