Fix BindingBuilder to always use the same instance (#10004)
This allows using BindingBuilder either in a type safe chained manner or with separate calls for the same instance at the cost of less strict type checking.
Fixes #9927
Fixes #9619
Improve Binder value change handling with bean validation (#9988)
Changed values are now only applied to the bean when they pass both field and bean validation. Any change that breaks validation will be pending and is attempted to apply when another change event comes.
This patch also makes the order of status change event handler and listener call order.
This addresses some of the issues raised in #9955.
Binding a null bean should clear the bound field values (#8288)
* Add clear field values #8287
Added functionality to make it possible to clear bound field values manually
or when setting a null bean to binder.
Binder will now clear bound fields for setBean(null) or if using readBean() functionality
when calling the clear() method. Binder.clear() will throw a IllegalStateException if
we have a bound bean.
* MultiSelectionModel MultiSelect should implement emptyValue
* Removing public clear() method and clearing field values only through
setBean(null) and readBean(null) to be consistent and not have
confusing functionality.
* Simplified clearFields() as we don't need to check if field is readOnly
* Document in removeBean JavaDoc that it will also clear the bound fields
if we have a bean the is removed.
* Binder should not have changes after clearing fields.
* Add getEmptyValue as default to MultiSelect.
Multiselect default for empty value should be an empty set.
* Revert "Add getEmptyValue as default to MultiSelect."
This reverts commit 45de8f45c4.
* Merge branch 'master' into issue/8287_Clear_bound_fields
* Remove override for default implementation.
* Fire status change event on clearFields if we had changes before clearing.
* Formatting.
* Add isValid to Binder
isValid enables you to check the current validation
status of a given Binder, without firing events or invoking
handlers.
This patch also clarifies the javadocs of StatusChangeEvents'
hasValidationErrors.
* Throw in Binder.isValid if no bean is set and bean validators exist
* Add test cases to BinderTest
Simplify Binding API by removing the FIELDTYPE type parameter
The type parameter is mainly used internally, the only externally facing
use is to define the exact type of Binding.getField. Code that has
access to a typed instance of Binding does typically also have direct
access to the field instance, so there's no real use for the type
parameter.
Change-Id: Idf2ab18a79ec5f0a7cef83705b8084fbf7014c10
Fix field value change event handling for unbound binder
Unbound binder now correctly sets hasChanges and sends binder
status change events. In addition, hasChanges no longer returns
true in the case where a bean is bound and changes to the bean
were valid.
Change-Id: Ia0a0915c2a205461a2a4b1bfd393413520f863eb
Shorthand for making field show required indicator and validating against empty.
Removes obsolete NotNullValidator and NotEmptyValidator. Latter is still used
in some tests, that why it is still in test packages.
Fixes vaadin/framework8-issues#29
Change-Id: Ib116739a20a0bbd1b1460423ee36ed2752c5496a
Fix binder.load to reset validation status in the end
Otherwise any validation triggered by field value changes listeners
would cause errors to be visible after loading a new bean.
Change-Id: I741529f491ae6b36ff2a9aa4326c394cc12fb320
Adds an unresolved validation status to make it possible to clear
visible field validation errors, even if status is not yet valid.
Change-Id: I227a8802b6a71be1533dc903bad1a8e2faef5ed2
BinderStatusHandler is now triggered only once per validation.
Unified ValidationError and BinderResult into BinderValidationStatus.
Renamed ValidationStatusChangeEvent into ValidationStatus.
Unified handler names for validation status.
Next patch will fix resetting of field errors on reset.
Change-Id: I9536d554d781fe599fbd7e5bcb5a9ffebe675ca0
An item level validator is run on the item (bean) after field validators
have passed. A failed item level validator will block save operations,
just like field level validators.
Change-Id: I3b918b33371ceef07cdfbd0a8b6d477d4ac26b85