diff options
author | Anna Miroshnik <anna.miroshnik@arcadia.spb.ru> | 2014-09-04 12:21:59 +0400 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-09-04 12:05:31 +0000 |
commit | d71ae18e355468487a947c84d0f92ed9c44b002e (patch) | |
tree | 17d3a099e6b9c82210b167ff7d2b781816a3a2af /client | |
parent | b914468e90f5aafb573f1769d8b2de7deedbb814 (diff) | |
download | vaadin-framework-d71ae18e355468487a947c84d0f92ed9c44b002e.tar.gz vaadin-framework-d71ae18e355468487a947c84d0f92ed9c44b002e.zip |
Tree item fails with ItemClickListener (#14388)
Fixes after review. Tests were simplified.
Change-Id: I5c631d44fd742fee36f01aeb2044b85faf709d23
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VTree.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/client/src/com/vaadin/client/ui/VTree.java b/client/src/com/vaadin/client/ui/VTree.java index b12053ea04..caa728ab21 100644 --- a/client/src/com/vaadin/client/ui/VTree.java +++ b/client/src/com/vaadin/client/ui/VTree.java @@ -160,6 +160,13 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, private boolean selectionHasChanged = false; + /* + * to fix #14388. The cause of defect #14388: event 'clickEvent' is sent to + * server before updating of "selected" variable, but should be send after + * it + */ + private boolean sendClickEventNow = false; + /** For internal use only. May be removed or replaced in the future. */ public String[] bodyActionKeys; @@ -471,9 +478,15 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, Command command = new Command() { @Override public void execute() { + /* + * we should send selection to server immediately in 2 cases: 1) + * 'immediate' property of Tree is true 2) sendClickEventNow is + * true + */ client.updateVariable(paintableId, "selected", selectedIds.toArray(new String[selectedIds.size()]), - immediate); + sendClickEventNow || immediate); + sendClickEventNow = false; selectionHasChanged = false; } }; @@ -831,7 +844,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, // server. We do not want to send the event if there is a // selection event happening after this. In all other cases // we want to send it immediately. - boolean sendClickEventNow = true; + sendClickEventNow = true; if (details.getButton() == MouseButton.LEFT && immediate && selectable) { @@ -849,8 +862,13 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, } client.updateVariable(paintableId, "clickedKey", key, false); + + /* + * in any case event should not be send immediately here - + * send after updating of "selected" variable + */ client.updateVariable(paintableId, "clickEvent", - details.toString(), sendClickEventNow); + details.toString(), false); } }); } |