com.vaadin.flow.component.contextmenu.
Interface HasMenuItems
-
All Superinterfaces:
All Known Implementing Classes:
public interface HasMenuItems extends Serializable
A common interface for components that can have
MenuItem
s with click listeners inside them.Author:
Vaadin Ltd.
See Also:
-
-
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.
-
-
-
Method Detail
-
addItem
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.
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.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:
addItem(Component, ComponentEventListener)
,ContextMenuBase.add(Component...)
,SubMenuBase.add(Component...)
-
addItem
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.
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.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:
addItem(String, ComponentEventListener)
,ContextMenuBase.add(Component...)
,SubMenuBase.add(Component...)
-
-