Class GridContextMenu<T>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.contextmenu.ContextMenuBase<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>
io.jmix.groupgridflowui.kit.vaadin.grid.contextmenu.GridContextMenu<T>
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasStyle,Serializable
- Direct Known Subclasses:
JmixGroupGridContextMenu
public class GridContextMenu<T>
extends com.vaadin.flow.component.contextmenu.ContextMenuBase<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>
Server-side component for
<vaadin-context-menu> to be used with
Grid.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEvent that is fired when aGridMenuItemis clicked inside aGridContextMenu.static classNested classes/interfaces inherited from class com.vaadin.flow.component.contextmenu.ContextMenuBase
com.vaadin.flow.component.contextmenu.ContextMenuBase.OpenedChangeEvent<TComponent extends com.vaadin.flow.component.contextmenu.ContextMenuBase<TComponent,?, ?>> -
Field Summary
Fields inherited from class com.vaadin.flow.component.contextmenu.ContextMenuBase
EVENT_DETAIL -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty context menu to be used with a Grid.GridContextMenu(Grid<T> target) Creates an empty context menu with the given target component. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddGridContextMenuOpenedListener(com.vaadin.flow.component.ComponentEventListener<GridContextMenu.GridContextMenuOpenedEvent<T>> listener) Adds a listener for theopened-changedevents fired by the web component.addItem(com.vaadin.flow.component.Component component, com.vaadin.flow.component.ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener) addItem(String text, com.vaadin.flow.component.ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener) protected com.vaadin.flow.component.contextmenu.MenuManager<GridContextMenu<T>,GridMenuItem<T>, GridSubMenu<T>> createMenuManager(com.vaadin.flow.function.SerializableRunnable contentReset) com.vaadin.flow.function.SerializablePredicate<T>Gets the callback function that is executed before the context menu is opened.protected booleanonBeforeOpenMenu(elemental.json.JsonObject eventDetail) voidsetDynamicContentHandler(com.vaadin.flow.function.SerializablePredicate<T> dynamicContentHandler) Sets a callback that is executed before the context menu is opened.voidsetTarget(com.vaadin.flow.component.Component target) Methods inherited from class com.vaadin.flow.component.contextmenu.ContextMenuBase
add, add, add, addComponent, addComponent, addComponentAsFirst, addComponentAtIndex, addItem, addItem, addOpenedChangeListener, addSeparator, close, getChildren, getItems, getMenuManager, getTarget, isOpened, isOpenOnClick, remove, removeAll, setOpenOnClickMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasComponents
removeMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
GridContextMenu
public GridContextMenu()Creates an empty context menu to be used with a Grid. -
GridContextMenu
Creates an empty context menu with the given target component.- Parameters:
target- the target component for this context menu- See Also:
-
-
Method Details
-
setTarget
public void setTarget(com.vaadin.flow.component.Component target) - Overrides:
setTargetin classcom.vaadin.flow.component.contextmenu.ContextMenuBase<GridContextMenu<T>,GridMenuItem<T>, GridSubMenu<T>> - Throws:
IllegalArgumentException- if the given target is not an instance ofGrid
-
addItem
public GridMenuItem<T> addItem(String text, com.vaadin.flow.component.ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener) -
addItem
public GridMenuItem<T> addItem(com.vaadin.flow.component.Component component, com.vaadin.flow.component.ComponentEventListener<GridContextMenu.GridContextMenuItemClickEvent<T>> clickListener) -
createMenuManager
protected com.vaadin.flow.component.contextmenu.MenuManager<GridContextMenu<T>,GridMenuItem<T>, createMenuManagerGridSubMenu<T>> (com.vaadin.flow.function.SerializableRunnable contentReset) - Specified by:
createMenuManagerin classcom.vaadin.flow.component.contextmenu.ContextMenuBase<GridContextMenu<T>,GridMenuItem<T>, GridSubMenu<T>>
-
addGridContextMenuOpenedListener
public com.vaadin.flow.shared.Registration addGridContextMenuOpenedListener(com.vaadin.flow.component.ComponentEventListener<GridContextMenu.GridContextMenuOpenedEvent<T>> listener) Adds a listener for theopened-changedevents fired by the web component.- Parameters:
listener- the listener to add- Returns:
- a Registration for removing the event listener
-
getDynamicContentHandler
Gets the callback function that is executed before the context menu is opened.The dynamic context handler allows for customizing the contents of the context menu before it is open.
- Returns:
- the callback function that is executed before opening the context
menu, or
nullif not specified.
-
setDynamicContentHandler
public void setDynamicContentHandler(com.vaadin.flow.function.SerializablePredicate<T> dynamicContentHandler) Sets a callback that is executed before the context menu is opened.This callback receives the clicked item (if any) as an input parameter and further can dynamically modify the contents of the context menu. This is useful in situations where the context menu items cannot be known in advance and depend on the specific context (i.e. clicked row) and thus can be configured dynamically. The boolean return value of this callback specifies if the context menu will be opened.
- Parameters:
dynamicContentHandler- the callback function that will be executed before opening the context menu.
-
onBeforeOpenMenu
protected boolean onBeforeOpenMenu(elemental.json.JsonObject eventDetail) - Overrides:
onBeforeOpenMenuin classcom.vaadin.flow.component.contextmenu.ContextMenuBase<GridContextMenu<T>,GridMenuItem<T>, GridSubMenu<T>>
-