diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-12-14 10:40:06 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-12-15 07:46:04 +0000 |
commit | b7af23d8dc9529aaf7b80e417725a6d43dc69b7e (patch) | |
tree | f657e56fc9d991937086d73ec61f38a4f0159880 /server | |
parent | 0c92de93c16c929c64966c30dd41bae51fc78f7c (diff) | |
download | vaadin-framework-b7af23d8dc9529aaf7b80e417725a6d43dc69b7e.tar.gz vaadin-framework-b7af23d8dc9529aaf7b80e417725a6d43dc69b7e.zip |
Fix RpcDataProvider listener handling on ItemSetChange (#19371)
Old ValueChangeListeners are discarded and new ones created when an
ItemSetChange occurs. This is done to reapply the listeners to possibly
recreated Items.
Change-Id: I9956af8950e241005574c597c49c5efb43afc1c7
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/server/communication/data/RpcDataProviderExtension.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/src/com/vaadin/server/communication/data/RpcDataProviderExtension.java b/server/src/com/vaadin/server/communication/data/RpcDataProviderExtension.java index 55b486d4b6..1b78ca4518 100644 --- a/server/src/com/vaadin/server/communication/data/RpcDataProviderExtension.java +++ b/server/src/com/vaadin/server/communication/data/RpcDataProviderExtension.java @@ -137,6 +137,10 @@ public class RpcDataProviderExtension extends AbstractExtension { @Override public void destroyData(Object itemId) { keyMapper.remove(itemId); + removeListener(itemId); + } + + private void removeListener(Object itemId) { GridValueChangeListener removed = activeItemMap.remove(itemId); if (removed != null) { @@ -239,6 +243,13 @@ public class RpcDataProviderExtension extends AbstractExtension { } else { + // Remove obsolete value change listeners. + Set<Object> keySet = new HashSet<Object>( + activeItemHandler.activeItemMap.keySet()); + for (Object itemId : keySet) { + activeItemHandler.removeListener(itemId); + } + /* Mark as dirty to push changes in beforeClientResponse */ bareItemSetTriggeredSizeChange = true; markAsDirty(); |