summaryrefslogtreecommitdiffstats
path: root/compatibility-server
diff options
context:
space:
mode:
Diffstat (limited to 'compatibility-server')
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java36
1 files changed, 35 insertions, 1 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java
index 433254aa67..0519e20f75 100644
--- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java
+++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java
@@ -588,6 +588,8 @@ public class Table extends AbstractSelect implements Action.Container,
private MultiSelectMode multiSelectMode = MultiSelectMode.DEFAULT;
+ private boolean multiSelectTouchDetectionEnabled = true;
+
private boolean rowCacheInvalidated;
private RowGenerator rowGenerator = null;
@@ -3775,6 +3777,10 @@ public class Table extends AbstractSelect implements Action.Container,
if (isSelectable()) {
target.addAttribute("selectmode",
(isMultiSelect() ? "multi" : "single"));
+ if (isMultiSelect()) {
+ target.addAttribute("touchdetection",
+ isMultiSelectTouchDetectionEnabled());
+ }
} else {
target.addAttribute("selectmode", "none");
}
@@ -5188,7 +5194,10 @@ public class Table extends AbstractSelect implements Action.Container,
* <p>
* Note, that on some clients the mode may not be respected. E.g. on touch
* based devices CTRL/SHIFT base selection method is invalid, so touch based
- * browsers always use the {@link MultiSelectMode#SIMPLE}.
+ * browsers always use the {@link MultiSelectMode#SIMPLE} unless touch multi
+ * select is explicitly disabled.
+ *
+ * @see #setMultiSelectTouchDetectionEnabled(boolean)
*
* @param mode
* The select mode of the table
@@ -5208,6 +5217,31 @@ public class Table extends AbstractSelect implements Action.Container,
}
/**
+ * Default behavior on touch-reporting devices is to switch from CTRL/SHIFT
+ * based multi-selection to simple mode, but you can use this method to
+ * explicitly disable the touch device detection. Thus you can keep using
+ * keyboard-based multi selection on hybrid devices that have both a touch
+ * screen and a keyboard.
+ *
+ * @param multiSelectTouchDetectionEnabled
+ * Whether to enable or disable touch screen detection
+ */
+ public void setMultiSelectTouchDetectionEnabled(
+ boolean multiSelectTouchDetectionEnabled) {
+ this.multiSelectTouchDetectionEnabled = multiSelectTouchDetectionEnabled;
+ markAsDirty();
+ }
+
+ /**
+ * Returns if touch screen detection is used to toggle multi select mode.
+ *
+ * @return If touch screen detection for multi select is enabled
+ */
+ public boolean isMultiSelectTouchDetectionEnabled() {
+ return multiSelectTouchDetectionEnabled;
+ }
+
+ /**
* Lazy loading accept criterion for Table. Accepted target rows are loaded
* from server once per drag and drop operation. Developer must override one
* method that decides on which rows the currently dragged data can be