com.vaadin.flow.component.contextmenu.
Class SubMenu
- java.lang.Object
-
- com.vaadin.flow.component.contextmenu.SubMenuBase<ContextMenu,MenuItem,SubMenu>
-
- com.vaadin.flow.component.contextmenu.SubMenu
-
All Implemented Interfaces:
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 callingMenuItemBase.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 Constructor Description SubMenu(MenuItem parentMenuItem, SerializableRunnable contentReset)
-
Method Summary
All Methods Modifier and Type Method Description MenuItem
addItem(Component component, ComponentEventListener<ClickEvent<MenuItem>> clickListener)
Adds a new item component with the given component and click listener to the context menu overlay.
MenuItem
addItem(String text, ComponentEventListener<ClickEvent<MenuItem>> clickListener)
Adds a new item component with the given text content and click listener to the context menu overlay.
protected MenuManager<ContextMenu,MenuItem,SubMenu>
createMenuManager()
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
add, addComponentAtIndex, addItem, addItem, getChildren, getItems, getMenuManager, getParentMenuItem, remove, removeAll
-
-
-
-
Constructor Detail
-
SubMenu
public SubMenu(MenuItem parentMenuItem, SerializableRunnable contentReset)
-
-
Method Detail
-
addItem
public MenuItem addItem(String text, ComponentEventListener<ClickEvent<MenuItem>> clickListener)
Description copied from interface:
HasMenuItems
Adds a new item component with the given text content and click listener to the context menu overlay.
This is a convenience method for the use case where you have a list of highlightable
MenuItem
s inside the overlay. If you want to configure the contents of the overlay without wrapping them insideMenuItem
s, or if you just want to add some non-highlightable components between the items, use theContextMenuBase.add(Component...)
method.Specified by:
addItem
in interfaceHasMenuItems
Parameters:
text
- the text content for the new itemclickListener
- the handler for clicking the new item, can benull
to not add listenerReturns:
the added
MenuItem
componentSee Also:
HasMenuItems.addItem(Component, ComponentEventListener)
,ContextMenuBase.add(Component...)
,SubMenuBase.add(Component...)
-
addItem
public MenuItem addItem(Component component, ComponentEventListener<ClickEvent<MenuItem>> clickListener)
Description copied from interface:
HasMenuItems
Adds a new item component with the given component and click listener to the context menu overlay.
This is a convenience method for the use case where you have a list of highlightable
MenuItem
s inside the overlay. If you want to configure the contents of the overlay without wrapping them insideMenuItem
s, or if you just want to add some non-highlightable components between the items, use theContextMenuBase.add(Component...)
method.Specified by:
addItem
in interfaceHasMenuItems
Parameters:
component
- the component inside the new itemclickListener
- the handler for clicking the new item, can benull
to not add listenerReturns:
the added
MenuItem
componentSee Also:
HasMenuItems.addItem(String, ComponentEventListener)
,ContextMenuBase.add(Component...)
,SubMenuBase.add(Component...)
-
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 classSubMenuBase<ContextMenu,MenuItem,SubMenu>
Returns:
a new menu manager instance
-
-