public class GridContextMenu<T> extends ContextMenuBase<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<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
GridMenuItem is clicked inside a
GridContextMenu. |
static class |
GridContextMenu.GridContextMenuOpenedEvent<T> |
GeneratedVaadinContextMenu.OpenedChangeEvent<R extends GeneratedVaadinContextMenu<R>>| 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 |
|---|---|
Registration |
addGridContextMenuOpenedListener(ComponentEventListener<GridContextMenu.GridContextMenuOpenedEvent<T>> listener)
Adds a listener for the
opened-changed events fired by the web
component. |
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(SerializableRunnable contentReset)
Creates a menu manager instance which contains logic to control the menu
content.
|
void |
setTarget(Component target)
Sets the target component for this context menu.
|
add, addComponentAtIndex, addItem, addItem, addOpenedChangeListener, close, getChildren, getItems, getMenuManager, getTarget, isOpened, isOpenOnClick, remove, removeAll, setOpenOnClickgetCloseOnString, getListenOnJsonObject, getOpenOnString, getSelectorString, isOpenedBoolean, open, setCloseOn, setListenOn, setOpenOn, setSelectoraddListener, fireEvent, from, get, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, addComponentAsFirstisEnabled, setEnabledgetElementaddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameaddClickListener, addClickShortcutaddAttachListeneraddDetachListenerpublic GridContextMenu()
public GridContextMenu(Grid<T> target)
target - the target component for this context menusetTarget(Component)public void setTarget(Component target)
By default, the context menu can be opened with a right click or a long touch on the target component.
setTarget in class ContextMenuBase<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>target - the target component for this context menu, can be
null to remove the targetIllegalArgumentException - if the given target is not an instance of Gridpublic GridMenuItem<T> addItem(String text, ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener)
This is a convenience method for the use case where you have a list of
highlightable GridMenuItems inside the overlay. If you want to
configure the contents of the overlay without wrapping them inside
GridMenuItems, 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 listenerGridMenuItem componentaddItem(Component, ComponentEventListener),
ContextMenuBase.add(Component...),
SubMenuBase.add(Component...)public GridMenuItem<T> addItem(Component component, ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener)
This is a convenience method for the use case where you have a list of
highlightable GridMenuItems inside the overlay. If you want to
configure the contents of the overlay without wrapping them inside
GridMenuItems, 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 listenerGridMenuItem componentaddItem(String, ComponentEventListener),
ContextMenuBase.add(Component...),
SubMenuBase.add(Component...)protected MenuManager<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>> createMenuManager(SerializableRunnable contentReset)
ContextMenuBasecreateMenuManager in class ContextMenuBase<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>public Registration addGridContextMenuOpenedListener(ComponentEventListener<GridContextMenu.GridContextMenuOpenedEvent<T>> listener)
opened-changed events fired by the web
component.listener - the listener to addCopyright © 2019. All rights reserved.