diff options
author | Artur Signell <artur@vaadin.com> | 2015-05-15 12:38:01 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-06-01 06:27:36 +0000 |
commit | 90e75a20bda563f90297840f4feb5668cd524633 (patch) | |
tree | 5f53384d3f36b733066cdede9ab569f9eb92fb01 /server | |
parent | 4932cecca53b25149ec18dd811c89997ee43e8d9 (diff) | |
download | vaadin-framework-90e75a20bda563f90297840f4feb5668cd524633.tar.gz vaadin-framework-90e75a20bda563f90297840f4feb5668cd524633.zip |
Properly handle readonly fields when clearing FieldGroup (#17166)
Change-Id: I42b9fe5d945d23e202a252a8be12976608da19bf
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/data/fieldgroup/FieldGroup.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java index d370c3906b..aaaae9e4f7 100644 --- a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java +++ b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java @@ -258,7 +258,19 @@ public class FieldGroup implements Serializable { if (itemDataSource == null) { // Clear any possible existing binding to clear the field field.setPropertyDataSource(null); - field.clear(); + boolean fieldReadOnly = field.isReadOnly(); + if (!fieldReadOnly) { + field.clear(); + } else { + // Temporarily make the field read-write so we can clear the + // value. Needed because setPropertyDataSource(null) does not + // currently clear the field + // (https://dev.vaadin.com/ticket/14733) + field.setReadOnly(false); + field.clear(); + field.setReadOnly(true); + } + // Will be bound when data source is set return; } @@ -1247,4 +1259,5 @@ public class FieldGroup implements Serializable { } } -} + +}
\ No newline at end of file |