public class GridContextMenu<T> extends com.vaadin.flow.component.contextmenu.ContextMenuBase<GridContextMenu<T>>
<vaadin-context-menu>
to be used with
Grid
.Modifier and Type | Class and Description |
---|---|
static class |
GridContextMenu.GridContextMenuItemClickEvent<T>
Event that is fired when a
MenuItem is clicked inside a
GridContextMenu . |
Constructor and Description |
---|
GridContextMenu()
Creates an empty context menu to be used with a Grid.
|
GridContextMenu(Grid<T> target)
Creates an empty context menu with the given target component.
|
Modifier and Type | Method and Description |
---|---|
com.vaadin.flow.component.contextmenu.MenuItem |
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.
|
com.vaadin.flow.component.contextmenu.MenuItem |
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.
|
void |
setTarget(Component target) |
add, addComponentAtIndex, addItem, addItem, addOpenedChangeListener, close, getChildren, getItems, getTarget, isOpened, isOpenOnClick, remove, removeAll, setOpenOnClick
getCloseOnString, getListenOnJsonObject, getOpenOnString, getSelectorString, isOpenedBoolean, open, setCloseOn, setListenOn, setOpenOn, setSelector
addListener, fireEvent, from, get, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addComponentAsFirst
isEnabled, setEnabled
getElement
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
addClickListener
addAttachListener
addDetachListener
public GridContextMenu()
public GridContextMenu(Grid<T> target)
target
- the target component for this context menusetTarget(Component)
public void setTarget(Component target)
setTarget
in class com.vaadin.flow.component.contextmenu.ContextMenuBase<GridContextMenu<T>>
IllegalArgumentException
- if the given target is not an instance of Grid
public com.vaadin.flow.component.contextmenu.MenuItem addItem(String text, ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener)
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 inside
MenuItem
s, or if you just want to add some non-highlightable
components between the items, use the ContextMenuBase.add(Component...)
method.
text
- the text content for the new itemclickListener
- the handler for clicking the new item, can be null
to
not add listenerMenuItem
componentaddItem(Component, ComponentEventListener)
,
ContextMenuBase.add(Component...)
public com.vaadin.flow.component.contextmenu.MenuItem addItem(Component component, ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener)
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 inside
MenuItem
s, or if you just want to add some non-highlightable
components between the items, use the ContextMenuBase.add(Component...)
method.
component
- the component inside the new itemclickListener
- the handler for clicking the new item, can be null
to
not add listenerMenuItem
componentaddItem(String, ComponentEventListener)
,
ContextMenuBase.add(Component...)
Copyright © 2018. All rights reserved.