java.lang.Object
com.vaadin.flow.component.Component
org.vaadin.addons.componentfactory.toolbarlayout.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

@Tag("vcf-toolbar-layout") @NpmPackage(value="@vaadin-component-factory/vcf-toolbar-layout", version="2.0.0") @JsModule("@vaadin-component-factory/vcf-toolbar-layout/dist/src/vcf-toolbar-layout.js") @CssImport("./styles/toolbar-layout-styles.css") public class ToolbarLayout extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasOrderedComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.shared.HasThemeVariant<ToolbarLayoutVariant>
A layout that provides a toolbar with an overflow menu.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addItem(com.vaadin.flow.component.Component component)
    Adds the given component to the toolbar.
    com.vaadin.flow.component.contextmenu.MenuItem
    Creates a new MenuItem component with the provided text content and adds it to the root level of this menu bar.
    com.vaadin.flow.component.contextmenu.MenuItem
    addItem(String text, com.vaadin.flow.component.Component icon)
    Creates a new MenuItem component with the provided text content and icon and adds it to the root level of this menu bar.
    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 new MenuItem component with the provided text content and click listener and adds it to the root level of this menu bar.
    com.vaadin.flow.component.contextmenu.MenuItem
    addItem(String text, String tooltipText)
    Creates a new MenuItem component 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.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 new MenuItem component 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>
    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.
    int
    Get the delay before the toolbar items are updated after a resize.
    boolean
     
    boolean
    Gets whether the sub menus open by clicking or hovering on the root level buttons.
    boolean
    Gets whether the menu bar uses reverse collapse order.
    void
    setDropdownIndicatorShown(boolean isDropdownIndicatorShown)
     
    void
    setOpenOnHover(boolean openOnHover)
    Sets the event which opens the sub menus of the root level buttons.
    void
    setOverflowButton(com.vaadin.flow.component.button.Button overflowButton)
    Provide a custom button to be used as the overflow button.
    void
    setReverseCollapseOrder(boolean reverseCollapseOrder)
    Sets reverse collapse order for the menu bar.
    void
    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, 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.HasComponents

    add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasOrderedComponents

    getChildren, getComponentAt, getComponentCount, indexOf, replace

    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

    Methods inherited from interface com.vaadin.flow.component.HasTheme

    addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

    Methods 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 new MenuItem component with the provided text content and icon and adds it to the root level of this menu bar.

      The added MenuItem component is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, the MenuItem is 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 MenuItem component
    • addItem

      public com.vaadin.flow.component.contextmenu.MenuItem addItem(String text)
      Creates a new MenuItem component with the provided text content and adds it to the root level of this menu bar.

      The added MenuItem component is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, the MenuItem is 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 MenuItem component
    • addItem

      public void addItem(com.vaadin.flow.component.Component component)
      Adds the given component to the toolbar.

      Please note, that there is no MenuItem created. 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 new MenuItem component with the provided text content and click listener and adds it to the root level of this menu bar.

      The added MenuItem component is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, the MenuItem is 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
      clickListener - the handler for clicking the new item, can be null to not add listener
      Returns:
      the added MenuItem component
    • 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 using addItem(Component) (e.g. for Button.

      Please note, that there is no MenuItem created. Modify the component directly if necessary.

      Parameters:
      component - the component to add inside the added menu item
      clickListener - the handler for clicking the new item, can be null to not add listener
    • addItem

      public com.vaadin.flow.component.contextmenu.MenuItem addItem(String text, String tooltipText)
      Creates a new MenuItem component with the provided text content and the tooltip text and adds it to the root level of this menu bar.

      The added MenuItem component is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, the MenuItem is 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
      tooltipText - the tooltip text for the new item
      Returns:
      the added MenuItem component
    • 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 new MenuItem component 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 MenuItem component is placed inside a button in the menu bar. If this button overflows the menu bar horizontally, the MenuItem is 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
      tooltipText - the tooltip text for the new item
      clickListener - the handler for clicking the new item, can be null to not add listener
      Returns:
      the added MenuItem component
    • setOpenOnHover

      public void setOpenOnHover(boolean openOnHover)
      Sets the event which opens the sub menus of the root level buttons.
      Parameters:
      openOnHover - true to make the sub menus open on hover (mouseover), false to 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:
      true if the sub menus open by hovering on the root level buttons, false if they open by clicking
    • setReverseCollapseOrder

      public void setReverseCollapseOrder(boolean reverseCollapseOrder)
      Sets reverse collapse order for the menu bar.
      Parameters:
      reverseCollapseOrder - If true, 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:
      true if 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, or null to remove any existing overflow button and revert to the default overflow button