Class HorizontalMenu
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<JmixMenuBar>
io.jmix.flowui.component.horizontalmenu.HorizontalMenu
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasSize
,com.vaadin.flow.component.HasStyle
,HasMenuItemProvider<HorizontalMenu.AbstractMenuItem<?>>
,Serializable
public class HorizontalMenu
extends com.vaadin.flow.component.Composite<JmixMenuBar>
implements HasMenuItemProvider<HorizontalMenu.AbstractMenuItem<?>>, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle
Represents horizontal menu that can be used for navigation to a view or for invoking a method of a bean
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
HorizontalMenu.AbstractContentMenuItem<T extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasComponents>
Provides base functionality for items that contain text with suffix and prefix componentsstatic class
HorizontalMenu.AbstractMenuItem<T extends com.vaadin.flow.component.Component>
Provides base functionality for horizontal menu itemsstatic class
Represents horizontal menu item that can run some action on clickstatic class
Represents menu item that can contain other menu items.static class
Represents a separatorstatic class
Represents an item which navigates to a view on click -
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected Map<String,
HorizontalMenu.AbstractMenuItem<?>> protected static final String
protected static final String
protected Subscription
protected MenuItemProvider<HorizontalMenu.AbstractMenuItem<?>>
protected static final String
protected List<HorizontalMenu.AbstractMenuItem<?>>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addChildItem
(HorizontalMenu.AbstractMenuItem<?> menuItem, HorizontalMenu.ParentMenuItem parentMenuItem, int index) protected void
addComponentToSubMenu
(com.vaadin.flow.component.Component component, JmixSubMenu subMenu, int index) void
addMenuItem
(HorizontalMenu.AbstractMenuItem<?> menuItem) Adds menu item and its children to menu root.void
addMenuItem
(HorizontalMenu.AbstractMenuItem<?> menuItem, int index) Adds menu item and its children to menu root at the specified position.protected void
addMenuItemRecursive
(HorizontalMenu.AbstractMenuItem<?> childMenuItem, HorizontalMenu.ParentMenuItem parentMenuItem, int index) protected void
addMenuItemToSubMenu
(HorizontalMenu.AbstractMenuItem<?> menuItem, JmixSubMenu subMenu, int index) protected void
attachMenuItem
(HorizontalMenu.AbstractMenuItem<?> menuItem) protected void
protected void
detachMenuItemRecursive
(HorizontalMenu.AbstractMenuItem<?> menuItem) getMenuItem
(String id) Returns menu item from the menu (including non-root items) by its id.protected String
getMenuItemId
(HorizontalMenu.AbstractMenuItem<?> menuItem) protected JmixSubMenu
getParentSubMenu
(HorizontalMenu.ParentMenuItem parentMenuItem) protected JmixMenuBar
protected void
onMenuItemCollectionChanged
(MenuItemProvider.CollectionChangeEvent<HorizontalMenu.AbstractMenuItem<?>> e) void
Removes all menu items from the menu.protected void
removeChildItem
(HorizontalMenu.AbstractMenuItem<?> menuItem, HorizontalMenu.ParentMenuItem parentMenuItem) void
removeMenuItem
(int index) Removes root menu item by index.void
removeMenuItem
(HorizontalMenu.AbstractMenuItem<?> menuItem) Removes menu item and its children from the menu.protected void
removeRootItem
(HorizontalMenu.AbstractMenuItem<?> menuItem) void
setMenuItemProvider
(MenuItemProvider<HorizontalMenu.AbstractMenuItem<?>> menuItemProvider) Sets menu item providerMethods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, 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.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
HORIZONTAL_MENU_CLASS_NAME
- See Also:
-
ROOT_MENU_ITEM_CLASS_NAME
- See Also:
-
ITEM_WRAPPER_CLASS_NAME
- See Also:
-
ADD_TO_END_INDEX
protected static final int ADD_TO_END_INDEX- See Also:
-
itemCollectionChangedSubscription
-
rootMenuItems
-
allMenuItems
-
-
Constructor Details
-
HorizontalMenu
public HorizontalMenu()
-
-
Method Details
-
initContent
- Overrides:
initContent
in classcom.vaadin.flow.component.Composite<JmixMenuBar>
-
getMenuItemProvider
- Specified by:
getMenuItemProvider
in interfaceHasMenuItemProvider<HorizontalMenu.AbstractMenuItem<?>>
- Returns:
- menu item provider
-
getMenuItem
Returns menu item from the menu (including non-root items) by its id.- Parameters:
id
- menu item id- Returns:
- menu item or null if not found
-
getMenuItems
- Returns:
- immutable list of root menu items
-
checkDuplicateItemId
-
removeMenuItem
public void removeMenuItem(int index) Removes root menu item by index.- Parameters:
index
- index of an item to remove
-
removeAllMenuItems
public void removeAllMenuItems()Removes all menu items from the menu.
-