Class SubMenu

All Implemented Interfaces:
HasMenuItems, Serializable

public class SubMenu extends SubMenuBase<ContextMenu,MenuItem,SubMenu> implements HasMenuItems
API that allows adding content into the sub menus of a ContextMenu to create hierarchical menus. Get it by calling MenuItemBase.getSubMenu() on the item component that should open the sub menu. Sub menu will be rendered only if content has been added inside it.
Author:
Vaadin Ltd.
See Also:
  • Constructor Details

    • SubMenu

      public SubMenu(MenuItem parentMenuItem, com.vaadin.flow.function.SerializableRunnable contentReset)
  • Method Details

    • addItem

      public MenuItem addItem(String text, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener)
      Description copied from interface: HasMenuItems
      Creates a new menu item with the given text content and click listener and adds it to the context menu overlay.
      Specified by:
      addItem in interface HasMenuItems
      Parameters:
      text - the text content for the new item
      clickListener - the handler for clicking the new item, can be null to not add listener
      Returns:
      the added MenuItem component
      See Also:
    • addItem

      public MenuItem addItem(com.vaadin.flow.component.Component component, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener)
      Description copied from interface: HasMenuItems
      Creates a new menu item with the given component content and click listener and adds it to the context menu overlay.
      Specified by:
      addItem in interface HasMenuItems
      Parameters:
      component - the component inside the new item
      clickListener - the handler for clicking the new item, can be null to not add listener
      Returns:
      the added MenuItem component
      See Also:
    • createMenuManager

      protected MenuManager<ContextMenu,MenuItem,SubMenu> createMenuManager()
      Description copied from class: SubMenuBase
      Creates a (sub) menu manager instance which contains logic to control the (sub) menu content.
      Specified by:
      createMenuManager in class SubMenuBase<ContextMenu,MenuItem,SubMenu>
      Returns:
      a new menu manager instance