Class SubMenu
java.lang.Object
com.vaadin.flow.component.contextmenu.SubMenuBase<ContextMenu,MenuItem,SubMenu>
com.vaadin.flow.component.contextmenu.SubMenu
- All Implemented Interfaces:
HasMenuItems,Serializable
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddItem(com.vaadin.flow.component.Component component, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener) Creates a new menu item with the given component content and click listener and adds it to the context menu overlay.Creates a newMenuItemcomponent with the given tooltip text and adds it to this sub menu.addItem(com.vaadin.flow.component.Component component, String tooltipText, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener) Creates a newMenuItemcomponent with the given tooltip text and click listener and adds it to this sub menu.addItem(String text, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener) Creates a new menu item with the given text content and click listener and adds it to the context menu overlay.Creates a newMenuItemcomponent with the given text content and tooltip text and adds it to this sub menu.addItem(String text, String tooltipText, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener) Creates a newMenuItemcomponent with the given text content, tooltip text and click listener and adds it to this sub menu.protected MenuManager<ContextMenu, MenuItem, SubMenu> Creates a (sub) menu manager instance which contains logic to control the (sub) menu content.Methods inherited from class com.vaadin.flow.component.contextmenu.SubMenuBase
addComponent, addComponentAtIndex, addItem, addItem, addSeparator, getChildren, getItems, getMenuManager, getParentMenuItem, remove, removeAll
-
Constructor Details
-
Method Details
-
addItem
public MenuItem addItem(String text, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener) Description copied from interface:HasMenuItemsCreates a new menu item with the given text content and click listener and adds it to the context menu overlay.- Specified by:
addItemin interfaceHasMenuItems- Parameters:
text- the text content for the new itemclickListener- the handler for clicking the new item, can benullto not add listener- Returns:
- the added
MenuItemcomponent - 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:HasMenuItemsCreates a new menu item with the given component content and click listener and adds it to the context menu overlay.- Specified by:
addItemin interfaceHasMenuItems- Parameters:
component- the component inside the new itemclickListener- the handler for clicking the new item, can benullto not add listener- Returns:
- the added
MenuItemcomponent - See Also:
-
addItem
Creates a newMenuItemcomponent with the given text content and tooltip text and adds it to this sub menu.- Parameters:
text- the text content for the new itemtooltipText- the tooltip text for the new item- Returns:
- the added
MenuItemcomponent
-
addItem
Creates a newMenuItemcomponent with the given tooltip text and adds it to this sub menu. The provided component is added into the createdMenuItem.- Parameters:
component- the component to add inside the new itemtooltipText- the tooltip text for the new item- Returns:
- the added
MenuItemcomponent
-
addItem
public MenuItem addItem(String text, String tooltipText, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener) Creates a newMenuItemcomponent with the given text content, tooltip text and click listener and adds it to this sub menu.- Parameters:
text- the text content for the new itemtooltipText- the tooltip text for the new itemclickListener- the handler for clicking the new item, can benullto not add listener- Returns:
- the added
MenuItemcomponent
-
addItem
public MenuItem addItem(com.vaadin.flow.component.Component component, String tooltipText, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener) Creates a newMenuItemcomponent with the given tooltip text and click listener and adds it to this sub menu. The provided component is added into the createdMenuItem.- Parameters:
component- the component to add inside the new itemtooltipText- the tooltip text for the new itemclickListener- the handler for clicking the new item, can benullto not add listener- Returns:
- the added
MenuItemcomponent
-
createMenuManager
Description copied from class:SubMenuBaseCreates a (sub) menu manager instance which contains logic to control the (sub) menu content.- Specified by:
createMenuManagerin classSubMenuBase<ContextMenu,MenuItem, SubMenu> - Returns:
- a new menu manager instance
-