com.holonplatform.vaadin.flow.components

## Interface ValidationStatusHandler<S>

- Type Parameters:
    `S` - Validation source type
  All Superinterfaces:
    Serializable
  Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface ValidationStatusHandler<S>
      extends Serializable

  Handler for validation status change events, typically bound to a `ValueComponent` source object.
  Since:
    5.2.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `ValidationStatusHandler.Status` Validation status.
    `static interface` | `ValidationStatusHandler.ValidationStatusEvent<S>` 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<S>` | `dialog()` Create a `ValidationStatusHandler` which shows a `Dialog` to notify validation errors.
    `static <S extends HasComponent> ValidationStatusHandler<S>` | `getDefault()` Create and return the default `ValidationStatusHandler` for `HasComponent` types.
    `static <S extends HasComponent> ValidationStatusHandler<S>` | `getDefault(ValidationStatusHandler<S> fallback)` Create and return the default `ValidationStatusHandler` for `HasComponent` types.
    `static <S,L extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasText> ValidationStatusHandler<S>` | `label(L statusLabel)` Create a `ValidationStatusHandler` which uses a `HasText` component to notify validation errors.
    `static <S,L extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasText> ValidationStatusHandler<S>` | `label(L statusLabel, boolean hideWhenValid)` Create a `ValidationStatusHandler` which uses a `HasText` component to notify validation errors.
    `static <S> ValidationStatusHandler<S>` | `notification()` Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.
    `static <S> ValidationStatusHandler<S>` | `notification(boolean showAllErrors)` Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.
    `static <S> ValidationStatusHandler<S>` | `notification(com.vaadin.flow.component.notification.Notification notification)` Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.
    `static <S> ValidationStatusHandler<S>` | `notification(com.vaadin.flow.component.notification.Notification notification, boolean showAllErrors)` Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.
    `void` | `validationStatusChange(ValidationStatusHandler.ValidationStatusEvent<S> statusChangeEvent)` Invoked when the validation status has changed.

- - ### Method Detail

    - #### validationStatusChange

          void validationStatusChange(ValidationStatusHandler.ValidationStatusEvent<S> statusChangeEvent)

      Invoked when the validation status has changed.
      Parameters:
        `statusChangeEvent` - the changed status event, providing validation status and error messages

    - #### getDefault

          static <S extends HasComponent> ValidationStatusHandler<S> getDefault()

      Create and return the default `ValidationStatusHandler` for `HasComponent` types.

      The default validation status handler uses {`HasValidation.setErrorMessage(String)` to notify the validation status on the value component against whom the validation is performed, if the component implements `HasValidation`.

      If the component against whom the validation is performed does not implement `HasValidation`, a warning is logged.

      Type Parameters:
        `S` - Validation source
      Returns:
        A new default `ValidationStatusHandler` instance

    - #### getDefault

          static <S extends HasComponent> ValidationStatusHandler<S> getDefault(ValidationStatusHandler<S> fallback)

      Create and return the default `ValidationStatusHandler` for `HasComponent` types.

      The default validation status handler uses {`HasValidation.setErrorMessage(String)` to notify the validation status on the value component against whom the validation is performed, if the component implements `HasValidation`.

      If the component against whom the validation is performed does not implement `HasValidation`, a warning is logged.

      Type Parameters:
        `S` - Validation source
      Parameters:
        `fallback` - The `ValidationStatusHandler` to use when the component on which the validation failed has not validation support
      Returns:
        A new default `ValidationStatusHandler` instance

    - #### label

          static <S,L extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasText> ValidationStatusHandler<S> label(L statusLabel)

      Create a `ValidationStatusHandler` which uses a `HasText` component to notify validation errors.

      By default, the status label is set to visible only when the validation status is invalid, i.e. a validation error to display is available.

      Type Parameters:
        `S` - Validation source
        `L` - Label component type
      Parameters:
        `statusLabel` - The `HasText` component to use to notify validation errors (not null)
      Returns:
        A new validation status handler instance

    - #### label

          static <S,L extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasText> ValidationStatusHandler<S> label(L statusLabel,
                                                                                                                                        boolean hideWhenValid)

      Create a `ValidationStatusHandler` which uses a `HasText` component to notify validation errors.
      Type Parameters:
        `S` - Validation source
        `L` - Label component type
      Parameters:
        `statusLabel` - The `HasText` component to use to notify validation errors (not null)
        `hideWhenValid` - whether to hide the component when the validation status is not invalid
      Returns:
        A new validation status handler instance

    - #### notification

          static <S> ValidationStatusHandler<S> notification()

      Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.

      This methods creates a notification validation status handler which displays only the first validation error.

      Type Parameters:
        `S` - Validation source
      Returns:
        A new notification validation status handler instance

    - #### notification

          static <S> ValidationStatusHandler<S> notification(boolean showAllErrors)

      Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.
      Type Parameters:
        `S` - Validation source
      Parameters:
        `showAllErrors` - `true` to display all validation errors, `false` to show only the first
      Returns:
        A new notification validation status handler instance

    - #### notification

          static <S> ValidationStatusHandler<S> notification(com.vaadin.flow.component.notification.Notification notification)

      Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.

      This methods creates a notification validation status handler which displays only the first validation error.

      Type Parameters:
        `S` - Validation source
      Parameters:
        `notification` - The notification instance to use, `null` for default
      Returns:
        A new notification validation status handler instance

    - #### notification

          static <S> ValidationStatusHandler<S> notification(com.vaadin.flow.component.notification.Notification notification,
                                                             boolean showAllErrors)

      Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.
      Type Parameters:
        `S` - Validation source
      Parameters:
        `notification` - The notification instance to use, `null` for default
        `showAllErrors` - `true` to display all validation errors, `false` to show only the first
      Returns:
        A new notification validation status handler instance

    - #### dialog

          static <S> ValidationStatusHandler<S> dialog()

      Create a `ValidationStatusHandler` which shows a `Dialog` to notify validation errors.
      Type Parameters:
        `S` - Validation source
      Returns:
        A new `Dialog` notification validation status handler instance

Copyright © 2019 The Holon Platform. All rights reserved.