aboutsummaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorIlya Ermakov <ilya403403@gmail.com>2015-02-26 20:54:29 +0300
committerVaadin Code Review <review@vaadin.com>2015-04-10 12:29:09 +0000
commit38e35c5db6621b20929d924707be149e22032997 (patch)
tree503fcf52eea972d2fa2fa40e592e70adda7d9d85 /uitest
parent31b3cd924e163363366e588e7e5def151a61b77d (diff)
downloadvaadin-framework-38e35c5db6621b20929d924707be149e22032997.tar.gz
vaadin-framework-38e35c5db6621b20929d924707be149e22032997.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