Interface SideMenu.MenuItem

All Known Implementing Classes:
SideMenuImpl.MenuItemImpl
Enclosing interface:
SideMenu

public static interface SideMenu.MenuItem
Menu item
  • Method Details

    • getId

      String getId()
      Returns:
      id
    • getMenu

      SideMenu getMenu()
      Returns:
      owner
    • getCaption

      @Nullable String getCaption()
      Returns:
      caption
    • setCaption

      void setCaption(@Nullable String caption)
      Set item caption.
      Parameters:
      caption - caption
    • getDescription

      @Nullable String getDescription()
      Returns:
      description
    • setDescription

      void setDescription(@Nullable String description)
      Set description.
      Parameters:
      description - description
    • getIcon

      @Nullable String getIcon()
      Returns:
      icon name
    • setIcon

      void setIcon(@Nullable String icon)
      Set icon.
      Parameters:
      icon - icon name
    • isCaptionAsHtml

      boolean isCaptionAsHtml()
      Returns:
      true if caption is inserted to DOM as HTML
    • setCaptionAsHtml

      void setCaptionAsHtml(boolean captionAsHtml)
      Enable or disable HTML mode for caption.
      Parameters:
      captionAsHtml - pass true to enable HTML mode for caption.
    • isVisible

      boolean isVisible()
      Returns:
      true if item will be sent to the client side
    • setVisible

      void setVisible(boolean visible)
      Show or hide item.
      Parameters:
      visible - pass false to hide menu item
    • isExpanded

      boolean isExpanded()
      Returns:
      true if sub menu with children will be initially expanded
    • setExpanded

      void setExpanded(boolean expanded)
      Expand or collapse sub menu with children by default.
      Parameters:
      expanded - pass true to set sub menu expanded by default.
    • getStyleName

      String getStyleName()
      Returns:
      all user-defined CSS style names of a component. If the item has multiple style names defined, the return string is a space-separated list of style names.
    • setStyleName

      void setStyleName(@Nullable String styleName)
      Sets one or more user-defined style names of the component, replacing any previous user-defined styles. Multiple styles can be specified as a space-separated list of style names. The style names must be valid CSS class names.
      Parameters:
      styleName - style name string
    • addStyleName

      void addStyleName(String styleName)
      Adds one or more style names to this component. Multiple styles can be specified as a space-separated list of style names. The style name will be rendered as a HTML class name, which can be used in a CSS definition.
      Parameters:
      styleName - style name string
    • removeStyleName

      void removeStyleName(String styleName)
      Removes one or more style names from component. Multiple styles can be specified as a space-separated list of style names.
      Parameters:
      styleName - style name string
    • getBadgeText

      @Nullable String getBadgeText()
      Returns:
      badge text
    • setBadgeText

      void setBadgeText(@Nullable String badgeText)
      Set badge text for item. Badges are shown as small widget on the right side of menu items.
      Parameters:
      badgeText - badge text
    • getCommand

      @Nullable Consumer<SideMenu.MenuItem> getCommand()
      Returns:
      item command
    • setCommand

      void setCommand(@Nullable Consumer<SideMenu.MenuItem> command)
      Set item command
      Parameters:
      command - item command
    • addChildItem

      void addChildItem(SideMenu.MenuItem menuItem)
      Add menu item to the end of children list.
      Parameters:
      menuItem - menu item
    • addChildItem

      void addChildItem(SideMenu.MenuItem menuItem, int index)
      Add menu item to specified position in the children list.
      Parameters:
      menuItem - menu item
      index - target index
    • removeChildItem

      void removeChildItem(SideMenu.MenuItem menuItem)
      Remove menu item from the children list.
      Parameters:
      menuItem - menu item
    • removeChildItem

      void removeChildItem(int index)
      Remove menu item from the children list by index.
      Parameters:
      index - index
    • removeAllChildItems

      void removeAllChildItems()
      Remove all child items from the children list.
    • getChildren

      List<SideMenu.MenuItem> getChildren()
      Returns:
      child items
    • hasChildren

      boolean hasChildren()
      Returns:
      true if the menu item has child items
    • getParent

      @Nullable SideMenu.MenuItem getParent()
      Returns:
      parent menu item if it's nested item, null otherwise
    • getParentNN

      SideMenu.MenuItem getParentNN()
      Returns:
      parent menu item if it's nested item, null otherwise
      Throws:
      IllegalArgumentException - if not found