com.holonplatform.vaadin.flow.components

## Interface SingleSelect<T>

- Type Parameters:
    `T` - Selection item type
  All Superinterfaces:
    HasComponent, com.vaadin.flow.component.HasElement, Input<T>, ItemSet, Selectable<T>, Serializable, ValueComponent<T>, ValueHolder<T,ValueHolder.ValueChangeEvent<T>>
  All Known Subinterfaces:
    ValidatableSingleSelect<T>

      public interface SingleSelect<T>
      extends Selectable<T>, Input<T>, ItemSet

  A `Selectable` component in which at most one item can be selected at a time.
  Since:
    5.0.0

- - ### Nested Class Summary

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

      `Selectable.SelectionEvent<T>, Selectable.SelectionListener<T>, Selectable.SelectionMode`

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

      `Input.InputPropertyRenderer<T>, Input.InputValueConversionException, Input.PropertyHandler<P,T,V extends com.vaadin.flow.component.HasValue<?,T>,C extends com.vaadin.flow.component.Component>`

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

      `ValueHolder.ValueChangeEvent<V>, ValueHolder.ValueChangeListener<V,E extends ValueHolder.ValueChangeEvent<V>>`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> SelectModeSingleSelectInputBuilder.ItemSelectModeSingleSelectInputBuilder<T,T>` | `create(Class<T> type)` Gets a builder to create a `SingleSelect`.
    `static <T,ITEM> SelectModeSingleSelectInputBuilder.ItemSelectModeSingleSelectInputBuilder<T,ITEM>` | `create(Class<T> type, Class<ITEM> itemType, ItemConverter<T,ITEM> itemConverter)` Gets a builder to create a `SingleSelect`.
    `static <T> SelectModeSingleSelectInputBuilder.PropertySelectModeSingleSelectInputBuilder<T>` | `create(com.holonplatform.core.property.Property<T> selectionProperty)` Gets a builder to create a `SingleSelect`, using given selection `Property`.
    `static <T> SelectModeSingleSelectInputBuilder.PropertySelectModeSingleSelectInputBuilder<T>` | `create(com.holonplatform.core.property.Property<T> selectionProperty, Function<T,Optional<com.holonplatform.core.property.PropertyBox>> itemConverter)` Gets a builder to create a `SingleSelect`, using given selection `Property` and converter.
    `default void` | `deselectAll()` Deselects all currently selected items, if any.
    `default Optional<T>` | `getFirstSelectedItem()` Get the first selected item.
    `Optional<T>` | `getSelectedItem()` Get the currently selected item.
    `default Set<T>` | `getSelectedItems()` Get an immutable set of the currently selected items.
    `default Selectable.SelectionMode` | `getSelectionMode()` Get the selection mode
    `static <T> OptionsModeSingleSelectInputBuilder.ItemOptionsModeSingleSelectInputBuilder<T,T>` | `options(Class<T> type)` Gets a builder to create a `SingleSelect` using the options rendering mode, i.e. a radio button group.
    `static <T,ITEM> OptionsModeSingleSelectInputBuilder.ItemOptionsModeSingleSelectInputBuilder<T,ITEM>` | `options(Class<T> type, Class<ITEM> itemType, ItemConverter<T,ITEM> itemConverter)` Gets a builder to create a `SingleSelect` using the options rendering mode, i.e. a radio button group.
    `static <T> OptionsModeSingleSelectInputBuilder.PropertyOptionsModeSingleSelectInputBuilder<T>` | `options(com.holonplatform.core.property.Property<T> selectionProperty)` Gets a builder to create a `SingleSelect`, using given selection `Property` and the options rendering mode, i.e. a radio button group.
    `static <T> OptionsModeSingleSelectInputBuilder.PropertyOptionsModeSingleSelectInputBuilder<T>` | `options(com.holonplatform.core.property.Property<T> selectionProperty, Function<T,Optional<com.holonplatform.core.property.PropertyBox>> itemConverter)` Gets a builder to create a `SingleSelect`, using given selection `Property`, a converter and the options rendering mode, i.e. a radio button group.

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

      `addSelectionListener, deselect, isSelected, select`

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

      `asHasValue, boolean_, builder, builder, date, dateTime, enumMultiSelect, enumOptionSelect, enumSelect, focus, from, from, from, from, from, hasInvalidChangeEventNotifier, hasPlaceholder, hasTitle, isReadOnly, isRequired, localDate, localDateTime, localTime, multiOptionSelect, multiOptionSelect, multiOptionSelect, multiOptionSelect, number, password, setReadOnly, setRequired, singleOptionSelect, singleOptionSelect, singleOptionSelect, singleOptionSelect, singleSelect, singleSelect, singleSelect, singleSelect, string, stringArea`

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

      `addValueChangeListener, clear, getEmptyValue, getValue, getValueIfPresent, isEmpty, setValue`

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

      `getValue, hasValueChangeMode`

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

      `create, getComponent, getElement, hasEnabled, hasLabel, hasSize, hasStyle, hasValidation, isVisible, setVisible`

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

      `refresh`

- - ### Method Detail

    - #### getSelectedItem

          Optional<T> getSelectedItem()

      Get the currently selected item.
      Returns:
        The currently selected item, empty if no item is selected

    - #### getSelectionMode

          default Selectable.SelectionMode getSelectionMode()

      Description copied from interface: `Selectable`
      Get the selection mode
      Specified by:
        `getSelectionMode` in interface `Selectable<T>`
      Returns:
        the selection mode

    - #### getSelectedItems

          default Set<T> getSelectedItems()

      Description copied from interface: `Selectable`
      Get an immutable set of the currently selected items.

      The iteration order of the items in the returned set is implementation dependent.

      Specified by:
        `getSelectedItems` in interface `Selectable<T>`
      Returns:
        Selected items set, empty if none

    - #### getFirstSelectedItem

          default Optional<T> getFirstSelectedItem()

      Description copied from interface: `Selectable`
      Get the first selected item.
      Specified by:
        `getFirstSelectedItem` in interface `Selectable<T>`
      Returns:
        the first selected item, empty if none

    - #### deselectAll

          default void deselectAll()

      Description copied from interface: `Selectable`
      Deselects all currently selected items, if any.
      Specified by:
        `deselectAll` in interface `Selectable<T>`

    - #### create

          static <T> SelectModeSingleSelectInputBuilder.ItemSelectModeSingleSelectInputBuilder<T,T> create(Class<T> type)

      Gets a builder to create a `SingleSelect`.

      This builder can be used when the selection items type and the selection value type are consistent. Use `create(Class, Class, ItemConverter)` if not.

      Specified by:
        `create` in interface `Input<T>`
      Type Parameters:
        `T` - Value type
      Parameters:
        `type` - Selection value type (not null)
      Returns:
        A new `SelectModeSingleSelectInputBuilder.ItemSelectModeSingleSelectInputBuilder`

    - #### create

          static <T,ITEM> SelectModeSingleSelectInputBuilder.ItemSelectModeSingleSelectInputBuilder<T,ITEM> create(Class<T> type,
                                                                                                                   Class<ITEM> itemType,
                                                                                                                   ItemConverter<T,ITEM> itemConverter)

      Gets a builder to create a `SingleSelect`.

      This builder can be used when the selection items type and the selection value type are not consistent (i.e. of different type). When the the selection item and the selection value types are consistent, the `create(Class)` method can be used.

      Type Parameters:
        `T` - Value type
        `ITEM` - Item type
      Parameters:
        `type` - Selection value type (not null)
        `itemType` - Selection items type (not null)
        `itemConverter` - The item converter to use to convert a selection item into a selection (Input) value and back (not null)
      Returns:
        A new `SelectModeSingleSelectInputBuilder.ItemSelectModeSingleSelectInputBuilder`

    - #### create

          static <T> SelectModeSingleSelectInputBuilder.PropertySelectModeSingleSelectInputBuilder<T> create(com.holonplatform.core.property.Property<T> selectionProperty)

      Gets a builder to create a `SingleSelect`, using given selection `Property`.
      Specified by:
        `create` in interface `Input<T>`
      Type Parameters:
        `T` - Value type
      Parameters:
        `selectionProperty` - The property to use to represent the selection value (not null)
      Returns:
        A new `SelectModeSingleSelectInputBuilder.PropertySelectModeSingleSelectInputBuilder`
      See Also:
        `PropertyRendererRegistry`

    - #### create

          static <T> SelectModeSingleSelectInputBuilder.PropertySelectModeSingleSelectInputBuilder<T> create(com.holonplatform.core.property.Property<T> selectionProperty,
                                                                                                             Function<T,Optional<com.holonplatform.core.property.PropertyBox>> itemConverter)

      Gets a builder to create a `SingleSelect`, using given selection `Property` and converter.
      Type Parameters:
        `T` - Value type
      Parameters:
        `selectionProperty` - The property to use to represent the selection value (not null)
        `itemConverter` - The function to use to convert a selection value into the corresponding `PropertyBox` item
      Returns:
        A new `SelectModeSingleSelectInputBuilder.PropertySelectModeSingleSelectInputBuilder`

    - #### options

          static <T> OptionsModeSingleSelectInputBuilder.ItemOptionsModeSingleSelectInputBuilder<T,T> options(Class<T> type)

      Gets a builder to create a `SingleSelect` using the options rendering mode, i.e. a radio button group.

      This builder can be used when the selection items type and the selection value type are consistent. Use `options(Class, Class, ItemConverter)` if not.

      Type Parameters:
        `T` - Value type
      Parameters:
        `type` - Selection value type (not null)
      Returns:
        A new `OptionsModeSingleSelectInputBuilder.ItemOptionsModeSingleSelectInputBuilder`

    - #### options

          static <T,ITEM> OptionsModeSingleSelectInputBuilder.ItemOptionsModeSingleSelectInputBuilder<T,ITEM> options(Class<T> type,
                                                                                                                      Class<ITEM> itemType,
                                                                                                                      ItemConverter<T,ITEM> itemConverter)

      Gets a builder to create a `SingleSelect` using the options rendering mode, i.e. a radio button group.

      This builder can be used when the selection items type and the selection value type are not consistent (i.e. of different type). When the the selection item and the selection value types are consistent, the `options(Class)` method can be used.

      Type Parameters:
        `T` - Value type
        `ITEM` - Item type
      Parameters:
        `type` - Selection value type (not null)
        `itemType` - Selection items type (not null)
        `itemConverter` - The item converter to use to convert a selection item into a selection (Input) value and back (not null)
      Returns:
        A new `OptionsModeSingleSelectInputBuilder.ItemOptionsModeSingleSelectInputBuilder`

    - #### options

          static <T> OptionsModeSingleSelectInputBuilder.PropertyOptionsModeSingleSelectInputBuilder<T> options(com.holonplatform.core.property.Property<T> selectionProperty)

      Gets a builder to create a `SingleSelect`, using given selection `Property` and the options rendering mode, i.e. a radio button group.
      Type Parameters:
        `T` - Value type
      Parameters:
        `selectionProperty` - The property to use to represent the selection value (not null)
      Returns:
        A new `OptionsModeSingleSelectInputBuilder.PropertyOptionsModeSingleSelectInputBuilder`

    - #### options

          static <T> OptionsModeSingleSelectInputBuilder.PropertyOptionsModeSingleSelectInputBuilder<T> options(com.holonplatform.core.property.Property<T> selectionProperty,
                                                                                                                Function<T,Optional<com.holonplatform.core.property.PropertyBox>> itemConverter)

      Gets a builder to create a `SingleSelect`, using given selection `Property`, a converter and the options rendering mode, i.e. a radio button group.
      Type Parameters:
        `T` - Value type
      Parameters:
        `selectionProperty` - The property to use to represent the selection value (not null)
        `itemConverter` - The function to use to convert a selection value into the corresponding `PropertyBox` item
      Returns:
        A new `OptionsModeSingleSelectInputBuilder.PropertyOptionsModeSingleSelectInputBuilder`

Copyright © 2019 The Holon Platform. All rights reserved.