Package com.storedobject.vaadin
Class MenuBar
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.Component>
com.storedobject.vaadin.MenuBarItem
com.storedobject.vaadin.MenuBar
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
This component provides the same functionality of Vaadin's
MenuBar.
However, it is easier to use it in your code.- Author:
- Syam
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddMenuItem(com.vaadin.flow.component.Component component) Add a menu so that a sub-menu can be created under that.addMenuItem(com.vaadin.flow.component.Component component, ClickHandler clickHandler) Add a menu with its click-handler.addMenuItem(String caption) Add a menu so that a sub-menu can be created under that.addMenuItem(String caption, ClickHandler clickHandler) Add a menu with its click-handler.com.vaadin.flow.component.menubar.MenuBargetBar()Get Vaadin'sMenuBarembedded in this.protected com.vaadin.flow.component.menubar.MenuBarbooleanGets whether the sub menus open by clicking or hovering on the root level buttons.voidremove(MenuBarItem... items) Removes the given menu items from this menu bar.voidRemoves all menu items from this menu bar.voidsetOpenOnHover(boolean openOnHover) Sets the event which opens the sub menus of the root level buttons.Methods inherited from class com.storedobject.vaadin.MenuBarItem
isCheckable, isChecked, setCheckable, setCheckedMethods 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.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
MenuBar
public MenuBar()
-
-
Method Details
-
initContent
protected com.vaadin.flow.component.menubar.MenuBar initContent()- Overrides:
initContentin classcom.vaadin.flow.component.Composite<com.vaadin.flow.component.Component>
-
addMenuItem
Description copied from class:MenuBarItemAdd a menu with its click-handler.- Specified by:
addMenuItemin classMenuBarItem- Parameters:
caption- Caption to display.clickHandler- Click-handler.- Returns:
- The menu that is added. This menu can not add further items because it already defines its own click handler.
-
addMenuItem
public MenuBarItem addMenuItem(com.vaadin.flow.component.Component component, ClickHandler clickHandler) Description copied from class:MenuBarItemAdd a menu with its click-handler.- Specified by:
addMenuItemin classMenuBarItem- Parameters:
component- Component to display.clickHandler- Click-handler.- Returns:
- The menu that is added. This menu can not add further items because it already defines its own click handler.
-
addMenuItem
Description copied from class:MenuBarItemAdd a menu so that a sub-menu can be created under that.- Specified by:
addMenuItemin classMenuBarItem- Parameters:
caption- Caption to display.- Returns:
- The menu that is added. It will be a sub-menu so that you can add further menu items under it.
-
addMenuItem
Description copied from class:MenuBarItemAdd a menu so that a sub-menu can be created under that.- Specified by:
addMenuItemin classMenuBarItem- Parameters:
component- Component to display.- Returns:
- The menu that is added. It will be a sub-menu so that you can add further menu items under it.
-
remove
Removes the given menu items from this menu bar.- Specified by:
removein classMenuBarItem- Parameters:
items- Menu items to remove.
-
removeAll
public void removeAll()Removes all menu items from this menu bar.- Specified by:
removeAllin classMenuBarItem
-
setOpenOnHover
public void setOpenOnHover(boolean openOnHover) Sets the event which opens the sub menus of the root level buttons.- Parameters:
openOnHover-trueto make the sub menus open on hover (mouseover),falseto make them openable by clicking.
-
isOpenOnHover
public boolean isOpenOnHover()Gets whether the sub menus open by clicking or hovering on the root level buttons.- Returns:
trueif the sub menus open by hovering on the root level buttons,falseif they open by clicking.
-
getBar
public com.vaadin.flow.component.menubar.MenuBar getBar()Get Vaadin'sMenuBarembedded in this.- Returns:
- Vaadin's menu bar. Direct manipulation of this for adding/removing components is discouraged. However, you may use it for the manipulation themes, internationalization etc.
-