Class ToolbarLayout
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasOrderedComponents,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.shared.HasThemeVariant<ToolbarLayoutVariant>,Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddItem(com.vaadin.flow.component.Component component) Adds the given component to the toolbar.com.vaadin.flow.component.contextmenu.MenuItemCreates a newMenuItemcomponent with the provided text content and adds it to the root level of this menu bar.com.vaadin.flow.component.contextmenu.MenuItemCreates a newMenuItemcomponent with the provided text content and icon and adds it to the root level of this menu bar.com.vaadin.flow.component.contextmenu.MenuItemaddItem(String text, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.contextmenu.MenuItem>> clickListener) Creates a newMenuItemcomponent with the provided text content and click listener and adds it to the root level of this menu bar.com.vaadin.flow.component.contextmenu.MenuItemCreates a newMenuItemcomponent with the provided text content and the tooltip text and adds it to the root level of this menu bar.com.vaadin.flow.component.contextmenu.MenuItemaddItem(String text, String tooltipText, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.contextmenu.MenuItem>> clickListener) Creates a newMenuItemcomponent with the provided text content and the tooltip text and click listener and adds it to the root level of this menu bar.<T extends com.vaadin.flow.component.Component>
voidaddItem(T component, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<T>> clickListener) A convenience method to add a component and register a click listener on it.intGet the delay before the toolbar items are updated after a resize.booleanbooleanGets whether the sub menus open by clicking or hovering on the root level buttons.booleanGets whether the menu bar uses reverse collapse order.voidsetDropdownIndicatorShown(boolean isDropdownIndicatorShown) voidsetOpenOnHover(boolean openOnHover) Sets the event which opens the sub menus of the root level buttons.voidsetOverflowButton(com.vaadin.flow.component.button.Button overflowButton) Provide a custom button to be used as the overflow button.voidsetReverseCollapseOrder(boolean reverseCollapseOrder) Sets reverse collapse order for the menu bar.voidsetUpdateDebounceDelay(int delay) Sets the delay before the toolbar/overflow items are updated after a resize.Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, 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.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasOrderedComponents
getChildren, getComponentAt, getComponentCount, indexOf, replaceMethods 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, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariants
-
Constructor Details
-
ToolbarLayout
public ToolbarLayout()
-
-
Method Details
-
isDropdownIndicatorShown
public boolean isDropdownIndicatorShown() -
setDropdownIndicatorShown
public void setDropdownIndicatorShown(boolean isDropdownIndicatorShown) -
getUpdateDebounceDelay
public int getUpdateDebounceDelay()Get the delay before the toolbar items are updated after a resize.- Returns:
- milliseconds to wait before updating the toolbar items
-
setUpdateDebounceDelay
public void setUpdateDebounceDelay(int delay) Sets the delay before the toolbar/overflow items are updated after a resize.- Parameters:
delay- milliseconds to wait before updating the toolbar items
-
addItem
public com.vaadin.flow.component.contextmenu.MenuItem addItem(String text, com.vaadin.flow.component.Component icon) Creates a newMenuItemcomponent with the provided text content and icon and adds it to the root level of this menu bar.The added
MenuItemcomponent is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, theMenuItemis moved out of the button, into a context menu openable via an overflow button at the end of the button row.To add content to the sub menu opened by clicking the root level item, use
MenuItemBase.getSubMenu().- Parameters:
text- the text content for the new item- Returns:
- the added
MenuItemcomponent
-
addItem
Creates a newMenuItemcomponent with the provided text content and adds it to the root level of this menu bar.The added
MenuItemcomponent is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, theMenuItemis moved out of the button, into a context menu openable via an overflow button at the end of the button row.To add content to the sub menu opened by clicking the root level item, use
MenuItemBase.getSubMenu().- Parameters:
text- the text content for the new item- Returns:
- the added
MenuItemcomponent
-
addItem
public void addItem(com.vaadin.flow.component.Component component) Adds the given component to the toolbar.Please note, that there is no
MenuItemcreated. Modify the component directly if necessary.- Parameters:
component- the component to add inside new item
-
addItem
public com.vaadin.flow.component.contextmenu.MenuItem addItem(String text, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.contextmenu.MenuItem>> clickListener) Creates a newMenuItemcomponent with the provided text content and click listener and adds it to the root level of this menu bar.The added
MenuItemcomponent is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, theMenuItemis moved out of the button, into a context menu openable via an overflow button at the end of the button row.To add content to the sub menu opened by clicking the root level item, use
MenuItemBase.getSubMenu().- Parameters:
text- the text content for the new itemclickListener- the handler for clicking the new item, can benullto not add listener- Returns:
- the added
MenuItemcomponent
-
addItem
public <T extends com.vaadin.flow.component.Component> void addItem(T component, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<T>> clickListener) A convenience method to add a component and register a click listener on it. However, if the given component provides a built-in click listener, it is recommended, to use that instead and add the component usingaddItem(Component)(e.g. forButton.Please note, that there is no
MenuItemcreated. Modify the component directly if necessary.- Parameters:
component- the component to add inside the added menu itemclickListener- the handler for clicking the new item, can benullto not add listener
-
addItem
Creates a newMenuItemcomponent with the provided text content and the tooltip text and adds it to the root level of this menu bar.The added
MenuItemcomponent is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, theMenuItemis moved out of the button, into a context menu openable via an overflow button at the end of the button row.To add content to the sub menu opened by clicking the root level item, use
MenuItemBase.getSubMenu().- Parameters:
text- the text content for the new itemtooltipText- the tooltip text for the new item- Returns:
- the added
MenuItemcomponent
-
addItem
public com.vaadin.flow.component.contextmenu.MenuItem addItem(String text, String tooltipText, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.contextmenu.MenuItem>> clickListener) Creates a newMenuItemcomponent with the provided text content and the tooltip text and click listener and adds it to the root level of this menu bar.The added
MenuItemcomponent is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, theMenuItemis moved out of the button, into a context menu openable via an overflow button at the end of the button row.To add content to the sub menu opened by clicking the root level item, use
MenuItemBase.getSubMenu().- Parameters:
text- the text content for the new itemtooltipText- the tooltip text for the new itemclickListener- the handler for clicking the new item, can benullto not add listener- Returns:
- the added
MenuItemcomponent
-
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
-
setReverseCollapseOrder
public void setReverseCollapseOrder(boolean reverseCollapseOrder) Sets reverse collapse order for the menu bar.- Parameters:
reverseCollapseOrder- Iftrue, the buttons will be collapsed into the overflow menu starting from the "start" end of the bar instead of the "end".
-
isReverseCollapseOrder
public boolean isReverseCollapseOrder()Gets whether the menu bar uses reverse collapse order.- Returns:
trueif the buttons will be collapsed into the overflow menu starting from the "start" end of the bar instead of the "end".
-
setOverflowButton
public void setOverflowButton(com.vaadin.flow.component.button.Button overflowButton) Provide a custom button to be used as the overflow button. This will replace any other overflow button that may have been set previously.- Parameters:
overflowButton- the button to use as the overflow button, ornullto remove any existing overflow button and revert to the default overflow button
-