aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/test/java/com/vaadin/data/BinderTest.java
Commit message (Collapse)AuthorAgeFilesLines
* fix: avoid ConcurrentModificationException in Binder (#12458)Tatu Lund2021-10-271-0/+23
|
* fix: don't update bean property which is read-only bound (#12457)Tatu Lund2021-10-271-0/+71
|
* fix: Ensure that side effects of readBean does not set hasChanges true (#12455)Tatu Lund2021-10-271-0/+22
|
* fix: Avoid processing value change event due writing back of converted value ↵Tatu Lund2021-08-061-0/+31
| | | | | (#12360) This is both a optimization by skipping duplicate validation round and avoids ConcurrentModificationExpectation being thrown certain corner cases.
* feat: Add API to control whether Binder converts back to presentation (#12246)Tatu Lund2021-03-181-0/+15
| | | #12132 fixed an old bug, conversion was not done back, which was a regression from Vaadin 7. However since the bug has been present long time, it has become established behavior, thus there may be need to disable conversion back to presentation sometimes, thus this API as added.
* Binder: Also use converter for user-changed values (#12132)Tatu Lund2020-12-031-0/+65
| | | See: https://vaadin.com/forum/thread/15931682
* Add methods to control validation (#11945)Tatu Lund2020-04-211-2/+77
| | | | | | | | | - Enable / disable all validators on Binder level - Enable / disable validators on Binding level - add writeBeanAsDraft(bean,boolean) for writing draft bean with validators disabled Fixes https://github.com/vaadin/framework/issues/10709 Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
* Make asRequired conditional on binding.setAsRequiredEnabled(..) (#11834)Tatu Lund2019-12-021-3/+6
| | | | | It is a very common use case in complex form that whether a field is required or not, it depends on input on other fields. Hypothetical use case sample could be that we have form for a Product and price of the product is needed except in case the Product's type is Sample. So in that kind of scenarios it would be needed to turn off asRequired() validation easily. The purpose of this enhancement and new binding.setAsRequiredEnabled(..) API is to help implementation of this kind of use cases more easily. https://github.com/vaadin/framework/issues/10709
* Add method writeBeanAsDraft(bean) in Binder (#11833)Tatu Lund2019-11-291-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add method writeBeanAsDraft(bean) in Binder With current Binder implementation it is not easy to support Forms, which you want to save as draft, i.e. incomplete. For example there can be big text areas, that require time to fill, or lot of fields. Therefore it is needed to that form can be saved, e.g. to other bean in incomplete state when it is not yet passing validation and this other bean can be persisted to draft storage for further editing in the future. This method helps to achieve that easily. * Add test case for Binder.writeBeanAsDraft(bean) Bind a field with validator, set value that does not pass validator and save, assert that value was saved. * Updating test * Fixing logic flaw in test * Further improvement of the test case * Clarification of the JavaDoc * Fixing typo * JavaDoc language check * Fixing whitespace issue * Fixing whitespaces * Fixing whitespaces * Updating JavaDoc
* Cherry picks of Binder fixes in Flow (#11758)Tatu Lund2019-11-131-8/+134
| | | | | | | | | | * Cherry picks of Binder fixes in Flow Addresses: https://github.com/vaadin/framework/issues/9000 Addresses: https://github.com/vaadin/framework/issues/11109 These changes are adopted from https://github.com/vaadin/flow/pull/4138 and https://github.com/vaadin/flow/pull/6757
* Enable Maven plugin for Eclipse formatting (#10829)Ilia Motornyi2018-04-191-4/+8
|
* Added method asRequired with a custom required validator to BindingBuilder. ↵Márcio P. Dantas2018-03-261-0/+92
| | | | (#10724)
* Fix ValueChangeListener order changes with Binder (#10745)Teemu Suo-Anttila2018-03-241-0/+25
| | | Fixes #9917
* Add option to use error message provider for StringTo converters (#10711)Teemu Suo-Anttila2018-03-191-0/+23
|
* Add missing null check to Binding (#10726)Teemu Suo-Anttila2018-03-191-0/+19
| | | | * Add missing null check to Binding
* Add setReadOnly for Bindings (#10482)Teemu Suo-Anttila2018-02-081-10/+38
|
* Treat fields as readonly when bound with null setter (#10477)Marco Collovati2017-12-291-2/+13
| | | Fixes #10476
* Make Binder.setReadonly ignore effectively readonly bindings (#10368)Marco Collovati2017-12-281-0/+25
| | | | | | | Binder.setReadonly will ignore bindings with null setter or property without an accessible setter when changing field read only flag. Fixes #10252
* Improve Binder JavaDocs and APIs (#10347)Teemu Suo-Anttila2017-11-211-0/+8
| | | This patch also adds ValueChangeEvent as a parameter to field value change method in Binder.
* Add API to read Binding value from bean (#10316)Teemu Suo-Anttila2017-11-131-0/+21
|
* Simplify lambda expressions (#10198)Ahmed Ashour2017-10-201-5/+5
| | | | | | | | * Simplify lambda expressions And remove unneeded 'return' keyword. * Format
* Add ErrorLevel to Validators and results (#10099)Teemu Suo-Anttila2017-10-111-0/+20
| | | Fixes #9792
* Fix Binder bean writing to only validate and write given bindings (#10162)Teemu Suo-Anttila2017-10-111-4/+32
|
* Use static import of Assert in tests (#10126)Ahmed Ashour2017-10-031-104/+99
| | | | Also removes dependency on junit.framework.TestCase .
* Fix BindingBuilder to always use the same instance (#10004)Teemu Suo-Anttila2017-09-261-10/+37
| | | | | | 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)Teemu Suo-Anttila2017-09-251-10/+101
| | | | | | | 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.
* Add API for running BindingValidationStatusHandlers (#9966)Teemu Suo-Anttila2017-09-191-1/+62
| | | This patch adds an API to Binding for accessing the validation status handlers from a custom BinderValidationStatusHandler.
* Fix removeBinding logic (#10002)Piotr Wilkin2017-09-191-7/+22
| | | Fixes and improves on PR #9932.
* Add methods to remove Bindings from Binder (#9932)Teemu Suo-Anttila2017-09-051-0/+71
|
* Throw exception if user modifies same binding step twiceTeemu Suo-Anttila2017-05-261-0/+12
| | | Fixes #9427
* Clear errors when clearing binder fields (#9364)Artur2017-05-191-0/+20
| | | | Calling readBean(null) should reset the form state to the initial state it was in before calling writeBean(bean)
* Add a method for getting bound fields from Binder (#9365)Artur2017-05-191-11/+26
|
* Binding a null bean should clear the bound field values (#8288)caalador2017-02-091-24/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 45de8f45c4a1e3e45ab8a0353ab2a48bb4f1be6f. * 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 (#8274)Aleksi Hietanen2017-02-031-0/+52
| | | | | | | | | | | | | | | * 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
* Introduce Binder.setReadOnly() (#8241)Denis2017-01-161-0/+63
| | | Closes #8232
* Integrate BeanBinder functionality into Binder (#8096)Leif Åstrand2017-01-121-2/+7
| | | | * Integrate BeanBinder functionality into Binder
* Rename com.vaadin.data.util.converter to com.vaadin.data.converterPekka Hyvönen2016-12-141-1/+1
|
* Rename setRequired to asRequired since it's logically not a setter (#7986)Leif Åstrand2016-12-141-2/+2
|
* Change return type of Binder#getBean to BEANAleksi Hietanen2016-12-081-8/+8
|
* Separate Binding and BindingBuilder (#80)Leif Åstrand2016-12-051-3/+3
| | | | | BindingBinder is API that is used before calling bind() Binding is API that is used after calling bind()
* Simplify Binding API by removing the FIELDTYPE type parameterLeif Åstrand2016-11-291-2/+2
| | | | | | | | | | 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 binderAleksi Hietanen2016-11-221-0/+41
| | | | | | | | | 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
* Add Bindinding.setRequiredPekka Hyvönen2016-11-021-2/+66
| | | | | | | | | | 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
* Rename Binder methodsPekka Hyvönen2016-10-261-23/+28
| | | | | | | | | | | save -> writeBean, saveIfValid -> writeBeanIfValid, load -> readBean, bind -> setBean, unbind -> removeBean. Now setBean accepts null to reset the bean instead of throwing NPE. Closes vaadin/framework8-issues#91 Change-Id: I42cbad5856cac11a03bfcefd0fa91a02c41b7234
* Disable default null representation one way converter.Denis Anisimov2016-10-261-0/+63
| | | | | | Fixes vaadin/framework8-issues/#404 Change-Id: I9e07a7de5f67bbd7a5a59cf10cc1a8579cdfbbad
* Initial support for null representations in BinderTeemu Suo-Anttila2016-10-241-1/+80
| | | | Change-Id: If40bfa28764d1399b5ed4d5928988560e9989dce
* Revert "Initial support for null representations in Binder"Denis Anisimov2016-10-201-47/+1
| | | | | | This reverts commit 9f672890c143098b266ede6397e89379a38cc098. Change-Id: I0952a7f9c7efc8a5d7de9987277b835d92d52b39
* Initial support for null representations in BinderTeemu Suo-Anttila2016-10-201-1/+47
| | | | Change-Id: I1325c629da220317506306fe8f6fff5c0494d9d9
* Split Binder tests roughly by categoryJohannes Dahlström2016-09-141-1167/+33
| | | | Change-Id: I7c1a55bd68097819e8091533df7232271af689c3
* Fix binder.load to reset validation status in the endPekka Hyvönen2016-09-131-1/+39
| | | | | | | Otherwise any validation triggered by field value changes listeners would cause errors to be visible after loading a new bean. Change-Id: I741529f491ae6b36ff2a9aa4326c394cc12fb320