aboutsummaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorJohn Alhroos <john.ahlroos@itmill.com>2010-04-15 12:53:16 +0000
committerJohn Alhroos <john.ahlroos@itmill.com>2010-04-15 12:53:16 +0000
commitec6b4c7b6a8ee37091437d44a66a41af6bbfdbe9 (patch)
tree1f10be7a4dd60e965ef381be98084e3dfe5e4b8e /src/com
parentc44ba2c78faac0a1de2d288677087195fe79903e (diff)
downloadvaadin-framework-ec6b4c7b6a8ee37091437d44a66a41af6bbfdbe9.tar.gz
vaadin-framework-ec6b4c7b6a8ee37091437d44a66a41af6bbfdbe9.zip
Implemented windows like ctrl+shift-clicking in Table #3520
svn changeset:12569/svn branch:6.4
Diffstat (limited to 'src/com')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index a98b60fe60..64a6d18a91 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -2538,14 +2538,27 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
if (event.getButton() == Event.BUTTON_LEFT
&& selectMode > Table.SELECT_MODE_NONE) {
+ // Ctrl+Shift click
if ((event.getCtrlKey() || event.getMetaKey())
+ && event.getShiftKey()
+ && selectMode == SELECT_MODE_MULTI
+ && multiselectmode == 0) {
+ toggleShiftSelection(false);
+
+ // Ctrl click
+ } else if ((event.getCtrlKey() || event
+ .getMetaKey())
&& selectMode == SELECT_MODE_MULTI
&& multiselectmode == 0) {
toggleSelection(true);
+
+ // Shift click
} else if (event.getShiftKey()
&& selectMode == SELECT_MODE_MULTI
&& multiselectmode == 0) {
- toggleShiftSelection();
+ toggleShiftSelection(true);
+
+ // click
} else {
if (multiselectmode == 0) {
deselectAll();
@@ -2747,7 +2760,14 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
}
}
- private void toggleShiftSelection() {
+ /**
+ * Is called when a user clicks an item when holding SHIFT key down.
+ * This will select a new range from the last cell clicked
+ *
+ * @param deselectPrevious
+ * Should the previous selected range be deselected
+ */
+ private void toggleShiftSelection(boolean deselectPrevious) {
/*
* Ensures that we are in multiselect mode and that we have a
@@ -2769,8 +2789,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
startKey ^= endKey;
}
+ // Deselect previous items if so desired
+ if (deselectPrevious) {
+ deselectAll();
+ }
+
// Select the range (not including this row)
- deselectAll();
for (int r = startKey; r <= endKey; r++) {
if (r != rowKey) {
selectedRowKeys.add(String.valueOf(r));