com.vaadin.flow.component.contextmenu.
Class SubMenuBase<C extends ContextMenuBase<C,I,S>,I extends MenuItemBase<C,I,S>,S extends SubMenuBase<C,I,S>>
Type Parameters:
C
- the context-menu type
I
- the menu-item type
S
- the sub menu type
All Implemented Interfaces:
Direct Known Subclasses:
Base class for sub-menus in ContextMenuBase
extensions. Classes
extending this should provide API for adding items and handling events
related to them. For basic example, see SubMenu
.
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given components into the sub menu overlay.
void
addComponentAtIndex
(int index, Component component) Adds the given component into the sub menu overlay at the given index.
Adds a new item component with the given component to the sub menu overlay.
Adds a new item component with the given text content to the sub menu overlay.
protected abstract MenuManager<C,
I, S> Creates a (sub) menu manager instance which contains logic to control the (sub) menu content.
Gets the child components of this sub menu.
getItems()
Gets the items added to this sub menu (the children of this component that are instances of
MenuItem
).protected MenuManager<C,
I, S> Gets a (sub) menu manager.
Gets the menu item component that opens this sub menu overlay.
void
Removes the given components from the sub menu overlay.
void
Removes all components inside the sub menu overlay.
-
Constructor Details
-
SubMenuBase
-
-
Method Details
-
addItem
Adds a new item component with the given text content to the sub 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 theadd(Component...)
method.Parameters:
text
- the text content for the created menu itemReturns:
the created menu item
See Also:
-
addItem
Adds a new item component with the given component to the sub 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 theadd(Component...)
method.Parameters:
component
- the component to add to the created menu itemReturns:
the created menu item
See Also:
-
add
Adds the given components into the sub menu overlay.
For the common use case of having a list of high-lightable items inside the overlay, you can use the
addItem(String)
convenience methods instead.The added elements will be inserted into an overlay that is attached into the
<body>
.Parameters:
components
- the components to addSee Also:
-
remove
Removes the given components from the sub menu overlay.
Parameters:
components
- the components to removeSee Also:
-
removeAll
public void removeAll()Removes all components inside the sub menu overlay.
See Also:
-
addComponentAtIndex
Adds the given component into the sub menu overlay at the given index.
The added elements will be inserted into an overlay that is attached into the
<body>
.Parameters:
index
- the index, where the component will be addedcomponent
- the component to addSee Also:
-
getChildren
Gets the child components of this sub menu. This includes components added with
add(Component...)
and theMenuItem
components created withaddItem(String)
and its overload methods. This doesn't include the components added to the main context menu or any other sub menus it may have.Returns:
the child components of this sub menu
-
getItems
Gets the items added to this sub menu (the children of this component that are instances of
MenuItem
).Returns:
the
MenuItem
components in this sub menuSee Also:
-
getParentMenuItem
Gets the menu item component that opens this sub menu overlay.
Returns:
the parent menu item of this sub menu
-
getMenuManager
Gets a (sub) menu manager.
Returns:
-
createMenuManager
Creates a (sub) menu manager instance which contains logic to control the (sub) menu content.
Returns:
a new menu manager instance
-