com.holonplatform.vaadin.components

## Interface Input<V>

- Type Parameters:
    `V` - Value type
  All Superinterfaces:
    HasComponent, Serializable, ValueComponent<V>, ValueHolder<V>, ValueHolder.MaySupportValueChangeMode
  All Known Subinterfaces:
    MultiSelect<T>, SingleSelect<T>, ValidatableInput<V>

      public interface Input<V>
      extends ValueHolder<V>, ValueComponent<V>, ValueHolder.MaySupportValueChangeMode

  Input component representation, i.e. a UI component that has a user-editable value.

  Extends `ValueHolder` since handles a value, supporting `ValueChangeListener`s registration.

  The actual UI `Component` which represents the input component can be obtained through `HasComponent.getComponent()`.

  Extends `ValueHolder.MaySupportValueChangeMode` to allow value change mode and timeout configuration for input components which support it.

  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `Input.InputFieldPropertyRenderer<T,F extends com.vaadin.data.HasValue<T> & com.vaadin.ui.Component>` A convenience interface to render a `Property` as a `Input` using a `HasValue` component.
    `static interface` | `Input.InputPropertyRenderer<T>` A convenience interface with a fixed `Input` rendering type to use a `Input` `PropertyRenderer` as a functional interface.

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

      `ValueHolder.MaySupportValueChangeMode, ValueHolder.ValueChangeEvent<V>, ValueHolder.ValueChangeListener<V>`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `focus()` Sets the focus for this input component, if supported by concrete component implementation.
    `static <F extends com.vaadin.data.HasValue<T> & com.vaadin.ui.Component,T> Input<T>` | `from(F field)` Create a `Input` component type from given `HasValue` component.
    `static <F extends com.vaadin.data.HasValue<V> & com.vaadin.ui.Component,T,V> Input<T>` | `from(F field, com.vaadin.data.Converter<V,T> converter)` Create a new `Input` from given `HasValue` component with a different value type, using given `Converter` to perform value conversions.
    `static <F extends com.vaadin.data.HasValue<V> & com.vaadin.ui.Component,T,V> Input<T>` | `from(F field, com.holonplatform.core.property.Property<T> property, com.holonplatform.core.property.PropertyValueConverter<T,V> converter)` Create a new `Input` from another `Input` with a different value type, using given `PropertyValueConverter` to perform value conversions.
    `static <T,V> Input<T>` | `from(Input<V> input, com.vaadin.data.Converter<V,T> converter)` Create a new `Input` from another `Input` with a different value type, using given `Converter` to perform value conversions.
    `static <T,V> Input<T>` | `from(Input<V> input, com.holonplatform.core.property.Property<T> property, com.holonplatform.core.property.PropertyValueConverter<T,V> converter)` Create a new `Input` from another `Input` with a different value type, using given `PropertyValueConverter` to perform value conversions.
    `default com.vaadin.shared.ui.ValueChangeMode` | `getValueChangeMode()` Get the mode how value change events are triggered.
    `default int` | `getValueChangeTimeout()` Returns the currently set timeout, in milliseconds, for how often `ValueHolder.ValueChangeEvent`s are triggered if the current `ValueChangeMode` is set to either `ValueChangeMode.LAZY` or `ValueChangeMode.TIMEOUT`.
    `boolean` | `isReadOnly()` Returns whether this input component is in read-only mode or not.
    `boolean` | `isRequired()` Gets whether the field is required, i.e. a required indicator symbol is visible.
    `default boolean` | `isValueChangeModeSupported()` Gets whether the `ValueChangeMode` is supported for this component.
    `void` | `setReadOnly(boolean readOnly)` Sets the read-only mode of this input component.
    `void` | `setRequired(boolean required)` Sets whether the required indicator symbol is visible.
    `default void` | `setValueChangeMode(com.vaadin.shared.ui.ValueChangeMode valueChangeMode)` Sets the mode how value change events are triggered.
    `default void` | `setValueChangeTimeout(int valueChangeTimeout)` Sets how often value change events are triggered when the `ValueChangeMode` is set to either `ValueChangeMode.LAZY` or `ValueChangeMode.TIMEOUT`.

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

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

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

      `getValue`

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

      `getComponent`

- - ### Method Detail

    - #### setReadOnly

          void setReadOnly(boolean readOnly)

      Sets the read-only mode of this input component. The user can't change the value when in read-only mode.
      Parameters:
        `readOnly` - the read-only mode of this input component

    - #### isReadOnly

          boolean isReadOnly()

      Returns whether this input component is in read-only mode or not.
      Returns:
        `false` if the user can modify the value, `true` if not

    - #### isRequired

          boolean isRequired()

      Gets whether the field is required, i.e. a required indicator symbol is visible.
      Returns:
        `true` if the field as required, `false` otherwise

    - #### setRequired

          void setRequired(boolean required)

      Sets whether the required indicator symbol is visible.
      Parameters:
        `required` - `true` to set the field as required, `false` otherwise

    - #### focus

          void focus()

      Sets the focus for this input component, if supported by concrete component implementation.

    - #### isValueChangeModeSupported

          default boolean isValueChangeModeSupported()

      Description copied from interface: `ValueHolder.MaySupportValueChangeMode`
      Gets whether the `ValueChangeMode` is supported for this component.
      Specified by:
        `isValueChangeModeSupported` in interface `ValueHolder.MaySupportValueChangeMode`
      Returns:
        `true` if the `ValueChangeMode` is supported, `false` otherwise

    - #### setValueChangeMode

          default void setValueChangeMode(com.vaadin.shared.ui.ValueChangeMode valueChangeMode)

      Description copied from interface: `ValueHolder.MaySupportValueChangeMode`
      Sets the mode how value change events are triggered.

      If `ValueChangeMode` is not supported, this method has no effect.

      Specified by:
        `setValueChangeMode` in interface `ValueHolder.MaySupportValueChangeMode`
      Parameters:
        `valueChangeMode` - the value change mode to set (not null)
      See Also:
        `ValueHolder.MaySupportValueChangeMode.isValueChangeModeSupported()`

    - #### getValueChangeMode

          default com.vaadin.shared.ui.ValueChangeMode getValueChangeMode()

      Description copied from interface: `ValueHolder.MaySupportValueChangeMode`
      Get the mode how value change events are triggered.

      If `ValueChangeMode` is not supported, `ValueChangeMode.BLUR` is returned.

      Specified by:
        `getValueChangeMode` in interface `ValueHolder.MaySupportValueChangeMode`
      Returns:
        the value change mode
      See Also:
        `ValueHolder.MaySupportValueChangeMode.isValueChangeModeSupported()`

    - #### setValueChangeTimeout

          default void setValueChangeTimeout(int valueChangeTimeout)

      Description copied from interface: `ValueHolder.MaySupportValueChangeMode`
      Sets how often value change events are triggered when the `ValueChangeMode` is set to either `ValueChangeMode.LAZY` or `ValueChangeMode.TIMEOUT`.

      If `ValueChangeMode` is not supported, this method has no effect.

      Specified by:
        `setValueChangeTimeout` in interface `ValueHolder.MaySupportValueChangeMode`
      Parameters:
        `valueChangeTimeout` - the timeout in milliseconds, (greater or equal to 0)
      See Also:
        `ValueHolder.MaySupportValueChangeMode.isValueChangeModeSupported()`

    - #### getValueChangeTimeout

          default int getValueChangeTimeout()

      Description copied from interface: `ValueHolder.MaySupportValueChangeMode`
      Returns the currently set timeout, in milliseconds, for how often `ValueHolder.ValueChangeEvent`s are triggered if the current `ValueChangeMode` is set to either `ValueChangeMode.LAZY` or `ValueChangeMode.TIMEOUT`.

      If `ValueChangeMode` is not supported, this method always returns `-1`.

      Specified by:
        `getValueChangeTimeout` in interface `ValueHolder.MaySupportValueChangeMode`
      Returns:
        the timeout in milliseconds of how often value change events are triggered.
      See Also:
        `ValueHolder.MaySupportValueChangeMode.isValueChangeModeSupported()`

    - #### from

          static <F extends com.vaadin.data.HasValue<T> & com.vaadin.ui.Component,T> Input<T> from(F field)

      Create a `Input` component type from given `HasValue` component.
      Type Parameters:
        `T` - Value type
        `F` - `HasValue` component type
      Parameters:
        `field` - The field instance (not null)
      Returns:
        A new `Input` component which wraps the given `field`

    - #### from

          static <T,V> Input<T> from(Input<V> input,
                                     com.vaadin.data.Converter<V,T> converter)

      Create a new `Input` from another `Input` with a different value type, using given `Converter` to perform value conversions.
      Type Parameters:
        `T` - New value type
        `V` - Original value type
      Parameters:
        `input` - Actual input (not null)
        `converter` - Value converter (not null)
      Returns:
        A new `Input` of the converted value type

    - #### from

          static <F extends com.vaadin.data.HasValue<V> & com.vaadin.ui.Component,T,V> Input<T> from(F field,
                                                                                                     com.vaadin.data.Converter<V,T> converter)

      Create a new `Input` from given `HasValue` component with a different value type, using given `Converter` to perform value conversions.
      Type Parameters:
        `F` - `HasValue` component type
        `T` - New value type
        `V` - Original value type
      Parameters:
        `field` - The field (not null)
        `converter` - Value converter (not null)
      Returns:
        A new `Input` of the converted value type

    - #### from

          static <T,V> Input<T> from(Input<V> input,
                                     com.holonplatform.core.property.Property<T> property,
                                     com.holonplatform.core.property.PropertyValueConverter<T,V> converter)

      Create a new `Input` from another `Input` with a different value type, using given `PropertyValueConverter` to perform value conversions.
      Type Parameters:
        `T` - New value type
        `V` - Original value type
      Parameters:
        `input` - Actual input (not null)
        `property` - Property to provide to the converter
        `converter` - Value converter (not null)
      Returns:
        A new `Input` of the converted value type

    - #### from

          static <F extends com.vaadin.data.HasValue<V> & com.vaadin.ui.Component,T,V> Input<T> from(F field,
                                                                                                     com.holonplatform.core.property.Property<T> property,
                                                                                                     com.holonplatform.core.property.PropertyValueConverter<T,V> converter)

      Create a new `Input` from another `Input` with a different value type, using given `PropertyValueConverter` to perform value conversions.
      Type Parameters:
        `F` - `HasValue` component type
        `T` - New value type
        `V` - Original value type
      Parameters:
        `field` - The field (not null)
        `property` - Property to provide to the converter
        `converter` - Value converter (not null)
      Returns:
        A new `Input` of the converted value type

Copyright © 2019 The Holon Platform. All rights reserved.