diff options
author | Artur Signell <artur@vaadin.com> | 2014-04-23 20:45:14 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2014-04-23 20:45:39 +0300 |
commit | 41cb27e85f61f5abb029a98af66217ce400b2196 (patch) | |
tree | 609df412869abde48131079d45b2981bcb210744 /server/src/com/vaadin/data/util | |
parent | 9f30eb285252348c349e9a759ac71098eb74a06a (diff) | |
parent | 0d4080ba5e5931fa928675ba6c95540e34b2f281 (diff) | |
download | vaadin-framework-41cb27e85f61f5abb029a98af66217ce400b2196.tar.gz vaadin-framework-41cb27e85f61f5abb029a98af66217ce400b2196.zip |
Merge changes from origin/7.1
0d4080b ContainerEventProvider returns style names from container. Fixes #10718
6e91bdf Add test for TransactionalPropertyWrapper memory leaks
f0aaf89 Fixed resetting of ComboBox if focused and new items allowed (#13413).
e033fcd Always initialize WebBrowser for new sessions (#13571)
168de1f Revert "Drag image for text-area should contain text of text-area (#13557)"
35e2a34 Fix FieldGroup and TransactionalPropertyWrapper memory leaks (#13438)
7e5d44d Introduce a drag threshold for Drag and Drop (#13381)
f227f0c Drag image for text-area should contain text of text-area (#13557).
Change-Id: Idb01471f8ab0c7118fa884c364e6bc200d13948a
Diffstat (limited to 'server/src/com/vaadin/data/util')
-rw-r--r-- | server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java b/server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java index 6b0119c503..3c52ab9afc 100644 --- a/server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java +++ b/server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java @@ -48,18 +48,32 @@ public class TransactionalPropertyWrapper<T> extends AbstractProperty<T> private boolean inTransaction = false; private boolean valueChangePending; private T valueBeforeTransaction; + private final ValueChangeListener listener = new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + fireValueChange(); + } + }; public TransactionalPropertyWrapper(Property<T> wrappedProperty) { this.wrappedProperty = wrappedProperty; if (wrappedProperty instanceof ValueChangeNotifier) { ((ValueChangeNotifier) wrappedProperty) - .addListener(new ValueChangeListener() { + .addValueChangeListener(listener); + } + } - @Override - public void valueChange(ValueChangeEvent event) { - fireValueChange(); - } - }); + /** + * Removes the ValueChangeListener from wrapped Property that was added by + * TransactionalPropertyWrapper. + * + * @since 7.1.15 + */ + public void detachFromProperty() { + if (wrappedProperty instanceof ValueChangeNotifier) { + ((ValueChangeNotifier) wrappedProperty) + .removeValueChangeListener(listener); } } |