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
Nested ClassesModifier and TypeClassDescriptionstatic classHorizontalMenu.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 classHorizontalMenu.AbstractMenuItem<T extends com.vaadin.flow.component.Component>Provides base functionality for horizontal menu itemsstatic classRepresents horizontal menu item that can run some action on clickstatic classRepresents menu item that can contain other menu items.static classRepresents a separatorstatic classRepresents an item which navigates to a view on click -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected Map<String,HorizontalMenu.AbstractMenuItem<?>> protected static final Stringprotected static final Stringprotected Subscriptionprotected MenuItemProvider<HorizontalMenu.AbstractMenuItem<?>>protected static final Stringprotected List<HorizontalMenu.AbstractMenuItem<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddChildItem(HorizontalMenu.AbstractMenuItem<?> menuItem, HorizontalMenu.ParentMenuItem parentMenuItem, int index) protected voidaddComponentToSubMenu(com.vaadin.flow.component.Component component, JmixSubMenu subMenu, int index) voidaddMenuItem(HorizontalMenu.AbstractMenuItem<?> menuItem) Adds menu item and its children to menu root.voidaddMenuItem(HorizontalMenu.AbstractMenuItem<?> menuItem, int index) Adds menu item and its children to menu root at the specified position.protected voidaddMenuItemRecursive(HorizontalMenu.AbstractMenuItem<?> childMenuItem, HorizontalMenu.ParentMenuItem parentMenuItem, int index) protected voidaddMenuItemToSubMenu(HorizontalMenu.AbstractMenuItem<?> menuItem, JmixSubMenu subMenu, int index) protected voidattachMenuItem(HorizontalMenu.AbstractMenuItem<?> menuItem) protected voidprotected voiddetachMenuItemRecursive(HorizontalMenu.AbstractMenuItem<?> menuItem) getMenuItem(String id) Returns menu item from the menu (including non-root items) by its id.protected StringgetMenuItemId(HorizontalMenu.AbstractMenuItem<?> menuItem) protected JmixSubMenugetParentSubMenu(HorizontalMenu.ParentMenuItem parentMenuItem) protected JmixMenuBarbooleanGets whether the horizontal menu uses tab navigation.protected voidonMenuItemCollectionChanged(MenuItemProvider.CollectionChangeEvent<HorizontalMenu.AbstractMenuItem<?>> e) voidRemoves all menu items from the menu.protected voidremoveChildItem(HorizontalMenu.AbstractMenuItem<?> menuItem, HorizontalMenu.ParentMenuItem parentMenuItem) voidremoveMenuItem(int index) Removes root menu item by index.voidremoveMenuItem(HorizontalMenu.AbstractMenuItem<?> menuItem) Removes menu item and its children from the menu.protected voidremoveRootItem(HorizontalMenu.AbstractMenuItem<?> menuItem) voidsetMenuItemProvider(MenuItemProvider<HorizontalMenu.AbstractMenuItem<?>> menuItemProvider) Sets menu item providervoidsetTabNavigation(boolean tabNavigation) Sets tab navigation for the horizontal menu.Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElementMethods 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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods 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, setWidthFullMethods 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:
initContentin classcom.vaadin.flow.component.Composite<JmixMenuBar>
-
getMenuItemProvider
- Specified by:
getMenuItemProviderin 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.
-