com.vaadin.flow.component.contextmenu.
Class ContextMenu
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.contextmenu.GeneratedVaadinContextMenu<C>
-
- com.vaadin.flow.component.contextmenu.ContextMenuBase<ContextMenu,MenuItem,SubMenu>
-
- com.vaadin.flow.component.contextmenu.ContextMenu
-
All Implemented Interfaces:
AttachNotifier, ClickNotifier<ContextMenu>, HasMenuItems, DetachNotifier, HasComponents, HasElement, HasEnabled, HasStyle, Serializable
public class ContextMenu extends ContextMenuBase<ContextMenu,MenuItem,SubMenu> implements HasMenuItems
Server-side component for
<vaadin-context-menu>
.Author:
Vaadin Ltd.
See Also:
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.flow.component.contextmenu.GeneratedVaadinContextMenu
GeneratedVaadinContextMenu.OpenedChangeEvent<R extends GeneratedVaadinContextMenu<R>>
-
-
Field Summary
-
Fields inherited from class com.vaadin.flow.component.contextmenu.ContextMenuBase
EVENT_DETAIL
-
-
Constructor Summary
Constructors Constructor and Description ContextMenu()
Creates an empty context menu.
ContextMenu(Component target)
Creates an empty context menu with the given target component.
-
Method Summary
All Methods Modifier and Type Method and 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.
protected MenuManager<ContextMenu,MenuItem,SubMenu>
createMenuManager(SerializableRunnable contentReset)
Creates a menu manager instance which contains logic to control the menu content.
-
Methods inherited from class com.vaadin.flow.component.contextmenu.ContextMenuBase
add, addComponentAtIndex, addItem, addItem, addOpenedChangeListener, close, getChildren, getItems, getMenuManager, getTarget, isOpened, isOpenOnClick, onBeforeOpenMenu, remove, removeAll, setOpenOnClick, setTarget
-
Methods inherited from class com.vaadin.flow.component.contextmenu.GeneratedVaadinContextMenu
getCloseOnString, getListenOnJsonObject, getOpenOnString, getSelectorString, isOpenedBoolean, open, setCloseOn, setListenOn, setOpenOn, setSelector
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.component.HasComponents
add, addComponentAsFirst
-
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
-
-
-
Constructor Detail
-
ContextMenu
public ContextMenu()
Creates an empty context menu.
-
ContextMenu
public ContextMenu(Component target)
Creates an empty context menu with the given target component.
Parameters:
target
- the target component for this context menuSee Also:
-
-
Method Detail
-
addItem
public MenuItem addItem(String text, ComponentEventListener<ClickEvent<MenuItem>> clickListener)
Description copied from interface:
HasMenuItems
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.Specified by:
addItem
in interfaceHasMenuItems
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:
HasMenuItems.addItem(Component, ComponentEventListener)
,ContextMenuBase.add(Component...)
,SubMenuBase.add(Component...)
-
addItem
public MenuItem addItem(Component component, ComponentEventListener<ClickEvent<MenuItem>> clickListener)
Description copied from interface:
HasMenuItems
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.Specified by:
addItem
in interfaceHasMenuItems
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:
HasMenuItems.addItem(String, ComponentEventListener)
,ContextMenuBase.add(Component...)
,SubMenuBase.add(Component...)
-
createMenuManager
protected MenuManager<ContextMenu,MenuItem,SubMenu> createMenuManager(SerializableRunnable contentReset)
Description copied from class:
ContextMenuBase
Creates a menu manager instance which contains logic to control the menu content.
Specified by:
createMenuManager
in classContextMenuBase<ContextMenu,MenuItem,SubMenu>
Parameters:
contentReset
- callback to reset the menu contentReturns:
a new menu manager instance
-
-