public class DefaultBinderValidationErrorHandler extends Object implements BinderValidationErrorHandler
BinderValidationErrorHandler.
This handler applies visual effects for the field if its type allows this:
HasValidation interface then its
validity and error message is set based on a ValidationResult
HasTheme
or HasElement) then theme name derived from the ErrorLevel of
the ValidationResult instance is applied. E.g., for
ErrorLevel.WARNING the element will get the "theme"="warning"
attribute and value in HTML.
| Constructor and Description |
|---|
DefaultBinderValidationErrorHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearError(HasValue<?,?> field)
Clears the error condition of the given field, if any.
|
protected void |
clearErrorTheme(HasValue<?,?> field)
Clears error theme for the
field. |
protected String |
getErrorThemeName(ErrorLevel errorLevel)
Gets the theme name for the
ErrorLevel. |
protected Optional<ThemeList> |
getThemes(HasValue<?,?> field)
Gets themes for the
field. |
void |
handleError(HasValue<?,?> field,
ValidationResult result)
Handles a validation error emitted when trying to write the value of the
given field.
|
protected void |
setErrorTheme(HasValue<?,?> field,
ValidationResult result)
Sets error theme for the
field based on result. |
public void handleError(HasValue<?,?> field, ValidationResult result)
handleError in interface BinderValidationErrorHandlerfield - the field with the invalid valueresult - the validation error resultBinderValidationErrorHandler.clearError(HasValue)public void clearError(HasValue<?,?> field)
clearError in interface BinderValidationErrorHandlerfield - the field with an invalid valueBinderValidationErrorHandler.handleError(HasValue, ValidationResult)protected String getErrorThemeName(ErrorLevel errorLevel)
ErrorLevel.errorLevel - the error levelprotected Optional<ThemeList> getThemes(HasValue<?,?> field)
field.field - a fieldfield
doesn't have itprotected void clearErrorTheme(HasValue<?,?> field)
field.field - a feildprotected void setErrorTheme(HasValue<?,?> field, ValidationResult result)
field based on result.field - a fieldresult - a validation resultCopyright © 2025. All rights reserved.