public class ContextMenu extends ContextMenuBase<ContextMenu,MenuItem,SubMenu> implements HasMenuItems
<vaadin-context-menu>
.GeneratedVaadinContextMenu.OpenedChangeEvent<R extends GeneratedVaadinContextMenu<R>>
EVENT_DETAIL
Constructor and Description |
---|
ContextMenu()
Creates an empty context menu.
|
ContextMenu(Component target)
Creates an empty context menu with the given target component.
|
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.
|
add, addComponentAtIndex, addItem, addItem, addOpenedChangeListener, close, getChildren, getItems, getMenuManager, getTarget, isOpened, isOpenOnClick, onBeforeOpenMenu, remove, removeAll, setOpenOnClick, setTarget
getCloseOnString, getListenOnJsonObject, getOpenOnString, getSelectorString, isOpenedBoolean, open, setCloseOn, setListenOn, setOpenOn, setSelector
addListener, fireEvent, from, get, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, addComponentAsFirst
isEnabled, setEnabled
getElement
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
addClickListener, addClickShortcut
addAttachListener
addDetachListener
public ContextMenu()
public ContextMenu(Component target)
target
- the target component for this context menuContextMenuBase.setTarget(Component)
public MenuItem addItem(String text, ComponentEventListener<ClickEvent<MenuItem>> clickListener)
HasMenuItems
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.
addItem
in interface HasMenuItems
text
- the text content for the new itemclickListener
- the handler for clicking the new item, can be null
to
not add listenerMenuItem
componentHasMenuItems.addItem(Component, ComponentEventListener)
,
ContextMenuBase.add(Component...)
,
SubMenuBase.add(Component...)
public MenuItem addItem(Component component, ComponentEventListener<ClickEvent<MenuItem>> clickListener)
HasMenuItems
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.
addItem
in interface HasMenuItems
component
- the component inside the new itemclickListener
- the handler for clicking the new item, can be null
to
not add listenerMenuItem
componentHasMenuItems.addItem(String, ComponentEventListener)
,
ContextMenuBase.add(Component...)
,
SubMenuBase.add(Component...)
protected MenuManager<ContextMenu,MenuItem,SubMenu> createMenuManager(SerializableRunnable contentReset)
ContextMenuBase
createMenuManager
in class ContextMenuBase<ContextMenu,MenuItem,SubMenu>
contentReset
- callback to reset the menu contentCopyright © 2022. All rights reserved.