Class FlatValidationIndicator

java.lang.Object
is.codion.plugin.flatlaf.indicator.FlatValidationIndicator
All Implemented Interfaces:
ValidationIndicator

public final class FlatValidationIndicator extends Object implements ValidationIndicator

A FlatLaf based ValidationIndicator implementation, using the FlatLaf 'outline' client property.

FlatLaf carries a value for each of the two severities, FlatClientProperties.OUTLINE_ERROR and FlatClientProperties.OUTLINE_WARNING, along with FlatClientProperties.OUTLINE_SUCCESS.

A success is not the absence of an error, an empty optional field being valid without being a success, it is a state of its own, a repeated password matching or a code having been verified. It is thereby specified per component, by way of an instance based on the success state: validationIndicator(new FlatValidationIndicator(success))

  • Constructor Details

    • FlatValidationIndicator

      public FlatValidationIndicator()
      Instantiates a new FlatValidationIndicator, one never indicating success
    • FlatValidationIndicator

      public FlatValidationIndicator(ObservableState success)
      Instantiates a new FlatValidationIndicator, indicating success while the given state is enabled, unless the value is invalid or warned, those taking precedence. Note that the success state applies to each component this indicator is enabled for, such an instance is meant for a single component.
      Parameters:
      success - the success state
      See Also:
      • FlatClientProperties.OUTLINE_SUCCESS
  • Method Details

    • enable

      public void enable(JComponent component, ObservableState invalid, ObservableState warned)
      Description copied from interface: ValidationIndicator
      Enables the validation indicator for the given component
      Specified by:
      enable in interface ValidationIndicator
      Parameters:
      component - the component
      invalid - the invalid state observer, true while the value may not be saved
      warned - the warned state observer, true while the value carries a warning. Independent of invalid, a value can be both, in which case the invalid presentation wins