diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-08-20 05:59:40 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-08-20 05:59:40 +0000 |
commit | 25ef5f48f94de4646252d7ec75a55d6414ed5bc4 (patch) | |
tree | c19051aa08dbc53c8324a1dd6d71578fbfdaa80a | |
parent | 2e7f377cdd89e5d952e33b1eba9fd7075619b7d9 (diff) | |
download | vaadin-framework-25ef5f48f94de4646252d7ec75a55d6414ed5bc4.tar.gz vaadin-framework-25ef5f48f94de4646252d7ec75a55d6414ed5bc4.zip |
Fix for #5458 - ItemClick is not sent when clicking a selected item
svn changeset:14553/svn branch:6.4
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index 2ed2a56fa3..6dcf2f6114 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -472,10 +472,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // Reset selection changed flag selectionChanged = false; - // Note: changing the immediateness of this - // might - // require changes to "clickEvent" immediateness - // also. + // Note: changing the immediateness of this might require changes to + // "clickEvent" immediateness also. if (multiselectmode == MULTISELECT_MODE_DEFAULT) { // Convert ranges to a set of strings Set<String> ranges = new HashSet<String>(); @@ -3774,18 +3772,23 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } MouseEventDetails details = new MouseEventDetails(event); - // Note: the 'immediate' logic would need to be more - // involved (see #2104), but iscrolltable always sends - // select event, even though nullselectionallowed wont let - // the change trough. Will need to be updated if that is - // changed. - - client.updateVariable( - paintableId, - "clickEvent", - details.toString(), - !(event.getButton() == Event.BUTTON_LEFT - && !doubleClick && isSelectable() && immediate)); + + boolean imm = true; + if (immediate && event.getButton() == Event.BUTTON_LEFT + && !doubleClick && isSelectable() && !isSelected()) { + /* + * A left click when the table is selectable and in + * immediate mode on a row that is not currently + * selected will cause a selection event to be fired + * after this click event. By making the click event + * non-immediate we avoid sending two separate messages + * to the server. + */ + imm = false; + } + + client.updateVariable(paintableId, "clickEvent", + details.toString(), imm); } } |