com.holonplatform.vaadin.flow.components.builders

## Interface ContextMenuConfigurator<L extends EventListener,M extends com.vaadin.flow.component.contextmenu.ContextMenuBase<M>,C extends ContextMenuConfigurator<L,M,C>>

- Type Parameters:
    `L` - Menu item click listener type
    `M` - Concrete ContextMenu component type
    `C` - Concrete configurator type
  All Superinterfaces:
    ComponentConfigurator<C>, HasElementConfigurator<C>, HasStyleConfigurator<C>
  All Known Subinterfaces:
    ContextMenuBuilder, ItemListingConfigurator.ItemListingContextMenuBuilder<T,P,L,B>

      public interface ContextMenuConfigurator<L extends EventListener,M extends com.vaadin.flow.component.contextmenu.ContextMenuBase<M>,C extends ContextMenuConfigurator<L,M,C>>
      extends ComponentConfigurator<C>, HasStyleConfigurator<C>

  `ContextMenu` component configurator.
  Since:
    5.2.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `ContextMenuConfigurator.MenuItemBuilder<L extends EventListener,M extends com.vaadin.flow.component.contextmenu.ContextMenuBase<M>,B extends ContextMenuConfigurator<L,M,B>>` Context menu item configurator.

    - ### Nested classes/interfaces inherited from interface com.holonplatform.vaadin.flow.components.builders.ComponentConfigurator

      `ComponentConfigurator.BaseComponentConfigurator`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `C` | `openOnClick(boolean openOnClick)` Determines the way for opening the context menu.
    `ContextMenuConfigurator.MenuItemBuilder<L,M,C>` | `withItem(com.vaadin.flow.component.Component component)` Create a new menu item with the given component inside.
    `default C` | `withItem(com.vaadin.flow.component.Component component, L clickEventListener)` Add a new menu item with the given component inside and a `ClickEventListener` for menu item clicks.
    `ContextMenuConfigurator.MenuItemBuilder<L,M,C>` | `withItem(com.holonplatform.core.i18n.Localizable text)` Create a new menu item with the given localizable text content.
    `default C` | `withItem(com.holonplatform.core.i18n.Localizable text, L clickEventListener)` Add a new menu item using given localizable text content and a `ClickEventListener` for menu item clicks.
    `default ContextMenuConfigurator.MenuItemBuilder<L,M,C>` | `withItem(String text)` Create a new menu item with the given text content.
    `default C` | `withItem(String text, L clickEventListener)` Add a new menu item using given text content and a `ClickEventListener` for menu item clicks.
    `default C` | `withItem(String defaultText, String messageCode, L clickEventListener)` Add a new menu item using given `messageCode` for text localization and a `ClickEventListener` for menu item clicks.
    `default ContextMenuConfigurator.MenuItemBuilder<L,M,C>` | `withItem(String defaultText, String messageCode, Object... arguments)` Create a new menu item using given `messageCode` for text content localization.
    `C` | `withOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.contextmenu.GeneratedVaadinContextMenu.OpenedChangeEvent<M>> listener)` Adds a listener to be notified when the context menu is opened or closed.

    - ### Methods inherited from interface com.holonplatform.vaadin.flow.components.builders.ComponentConfigurator

      `hidden, id, visible, withAttachListener, withDetachListener`

    - ### Methods inherited from interface com.holonplatform.vaadin.flow.components.builders.HasElementConfigurator

      `withEventListener, withEventListener, withThemeName`

    - ### Methods inherited from interface com.holonplatform.vaadin.flow.components.builders.HasStyleConfigurator

      `styleName, styleNames`

- - ### Method Detail

    - #### withItem

          ContextMenuConfigurator.MenuItemBuilder<L,M,C> withItem(com.holonplatform.core.i18n.Localizable text)

      Create a new menu item with the given localizable text content.

      The `ContextMenuConfigurator.MenuItemBuilder.add()` method can be used to add the item to the context menu.

      Parameters:
        `text` - Localizable menu item text content
      Returns:
        A `ContextMenuConfigurator.MenuItemBuilder` to configure and add the menu item
      See Also:
        `LocalizationProvider`

    - #### withItem

          default ContextMenuConfigurator.MenuItemBuilder<L,M,C> withItem(String text)

      Create a new menu item with the given text content.

      The `ContextMenuConfigurator.MenuItemBuilder.add()` method can be used to add the item to the context menu.

      Parameters:
        `text` - Menu item text content
      Returns:
        A `ContextMenuConfigurator.MenuItemBuilder` to configure and add the menu item

    - #### withItem

          default ContextMenuConfigurator.MenuItemBuilder<L,M,C> withItem(String defaultText,
                                                                          String messageCode,
                                                                          Object... arguments)

      Create a new menu item using given `messageCode` for text content localization.

      The `ContextMenuConfigurator.MenuItemBuilder.add()` method can be used to add the item to the context menu.

      Parameters:
        `defaultText` - Default menu item text content if no translation is available for given `messageCode`.
        `messageCode` - Menu item text content translation message key
        `arguments` - Optional translation arguments
      Returns:
        A `ContextMenuConfigurator.MenuItemBuilder` to configure and add the menu item
      See Also:
        `LocalizationProvider`

    - #### withItem

          ContextMenuConfigurator.MenuItemBuilder<L,M,C> withItem(com.vaadin.flow.component.Component component)

      Create a new menu item with the given component inside.

      The `ContextMenuConfigurator.MenuItemBuilder.add()` method can be used to add the item to the context menu.

      Parameters:
        `component` - The menu item component (not null)
      Returns:
        A `ContextMenuConfigurator.MenuItemBuilder` to configure and add the menu item

    - #### withItem

          default C withItem(com.holonplatform.core.i18n.Localizable text,
                             L clickEventListener)

      Add a new menu item using given localizable text content and a `ClickEventListener` for menu item clicks.
      Parameters:
        `text` - Menu item text content
        `clickEventListener` - The listener to use to listen to menu item clicks (not null)
      Returns:
        this
      See Also:
        `LocalizationProvider`

    - #### withItem

          default C withItem(String defaultText,
                             String messageCode,
                             L clickEventListener)

      Add a new menu item using given `messageCode` for text localization and a `ClickEventListener` for menu item clicks.
      Parameters:
        `defaultText` - Default menu item text content if no translation is available for given `messageCode`.
        `messageCode` - Menu item text content translation message key
        `clickEventListener` - The listener to use to listen to menu item clicks (not null)
      Returns:
        this
      See Also:
        `LocalizationProvider`

    - #### withItem

          default C withItem(String text,
                             L clickEventListener)

      Add a new menu item using given text content and a `ClickEventListener` for menu item clicks.
      Parameters:
        `text` - Menu item text content
        `clickEventListener` - The listener to use to listen to menu item clicks (not null)
      Returns:
        this

    - #### withItem

          default C withItem(com.vaadin.flow.component.Component component,
                             L clickEventListener)

      Add a new menu item with the given component inside and a `ClickEventListener` for menu item clicks.
      Parameters:
        `component` - The menu item component (not null)
        `clickEventListener` - The listener to use to listen to menu item clicks (not null)
      Returns:
        this

    - #### openOnClick

          C openOnClick(boolean openOnClick)

      Determines the way for opening the context menu.

      By default, the context menu can be opened with a right click or a long touch on the target component.

      Parameters:
        `openOnClick` - if `true`, the context menu can be opened with left click only. Otherwise the context menu follows the default behavior.
      Returns:
        this

    - #### withOpenedChangeListener

          C withOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.contextmenu.GeneratedVaadinContextMenu.OpenedChangeEvent<M>> listener)

      Adds a listener to be notified when the context menu is opened or closed.
      Parameters:
        `listener` - the listener to add
      Returns:
        this

Copyright © 2019 The Holon Platform. All rights reserved.