Module is.codion.swing.common.ui
Interface ValidationIndicator
- All Known Implementing Classes:
BackgroundColorValidationIndicator,FlatLafValidationIndicator
public interface ValidationIndicator
Provides a validation indicator for a component, over the two severities validation has: a value that is invalid and may not be saved, and one that is merely warned about — permitted, but implausible enough to be worth a second look.
Both severities go through one indicator rather than two, because they share a visual channel and the precedence between them (invalid wins) has to be decided in one place.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<String> Specified theValidationIndicatorto use. -
Method Summary
Modifier and TypeMethodDescriptionvoidenable(JComponent component, ObservableState valid, ObservableState warned) Enables the validation indicator for the given componentstatic Optional<ValidationIndicator> instance()Returns an instance from theServiceLoader, of the type specified byINDICATOR_CLASSstatic Optional<ValidationIndicator> Returns an instance from theServiceLoader, of the type specified byindicatorClassName
-
Field Details
-
INDICATOR_CLASS
Specified theValidationIndicatorto use.
-
-
Method Details
-
enable
Enables the validation indicator for the given component- Parameters:
component- the componentvalid- the valid state observer, false while the value may not be savedwarned- the warned state observer, true while the value carries a warning. Independent of [valid] — a value can be both, in which case the invalid presentation wins
-
instance
Returns an instance from theServiceLoader, of the type specified byINDICATOR_CLASS- Returns:
- an instance from the
ServiceLoaderor an emptyOptionalin case one is not found
-
instance
Returns an instance from theServiceLoader, of the type specified byindicatorClassName- Returns:
- an instance from the
ServiceLoaderor an emptyOptionalin case one is not found
-