public class GridSubMenu<T> extends SubMenuBase<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>
GridContextMenu
to create hierarchical menus. Get it by calling
MenuItemBase.getSubMenu()
on the item component that should open the
sub menu. Sub menu will be rendered only if content has been added inside it.Constructor and Description |
---|
GridSubMenu(GridMenuItem<T> parentMenuItem,
SerializableRunnable contentReset)
Creates a new instance of submenu using the associated
parentMenuItem (item which opens the submenu) and reset context
menu callback. |
Modifier and Type | Method and Description |
---|---|
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()
Creates a (sub) menu manager instance which contains logic to control the
(sub) menu content.
|
add, addComponentAtIndex, addItem, addItem, getChildren, getItems, getMenuManager, getParentMenuItem, remove, removeAll
public GridSubMenu(GridMenuItem<T> parentMenuItem, SerializableRunnable contentReset)
parentMenuItem
(item which opens the submenu) and reset context
menu callback.parentMenuItem
- the associated menu item, not null
contentReset
- the context menu reset callback, not null
public 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 GridMenuItem
s inside the overlay. If you want to
configure the contents of the overlay without wrapping them inside
GridMenuItem
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 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 GridMenuItem
s inside the overlay. If you want to
configure the contents of the overlay without wrapping them inside
GridMenuItem
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 listenerGridMenuItem
componentaddItem(String, ComponentEventListener)
,
ContextMenuBase.add(Component...)
,
SubMenuBase.add(Component...)
protected MenuManager<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>> createMenuManager()
SubMenuBase
createMenuManager
in class SubMenuBase<GridContextMenu<T>,GridMenuItem<T>,GridSubMenu<T>>
Copyright © 2025. All rights reserved.