diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2016-09-13 11:12:00 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-09-13 10:13:32 +0000 |
commit | ad33cb573e1571167a80e9aaf02cb329c0aa4da8 (patch) | |
tree | 07572fa3b9c0944c2b657e748b6a23f3d80a939f /documentation/datamodel/datamodel-forms.asciidoc | |
parent | e8397bf3c96a0be1c3c635f99c1b1dfacd058a89 (diff) | |
download | vaadin-framework-ad33cb573e1571167a80e9aaf02cb329c0aa4da8.tar.gz vaadin-framework-ad33cb573e1571167a80e9aaf02cb329c0aa4da8.zip |
Fix inconsistent API naming in Binder and remove unused handler
Mostly based on comments on a previous patch that was merged.
Change-Id: I146995853b3318d89061f1d06ab4bbd859168661
Diffstat (limited to 'documentation/datamodel/datamodel-forms.asciidoc')
-rw-r--r-- | documentation/datamodel/datamodel-forms.asciidoc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/documentation/datamodel/datamodel-forms.asciidoc b/documentation/datamodel/datamodel-forms.asciidoc index 62d844dee6..3c2dd95bb5 100644 --- a/documentation/datamodel/datamodel-forms.asciidoc +++ b/documentation/datamodel/datamodel-forms.asciidoc @@ -150,11 +150,10 @@ binder.forField(nameField) .withValidator( name -> name.length() >= 3, "Full name must contain at least three characters") - .withStatusChangeHandler(statusChange -> { - nameStatus.setValue(statusChange.getMessage().orElse("")); + .withValidationStatusHandler(status -> { + nameStatus.setValue(status.getMessage().orElse("")); // Only show the label when validation has failed - boolean error = statusChange.getStatus() == ValidationStatus.ERROR; - nameStatus.setVisible(error); + nameStatus.setVisible(status.isError()); }) .bind(Person::getName, Person::setName); ---- @@ -564,9 +563,9 @@ We can also define our own status handler to provide a custom way of handling st [source, java] ---- -BinderStatusHandler defaultHandler = binder.getStatusHandler(); +BinderValidationStatusHandler defaultHandler = binder.getValidationStatusHandler(); -binder.setStatusHandler(status -> { +binder.setValidationStatusHandler(status -> { // create an error message on failed bean level validations List<Result<?>> errors = status.getBeanValidationErrors(); String errorMessage = errors.stream().map(Result::getMessage) |