Package com.storedobject.vaadin
Class MenuBarItem
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.Component>
com.storedobject.vaadin.MenuBarItem
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
- Direct Known Subclasses:
MenuBar
public abstract class MenuBarItem
extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.Component>
Represents a "menu bar item" or its "sub-menu".
- Author:
- Syam
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract MenuBarItemaddMenuItem(com.vaadin.flow.component.Component component) Add a menu so that a sub-menu can be created under that.abstract MenuBarItemaddMenuItem(com.vaadin.flow.component.Component component, ClickHandler clickHandler) Add a menu with its click-handler.abstract MenuBarItemaddMenuItem(String caption) Add a menu so that a sub-menu can be created under that.abstract MenuBarItemaddMenuItem(String caption, ClickHandler clickHandler) Add a menu with its click-handler.booleanGets whether this item toggles a checkmark icon when clicked.booleanGets the checked state of this item.abstract voidremove(MenuBarItem... items) Removes the given menu items from this.abstract voidRemoves all menu items from this.voidsetCheckable(boolean checkable) Sets the checkable state of this menu item.voidsetChecked(boolean checked) Sets the checked state of this item.Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContentMethods 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
-
MenuBarItem
public MenuBarItem()
-
-
Method Details
-
addMenuItem
Add a menu with its click-handler.- 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 abstract MenuBarItem addMenuItem(com.vaadin.flow.component.Component component, ClickHandler clickHandler) Add a menu with its click-handler.- 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
Add a menu so that a sub-menu can be created under that.- 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
Add a menu so that a sub-menu can be created under that.- 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.- Parameters:
items- Menu items to remove.
-
removeAll
public abstract void removeAll()Removes all menu items from this. -
setCheckable
public void setCheckable(boolean checkable) Sets the checkable state of this menu item. A checkable item toggles a checkmark icon when clicked. Changes in the checked state can be handled in the item's click handler withisChecked(). Setting a checked item un-checkable also makes it un-checked.- Parameters:
checkable-trueto enable toggling the checked-state of this menu item by clicking,falseto disable it.
-
isCheckable
public boolean isCheckable()Gets whether this item toggles a checkmark icon when clicked.- Returns:
- the checkable state of the item.
-
setChecked
public void setChecked(boolean checked) Sets the checked state of this item. A checked item displays a checkmark icon next to it. The checked state is also toggled by clicking the item.- Parameters:
checked-trueto check this item,falseto un-check it.
-
isChecked
public boolean isChecked()Gets the checked state of this item. The item can be checked and un-checked withsetChecked(boolean)or by clicking it when it is checkable. A checked item displays a checkmark icon inside it.- Returns:
trueif the item is checked,falseotherwise.
-