com.vaadin.flow.component.grid.contextmenu.
Class GridSubMenu<T>
- java.lang.Object
-
- com.vaadin.flow.component.contextmenu.SubMenuBase<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>
-
- com.vaadin.flow.component.grid.contextmenu.GridSubMenu<T>
-
All Implemented Interfaces:
public class GridSubMenu<T> extends SubMenuBase<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>
API that allows adding content into the sub menus of a
GridContextMenu
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 and Description GridSubMenu(GridMenuItem<T> parentMenuItem, SerializableRunnable contentReset)
Creates a new instance of submenu using the associated
parentMenuItem
(item which opens the submenu) and reset context menu callback.
-
Method Summary
All Methods Modifier and Type Method and Description GridMenuItem<T>
addItem(Component component, ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener)
Adds a new item component with the given component and click listener to the context menu overlay.
GridMenuItem<T>
addItem(String text, ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener)
Adds a new item component with the given text content and click listener to the context menu overlay.
protected MenuManager<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>
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
-
GridSubMenu
public GridSubMenu(GridMenuItem<T> parentMenuItem, SerializableRunnable contentReset)
Creates a new instance of submenu using the associated
parentMenuItem
(item which opens the submenu) and reset context menu callback.Parameters:
parentMenuItem
- the associated menu item, notnull
contentReset
- the context menu reset callback, notnull
-
-
Method Detail
-
addItem
public GridMenuItem<T> addItem(String text, ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener)
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
GridMenuItem
s inside the overlay. If you want to configure the contents of the overlay without wrapping them insideGridMenuItem
s, or if you just want to add some non-highlightable components between the items, use theContextMenuBase.add(Component...)
method.Parameters:
text
- the text content for the new itemclickListener
- the handler for clicking the new item, can benull
to not add listenerReturns:
the added
GridMenuItem
componentSee Also:
addItem(Component, ComponentEventListener)
,ContextMenuBase.add(Component...)
,SubMenuBase.add(Component...)
-
addItem
public GridMenuItem<T> addItem(Component component, ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener)
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
GridMenuItem
s inside the overlay. If you want to configure the contents of the overlay without wrapping them insideGridMenuItem
s, or if you just want to add some non-highlightable components between the items, use theContextMenuBase.add(Component...)
method.Parameters:
component
- the component inside the new itemclickListener
- the handler for clicking the new item, can benull
to not add listenerReturns:
the added
GridMenuItem
componentSee Also:
addItem(String, ComponentEventListener)
,ContextMenuBase.add(Component...)
,SubMenuBase.add(Component...)
-
createMenuManager
protected MenuManager<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>> 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<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>
Returns:
a new menu manager instance
-
-