diff options
author | Artur Signell <artur.signell@itmill.com> | 2011-07-29 06:39:53 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2011-07-29 06:39:53 +0000 |
commit | a9db3f9aeb587ba8c2296193571cea33f8f9c155 (patch) | |
tree | fc40895bc519f8fa592481f60f822d90b8757b0a /src | |
parent | 2eed05db5d201e4d792894bae4b3d591159b281f (diff) | |
download | vaadin-framework-a9db3f9aeb587ba8c2296193571cea33f8f9c155.tar.gz vaadin-framework-a9db3f9aeb587ba8c2296193571cea33f8f9c155.zip |
#6845 Fixed problem with earlier fix and cleaned up code
svn changeset:20012/svn branch:6.6
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VTree.java | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTree.java b/src/com/vaadin/terminal/gwt/client/ui/VTree.java index cf7e8b5a70..a8974aa5bc 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTree.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTree.java @@ -869,24 +869,30 @@ public class VTree extends FocusElementPanel implements Paintable, final MouseEventDetails details = new MouseEventDetails(evt); ScheduledCommand command = new ScheduledCommand() { public void execute() { - if (details.getButton() == 0) { - // non-immediate iff an immediate select event is going - // to - // happen and the left button was clicked - boolean imm = !immediate - || !selectable - || (!isNullSelectionAllowed && isSelected() && selectedIds - .size() == 1); - client.updateVariable(paintableId, "clickedKey", key, - false); - client.updateVariable(paintableId, "clickEvent", - details.toString(), imm); - } else { - client.updateVariable(paintableId, "clickedKey", key, - false); - client.updateVariable(paintableId, "clickEvent", - details.toString(), immediate); + // Determine if we should send the event immediately to the + // 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; + + if (details.getButton() == NativeEvent.BUTTON_LEFT + && immediate && selectable) { + // Probably a selection that will cause a value change + // event to be sent + sendClickEventNow = false; + + // The exception is that user clicked on the + // currently selected row and null selection is not + // allowed == no selection event + if (isSelected() && selectedIds.size() == 1 + && !isNullSelectionAllowed) { + sendClickEventNow = true; + } } + + client.updateVariable(paintableId, "clickedKey", key, false); + client.updateVariable(paintableId, "clickEvent", + details.toString(), sendClickEventNow); } }; if (treeHasFocus) { |