com.holonplatform.vaadin.flow.components

## Interface ValidatableInput<T>

- Type Parameters:
    `T` - Value type
  All Superinterfaces:
    HasComponent, com.vaadin.flow.component.HasElement, Input<T>, Serializable, Validatable, ValueComponent<T>, ValueHolder<T,ValueHolder.ValueChangeEvent<T>>
  All Known Subinterfaces:
    ValidatableMultiSelect<T>, ValidatableSingleSelect<T>

      public interface ValidatableInput<T>
      extends Input<T>, Validatable

  An `Input` component with validation support using `Validator`s.
  Since:
    5.2.0

- - ### Nested Class Summary

    - ### 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
    --- | ---
    `com.holonplatform.core.Registration` | `addValidator(com.holonplatform.core.Validator<T> validator)` Adds a `Validator` to validate the input value.
    `static <T> ValidatableInputBuilder<T>` | `builder(Input<T> input)` Get a fluent builder to create and setup a `ValidatableInput` from given `Input`.
    `static <T> ValidatableInput<T>` | `create(com.holonplatform.core.property.Property<T> property)` Get a `ValidatableInput` component to handle the value of given `property`.
    `static <T> Optional<ValidatableInput<T>>` | `forProperty(com.holonplatform.core.property.Property<T> property)` Try to obtain a `ValidatableInput` component to handle the value of given `property`.
    `static <F extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,T>,T> ValidatableInput<T>` | `from(F field)` Create a `ValidatableInput` component type from given `HasValue` component.
    `static <T> ValidatableInput<T>` | `from(Input<T> input)` Create a `ValidatableInput` from given `Input` instance.
    `Optional<ValidationStatusHandler<ValidatableInput<T>>>` | `getValidationStatusHandler()` Get the `ValidationStatusHandler` to use to track validation status changes, if available.
    `T` | `getValue()` Get the input value.
    `boolean` | `isValidateOnValueChange()` Gets whether to validate the value, using registered `Validator`s, every time the `Input` value changes.
    `void` | `setValidateOnValueChange(boolean validateOnValueChange)` Sets whether to validate the value, using registered `Validator`s, every time the `Input` value changes.
    `void` | `setValidationStatusHandler(ValidationStatusHandler<ValidatableInput<T>> validationStatusHandler)` Set the `ValidationStatusHandler` to use to track validation status changes.

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

      `asHasValue, boolean_, builder, create, date, dateTime, enumMultiSelect, enumOptionSelect, enumSelect, focus, 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, getValueIfPresent, isEmpty, setValue`

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

      `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.Validatable

      `adapt, adapt, adapt, adapt, adapt, isValid, validate`

- - ### Method Detail

    - #### getValue

          T getValue()

      Get the input value.

      The value is validated using the registered `Validator`s, if any, and a `Validator.ValidationException` is thrown if any validator fail.

      Specified by:
        `getValue` in interface `ValueComponent<T>`
      Specified by:
        `getValue` in interface `ValueHolder<T,ValueHolder.ValueChangeEvent<T>>`
      Returns:
        the input value
      Throws:
        `com.holonplatform.core.Validator.ValidationException` - If validation fails

    - #### addValidator

          com.holonplatform.core.Registration addValidator(com.holonplatform.core.Validator<T> validator)

      Adds a `Validator` to validate the input value.
      Parameters:
        `validator` - The validator to add (not null)
      Returns:
        The validator registration reference

    - #### setValidateOnValueChange

          void setValidateOnValueChange(boolean validateOnValueChange)

      Sets whether to validate the value, using registered `Validator`s, every time the `Input` value changes.
      Parameters:
        `validateOnValueChange` - `true` to perform value validation every time the `Input` value changes, `false` if not

    - #### isValidateOnValueChange

          boolean isValidateOnValueChange()

      Gets whether to validate the value, using registered `Validator`s, every time the `Input` value changes.
      Returns:
        `true` if the value validation must be performed every time the `Input` value changes

    - #### setValidationStatusHandler

          void setValidationStatusHandler(ValidationStatusHandler<ValidatableInput<T>> validationStatusHandler)

      Set the `ValidationStatusHandler` to use to track validation status changes.
      Parameters:
        `validationStatusHandler` - the `ValidationStatusHandler` to set

    - #### getValidationStatusHandler

          Optional<ValidationStatusHandler<ValidatableInput<T>>> getValidationStatusHandler()

      Get the `ValidationStatusHandler` to use to track validation status changes, if available.
      Returns:
        the optional `ValidationStatusHandler`

    - #### from

          static <T> ValidatableInput<T> from(Input<T> input)

      Create a `ValidatableInput` from given `Input` instance.
      Specified by:
        `from` in interface `Input<T>`
      Type Parameters:
        `T` - Value type
      Parameters:
        `input` - The `Input` instance (not null)
      Returns:
        A new `ValidatableInput` component which wraps the given `input`

    - #### from

          static <F extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,T>,T> ValidatableInput<T> from(F field)

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

    - #### builder

          static <T> ValidatableInputBuilder<T> builder(Input<T> input)

      Get a fluent builder to create and setup a `ValidatableInput` from given `Input`.
      Specified by:
        `builder` in interface `Input<T>`
      Type Parameters:
        `T` - Value type
      Parameters:
        `input` - Concrete input component (not null)
      Returns:
        `ValidatableInput` builder

    - #### forProperty

          static <T> Optional<ValidatableInput<T>> forProperty(com.holonplatform.core.property.Property<T> property)

      Try to obtain a `ValidatableInput` component to handle the value of given `property`.

      The current `PropertyRendererRegistry` is used to look for a suitable `PropertyRenderer` to render the `ValidatableInput` using the provided `Property`.

      Type Parameters:
        `T` - Property type
      Parameters:
        `property` - The property for which to obtain the `ValidatableInput` (not null)
      Returns:
        Optional property `ValidatableInput` component
      See Also:
        `PropertyRendererRegistry.get()`

    - #### create

          static <T> ValidatableInput<T> create(com.holonplatform.core.property.Property<T> property)

      Get a `ValidatableInput` component to handle the value of given `property`.

      The current `PropertyRendererRegistry` is used to look for a suitable `PropertyRenderer` to render the `ValidatableInput` using the provided `Property`.

      Specified by:
        `create` in interface `Input<T>`
      Type Parameters:
        `T` - Property type
      Parameters:
        `property` - The property for which to obtain the `ValidatableInput` (not null)
      Returns:
        The property `ValidatableInput` component
      Throws:
        `com.holonplatform.core.property.PropertyRendererRegistry.NoSuitableRendererAvailableException` - If a suitable PropertyRenderer is not available to render given property as a ValidatableInput
      See Also:
        `PropertyRendererRegistry.get()`

Copyright © 2019 The Holon Platform. All rights reserved.