From 0645a86e5b6951de0e5b170657a2eaf74a7e9b77 Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Tue, 19 May 2020 13:13:25 +0300 Subject: Table / TreeTable multiselect disabling of touch detection (#12014) Added a toggle in Table (and thus TreeTable) where you can explicitly disable multiselect touch screen detection. This allows you to work around issues on hybrid devices that have both a touch screen and a keyboard where you don't want automatic simple multiselection applied. Fixes #11601, slightly modified cherry-pick of #11641 --- .../src/main/java/com/vaadin/v7/client/ui/VScrollTable.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'compatibility-client') diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java index 4b0a52c1bd..c4294009d2 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java @@ -349,6 +349,8 @@ public class VScrollTable extends FlowPanel private SelectMode selectMode = SelectMode.NONE; + private boolean multiSelectTouchDetectionEnabled = true; + public final HashSet selectedRowKeys = new HashSet(); /* @@ -1502,6 +1504,10 @@ public class VScrollTable extends FlowPanel } else { selectMode = SelectMode.NONE; } + if (uidl.hasAttribute("touchdetection")) { + multiSelectTouchDetectionEnabled = uidl + .getBooleanAttribute("touchdetection"); + } } } @@ -1951,9 +1957,10 @@ public class VScrollTable extends FlowPanel } private void setMultiSelectMode(int multiselectmode) { - if (BrowserInfo.get().isTouchDevice()) { + if (BrowserInfo.get().isTouchDevice() + && multiSelectTouchDetectionEnabled) { // Always use the simple mode for touch devices that do not have - // shift/ctrl keys + // shift/ctrl keys (unless this feature is explicitly disabled) this.multiselectmode = MULTISELECT_MODE_SIMPLE; } else { this.multiselectmode = multiselectmode; -- cgit v1.2.3