Class ValidationController<C extends Component & HasValidator<V> & HasValidation,V>
java.lang.Object
com.vaadin.flow.component.shared.internal.ValidationController<C,V>
- Type Parameters:
C
- Type of the component that uses this controller.V
- Type of the value of the extending component.
- All Implemented Interfaces:
Serializable
public class ValidationController<C extends Component & HasValidator<V> & HasValidation,V>
extends Object
implements Serializable
An internal controller for managing the validation state of a component. Not
intended to be used publicly.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
setManualValidation
(boolean enabled) Sets whether manual validation mode is enabled.void
Validates the given value using the component's validator and sets theinvalid
anderrorMessage
properties based on the result.
-
Constructor Details
-
ValidationController
-
-
Method Details
-
setManualValidation
public void setManualValidation(boolean enabled) Sets whether manual validation mode is enabled.When enabled, the
validate(V)
method skips validation, allowing the invalid state and error messages to be controlled manually.- Parameters:
enabled
- true to enable manual validation, false to disable
-
validate
Validates the given value using the component's validator and sets theinvalid
anderrorMessage
properties based on the result. If a custom error message is provided with#setErrorMessage(String)
, it is used. Otherwise, the error message from the validator is used.The method skips validation if the manual validation mode is enabled, see
setManualValidation(boolean)
.- Parameters:
value
- the value to validate
-