Package io.jmix.flowui.component
Interface SupportsValidation<V>
- Type Parameters:
V- the type of the value that the component handles
- All Superinterfaces:
com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasValidation,com.vaadin.flow.component.shared.HasValidationProperties,Serializable
- All Known Implementing Classes:
AbstractConfigurationDetail,AbstractIntervalField,CodeEditor,DateRangePicker,EntityComboBox,EntityPicker,FileStorageUploadField,FileUploadField,FilterConfigurationDetail,FullTextFilter,JmixBigDecimalField,JmixCheckbox,JmixCheckboxGroup,JmixComboBox,JmixEmailField,JmixIntegerField,JmixMultiSelectComboBox,JmixMultiSelectComboBoxPicker,JmixMultiValuePicker,JmixNumberField,JmixPasswordField,JmixRadioButtonGroup,JmixSelect,JmixTextArea,JmixValuePicker,JpqlFilter,LastIntervalField,MessageTemplatesFragment,NextIntervalField,PropertyFilter,RelativeDateIntervalField,SingleFilterComponentBase,Switch,TwinColumn,TypedDatePicker,TypedDateTimePicker,TypedTextField,TypedTimePicker,UiDataFilterConfigurationDetail,WebdavDocumentUploadField
public interface SupportsValidation<V>
extends com.vaadin.flow.component.shared.HasValidationProperties
An interface that provides validation capabilities for components. It defines methods
for adding validators, executing validation, and managing error messages and invalid states.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddValidator(Validator<? super V> validator) Adds a validator to the list of validators for the component.voidExecutes all registered validators against the current value of the component.default Stringdefault voidsetErrorMessage(String errorMessage) voidsetInvalid(boolean invalid) Sets invalid state to the field considering result of field validation.Methods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
isInvalid
-
Field Details
-
PROPERTY_ERROR_MESSAGE
- See Also:
-
-
Method Details
-
addValidator
Adds a validator to the list of validators for the component. The provided validator will be used to validate the value of the component during validation execution.- Parameters:
validator- the validator to be added; should not benull- Returns:
- a
Registrationobject that allows removing the added validator
-
executeValidators
Executes all registered validators against the current value of the component. If any of the validators fail, aValidationExceptionis thrown to indicate the failure. The exact behavior and order of validation depend on the validators added.- Throws:
ValidationException- if validation fails for one or more validators
-
getErrorMessage
- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.shared.HasValidationProperties
-
setErrorMessage
- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.shared.HasValidationProperties
-
setInvalid
void setInvalid(boolean invalid) Sets invalid state to the field considering result of field validation.- Invalid - false and validation passed - false = field is invalid
- Invalid - false and validation passed - true = field is valid
- Invalid - true and validation passed - false = field is invalid
- Invalid - true and validation passed - true = field is invalid
- Specified by:
setInvalidin interfacecom.vaadin.flow.component.HasValidation- Specified by:
setInvalidin interfacecom.vaadin.flow.component.shared.HasValidationProperties- Parameters:
invalid- whether field should be invalid
-