aboutsummaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorIlya Ermakov <ilya403403@gmail.com>2015-02-26 20:54:29 +0300
committerMarkus Koivisto <markus@vaadin.com>2015-04-15 11:54:05 +0300
commitfa4b26686d2f1184e7874c37ebcbba81a4dd86f4 (patch)
treea0f96c36239dbfffcc8c2ec855d57a3c7c85b4e5 /uitest
parent0e1953be8f49c906c288416a3971519cea987713 (diff)
downloadvaadin-framework-fa4b26686d2f1184e7874c37ebcbba81a4dd86f4.tar.gz
vaadin-framework-fa4b26686d2f1184e7874c37ebcbba81a4dd86f4.zip
Prevent opening Table context menu on short tapping on iOS (#15297)
With this patch handling touchstart in Table body is prevented if it is handled in Table row. This is the smallest patch that solves the problem, refactoring remains an open problem. Change-Id: Iea54210ee81a3fdf17e45c6c98026af9080abddf
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableContextMenuTouch.java106
1 files changed, 106 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/TableContextMenuTouch.java b/uitest/src/com/vaadin/tests/components/table/TableContextMenuTouch.java
new file mode 100644
index 0000000000..1d909d101e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableContextMenuTouch.java
@@ -0,0 +1,106 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.event.Action;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+
+/*
+ * Differs from TableContextMenu by number of items, their numbering and
+ * immediate/selectable/multiselect toggling
+ */
+public class TableContextMenuTouch extends AbstractTestUI {
+
+ private static final Action ACTION_MYACTION = new Action("Action!!");
+
+ @Override
+ protected void setup(VaadinRequest req) {
+
+ HorizontalLayout hlay = new HorizontalLayout();
+ addComponent(hlay);
+ hlay.setSpacing(true);
+
+ final Table table = new Table();
+
+ table.addActionHandler(new Action.Handler() {
+ @Override
+ public void handleAction(Action action, Object sender, Object target) {
+ Notification.show("Done that :-)");
+ }
+
+ @Override
+ public Action[] getActions(Object target, Object sender) {
+ return new Action[] { ACTION_MYACTION };
+ }
+ });
+
+ table.addContainerProperty("Foo", String.class, "BAR1");
+ table.addContainerProperty("Bar", String.class, "FOO2");
+
+ table.setHeight("200px");
+
+ for (int i = 0; i < 30; i++) {
+ Object key = table.addItem();
+ table.getItem(key).getItemProperty("Foo")
+ .setValue(new Integer(i).toString());
+ }
+
+ hlay.addComponent(table);
+
+ VerticalLayout vlay = new VerticalLayout();
+ hlay.addComponent(vlay);
+
+ final CheckBox immediateCheckBox = new CheckBox("Immediate");
+ vlay.addComponent(immediateCheckBox);
+ immediateCheckBox.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ table.setImmediate(immediateCheckBox.getValue());
+ }
+ });
+ immediateCheckBox.setValue(true);
+ table.setImmediate(immediateCheckBox.getValue());
+
+ final CheckBox selectableCheckBox = new CheckBox("Selectable");
+ final CheckBox multiselectCheckBox = new CheckBox("Multiselect");
+ vlay.addComponent(selectableCheckBox);
+ selectableCheckBox.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ table.setSelectable(selectableCheckBox.getValue());
+ multiselectCheckBox.setEnabled(selectableCheckBox.getValue());
+ }
+ });
+ selectableCheckBox.setValue(true);
+ multiselectCheckBox.setEnabled(selectableCheckBox.getValue());
+ table.setSelectable(selectableCheckBox.getValue());
+
+ vlay.addComponent(multiselectCheckBox);
+ multiselectCheckBox.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ table.setMultiSelect(multiselectCheckBox.getValue());
+ }
+ });
+ multiselectCheckBox.setValue(true);
+ table.setMultiSelect(multiselectCheckBox.getValue());
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Context menu in Table on touch devices should not open on selection tapping";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 15297;
+ }
+
+} \ No newline at end of file