com.holonplatform.vaadin.components

## Interface ValidationStatusHandler

- 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

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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `ValidationStatusHandler.Status` Validation status.
    `static interface` | `ValidationStatusHandler.ValidationStatusEvent<V>` A validation status event.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ValidationStatusHandler` | `getDefault()` Create and return the default `ValidationStatusHandler`.
    `static ValidationStatusHandler` | `label(com.vaadin.ui.Label statusLabel)` Create a `ValidationStatusHandler` which uses a `Label` to notify validation errors.
    `static ValidationStatusHandler` | `label(com.vaadin.ui.Label statusLabel, boolean hideWhenValid)` Create a `ValidationStatusHandler` which uses a `Label` to notify validation errors.
    `static ValidationStatusHandler` | `notification()` Create a `ValidationStatusHandler` which shows a `Notification` of type `Notification.TYPE_ERROR_MESSAGE` to notify validation errors.
    `static ValidationStatusHandler` | `notification(boolean showAllErrors)` Create a `ValidationStatusHandler` which shows a `Notification` of type `Notification.TYPE_ERROR_MESSAGE` to notify validation errors.
    `static ValidationStatusHandler` | `notification(com.vaadin.ui.Notification notification)` Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.
    `static ValidationStatusHandler` | `notification(com.vaadin.ui.Notification notification, boolean showAllErrors)` Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.
    `void` | `validationStatusChange(ValidationStatusHandler.ValidationStatusEvent<?> statusChangeEvent)` Invoked when the validation status has changed.

- - ### Method Detail

    - #### validationStatusChange

          void validationStatusChange(ValidationStatusHandler.ValidationStatusEvent<?> statusChangeEvent)

      Invoked when the validation status has changed.
      Parameters:
        `statusChangeEvent` - the changed status event, providing validation status, error message and the optional source component

    - #### getDefault

          static ValidationStatusHandler getDefault()

      Create and return the default `ValidationStatusHandler`.

      The default validation status handler uses `AbstractComponent.setComponentError(com.vaadin.server.ErrorMessage)` to notify the validation status on the value component against whom the validation is performed, if it is available and the component returned by `HasComponent.getComponent()` is an `AbstractComponent` instance.

      Returns:
        A new default `ValidationStatusHandler` instance

    - #### label

          static ValidationStatusHandler label(com.vaadin.ui.Label statusLabel)

      Create a `ValidationStatusHandler` which uses a `Label` 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.

      Parameters:
        `statusLabel` - The `Label` to use to notify validation errors (not null)
      Returns:
        A new `Label` validation status handler instance

    - #### label

          static ValidationStatusHandler label(com.vaadin.ui.Label statusLabel,
                                               boolean hideWhenValid)

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

    - #### notification

          static ValidationStatusHandler notification()

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

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

      Returns:
        A new notification validation status handler instance

    - #### notification

          static ValidationStatusHandler notification(boolean showAllErrors)

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

    - #### notification

          static ValidationStatusHandler notification(com.vaadin.ui.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.

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

    - #### notification

          static ValidationStatusHandler notification(com.vaadin.ui.Notification notification,
                                                      boolean showAllErrors)

      Create a `ValidationStatusHandler` which shows a `Notification` to notify validation errors.
      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

Copyright © 2019 The Holon Platform. All rights reserved.