com.holonplatform.vaadin.flow.components

## Interface ValidationStatusHandler.ValidationStatusEvent<S>

- Type Parameters:
    `S` - Validation source
  All Superinterfaces:
    Serializable
  All Known Subinterfaces:
    GroupValidationStatusHandler.GroupElementValidationStatusEvent<S,P,E>
  Enclosing interface:
    ValidationStatusHandler<S>

      public static interface ValidationStatusHandler.ValidationStatusEvent<S>
      extends Serializable

  A validation status event.

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <S> ValidationStatusHandler.ValidationStatusEvent<S>` | `create(S source, ValidationStatusHandler.Status status, List<com.holonplatform.core.i18n.Localizable> errors)` Create a new `ValidationStatusHandler.ValidationStatusEvent`.
    `static <S> ValidationStatusHandler.ValidationStatusEvent<S>` | `create(S source, ValidationStatusHandler.Status status, com.holonplatform.core.i18n.Localizable error)` Create a new `ValidationStatusHandler.ValidationStatusEvent`.
    `default Optional<com.holonplatform.core.i18n.Localizable>` | `getError()` Get the first `Localizable` validation error message, if the validation status is `ValidationStatusHandler.Status.INVALID`.
    `default String` | `getErrorMessage()` Get the first localized error message.
    `default List<String>` | `getErrorMessages()` Get the localized error messages from `getErrors()`.
    `List<com.holonplatform.core.i18n.Localizable>` | `getErrors()` Get the `Localizable` validation error messages, if the validation status is `ValidationStatusHandler.Status.INVALID`.
    `S` | `getSource()` Ge the validation event source
    `ValidationStatusHandler.Status` | `getStatus()` Get the validation status.
    `static <S> ValidationStatusHandler.ValidationStatusEvent<S>` | `invalid(S source, List<com.holonplatform.core.i18n.Localizable> errors)` Create a new `ValidationStatusHandler.ValidationStatusEvent` for `ValidationStatusHandler.Status.INVALID`.
    `static <S> ValidationStatusHandler.ValidationStatusEvent<S>` | `invalid(S source, com.holonplatform.core.i18n.Localizable error)` Create a new `ValidationStatusHandler.ValidationStatusEvent` for `ValidationStatusHandler.Status.INVALID`.
    `default boolean` | `isInvalid()` Gets whether the validation failed or not.
    `static <S> ValidationStatusHandler.ValidationStatusEvent<S>` | `unresolved(S source)` Create a new `ValidationStatusHandler.ValidationStatusEvent` for `ValidationStatusHandler.Status.UNRESOLVED`.
    `static <S> ValidationStatusHandler.ValidationStatusEvent<S>` | `valid(S source)` Create a new `ValidationStatusHandler.ValidationStatusEvent` for `ValidationStatusHandler.Status.VALID`.

- - ### Method Detail

    - #### getSource

          S getSource()

      Ge the validation event source
      Returns:
        the validation event source.

    - #### getStatus

          ValidationStatusHandler.Status getStatus()

      Get the validation status.
      Returns:
        the validation status (never null)

    - #### isInvalid

          default boolean isInvalid()

      Gets whether the validation failed or not.
      Returns:
        `true` if validation failed (i.e. the validation status is `ValidationStatusHandler.Status.INVALID`), `false` otherwise

    - #### getErrors

          List<com.holonplatform.core.i18n.Localizable> getErrors()

      Get the `Localizable` validation error messages, if the validation status is `ValidationStatusHandler.Status.INVALID`.
      Returns:
        the validation error messages when in invalid state, an empty list if none

    - #### getErrorMessages

          default List<String> getErrorMessages()

      Get the localized error messages from `getErrors()`.
      Returns:
        the localized error messages, an empty list if none.
      See Also:
        `LocalizationProvider`

    - #### getError

          default Optional<com.holonplatform.core.i18n.Localizable> getError()

      Get the first `Localizable` validation error message, if the validation status is `ValidationStatusHandler.Status.INVALID`.
      Returns:
        the optional first `Localizable` validation error message when in invalid state

    - #### getErrorMessage

          default String getErrorMessage()

      Get the first localized error message.
      Returns:
        the first localized error message, or `null` if none
      See Also:
        `LocalizationProvider`

    - #### create

          static <S> ValidationStatusHandler.ValidationStatusEvent<S> create(S source,
                                                                             ValidationStatusHandler.Status status,
                                                                             List<com.holonplatform.core.i18n.Localizable> errors)

      Create a new `ValidationStatusHandler.ValidationStatusEvent`.
      Type Parameters:
        `S` - Validation source
      Parameters:
        `source` - Event source (not null)
        `status` - Validation status (not null)
        `errors` - Validation errors
      Returns:
        A new `ValidationStatusHandler.ValidationStatusEvent`

    - #### create

          static <S> ValidationStatusHandler.ValidationStatusEvent<S> create(S source,
                                                                             ValidationStatusHandler.Status status,
                                                                             com.holonplatform.core.i18n.Localizable error)

      Create a new `ValidationStatusHandler.ValidationStatusEvent`.
      Type Parameters:
        `S` - Validation source
      Parameters:
        `source` - Event source (not null)
        `status` - Validation status (not null)
        `error` - Validation error
      Returns:
        A new `ValidationStatusHandler.ValidationStatusEvent`

    - #### unresolved

          static <S> ValidationStatusHandler.ValidationStatusEvent<S> unresolved(S source)

      Create a new `ValidationStatusHandler.ValidationStatusEvent` for `ValidationStatusHandler.Status.UNRESOLVED`.
      Type Parameters:
        `S` - Validation source
      Parameters:
        `source` - Event source (not null)
      Returns:
        A new `ValidationStatusHandler.ValidationStatusEvent`

    - #### valid

          static <S> ValidationStatusHandler.ValidationStatusEvent<S> valid(S source)

      Create a new `ValidationStatusHandler.ValidationStatusEvent` for `ValidationStatusHandler.Status.VALID`.
      Type Parameters:
        `S` - Validation source
      Parameters:
        `source` - Event source (not null)
      Returns:
        A new `ValidationStatusHandler.ValidationStatusEvent`

    - #### invalid

          static <S> ValidationStatusHandler.ValidationStatusEvent<S> invalid(S source,
                                                                              List<com.holonplatform.core.i18n.Localizable> errors)

      Create a new `ValidationStatusHandler.ValidationStatusEvent` for `ValidationStatusHandler.Status.INVALID`.
      Type Parameters:
        `S` - Validation source
      Parameters:
        `source` - Event source (not null)
        `errors` - Validation errors
      Returns:
        A new `ValidationStatusHandler.ValidationStatusEvent`

    - #### invalid

          static <S> ValidationStatusHandler.ValidationStatusEvent<S> invalid(S source,
                                                                              com.holonplatform.core.i18n.Localizable error)

      Create a new `ValidationStatusHandler.ValidationStatusEvent` for `ValidationStatusHandler.Status.INVALID`.
      Type Parameters:
        `S` - Validation source
      Parameters:
        `source` - Event source (not null)
        `error` - Validation error
      Returns:
        A new `ValidationStatusHandler.ValidationStatusEvent`

Copyright © 2019 The Holon Platform. All rights reserved.