public class SubMenu extends SubMenuBase<ContextMenu,MenuItem,SubMenu> implements HasMenuItems
ContextMenu 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 |
|---|
SubMenu(MenuItem parentMenuItem,
SerializableRunnable contentReset) |
| 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()
Creates a (sub) menu manager instance which contains logic to control the
(sub) menu content.
|
add, addComponentAtIndex, addItem, addItem, getChildren, getItems, getMenuManager, getParentMenuItem, remove, removeAllpublic SubMenu(MenuItem parentMenuItem, SerializableRunnable contentReset)
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 MenuItems inside the overlay. If you want to
configure the contents of the overlay without wrapping them inside
MenuItems, or if you just want to add some non-highlightable
components between the items, use the
ContextMenuBase.add(Component...) method.
addItem in interface HasMenuItemstext - 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 MenuItems inside the overlay. If you want to
configure the contents of the overlay without wrapping them inside
MenuItems, or if you just want to add some non-highlightable
components between the items, use the
ContextMenuBase.add(Component...) method.
addItem in interface HasMenuItemscomponent - 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()
SubMenuBasecreateMenuManager in class SubMenuBase<ContextMenu,MenuItem,SubMenu>Copyright © 2021. All rights reserved.