summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorMarc Englund <marc@vaadin.com>2013-05-24 17:19:51 +0300
committerVaadin Code Review <review@vaadin.com>2013-06-05 09:19:07 +0000
commit08ba394b1199797e3f0be7efead66e0b5393b5c3 (patch)
treeb7f3259cef66dfa7517585255cd31c39b7117dfe /uitest
parentd647d7a48a70cf6d4d86500311e235e0778c7dab (diff)
downloadvaadin-framework-08ba394b1199797e3f0be7efead66e0b5393b5c3.tar.gz
vaadin-framework-08ba394b1199797e3f0be7efead66e0b5393b5c3.zip
Disable drag&drop when source or target component is disabled, re-implementation of 6.8 fix for #11801
Change-Id: Iacd167ad7075620dae59ff2c7789efaf32521c59
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html77
-rw-r--r--uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java142
2 files changed, 219 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html
new file mode 100644
index 0000000000..1565e5eb96
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>DragAndDropDisable</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">DragAndDropDisable</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/DragAndDropDisable?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>drag</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td>
+ <td>18,25</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td>
+ <td>34,51</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+ <td>7,4</td>
+</tr>
+<tr>
+ <td>drag</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td>
+ <td>20,32</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td>
+ <td>37,59</td>
+</tr>
+<tr>
+ <td>drag</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]/VLabel[0]</td>
+ <td>59,10</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td>
+ <td>68,15</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]/VLabel[0]</td>
+ <td>68,160</td>
+</tr>
+<tr>
+ <td>drag</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>82,9</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td>
+ <td>118,50</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java
new file mode 100644
index 0000000000..fb7ed92967
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java
@@ -0,0 +1,142 @@
+package com.vaadin.tests.components.draganddropwrapper;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.event.dd.DragAndDropEvent;
+import com.vaadin.event.dd.DropHandler;
+import com.vaadin.event.dd.acceptcriteria.AcceptAll;
+import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.DragAndDropWrapper;
+import com.vaadin.ui.DragAndDropWrapper.DragStartMode;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.TableDragMode;
+
+public class DragAndDropDisable extends AbstractTestUI {
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 11801;
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ {
+ final Panel p = new Panel("Drag here");
+ addComponent(p);
+
+ final CssLayout layout = new CssLayout();
+ layout.setHeight("100px");
+
+ final DragAndDropWrapper dnd = new DragAndDropWrapper(layout);
+ p.setContent(dnd);
+
+ final CheckBox enabled = new CheckBox("Enabled", true);
+ addComponent(enabled);
+ enabled.setImmediate(true);
+ enabled.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ dnd.setEnabled(enabled.booleanValue());
+ }
+ });
+
+ dnd.setDropHandler(new DropHandler() {
+
+ @Override
+ public AcceptCriterion getAcceptCriterion() {
+ return AcceptAll.get();
+ }
+
+ @Override
+ public void drop(DragAndDropEvent event) {
+ layout.addComponent(new Label("You dropped something!"));
+ }
+ });
+
+ dnd.setDragStartMode(DragStartMode.COMPONENT);
+ }
+
+ {
+ final Panel p = new Panel("Drag here");
+ addComponent(p);
+
+ final CssLayout layout = new CssLayout();
+ layout.setHeight("100px");
+
+ final DragAndDropWrapper dnd = new DragAndDropWrapper(layout);
+ p.setContent(dnd);
+
+ final CheckBox enabled = new CheckBox("Enabled", true);
+ addComponent(enabled);
+ enabled.setImmediate(true);
+ enabled.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ dnd.setEnabled(enabled.booleanValue());
+ }
+ });
+
+ dnd.setDropHandler(new DropHandler() {
+
+ @Override
+ public AcceptCriterion getAcceptCriterion() {
+ return AcceptAll.get();
+ }
+
+ @Override
+ public void drop(DragAndDropEvent event) {
+ layout.addComponent(new Label("You dropped something!"));
+ }
+ });
+
+ dnd.setDragStartMode(DragStartMode.COMPONENT);
+ }
+
+ {
+ final Table tbl = new Table();
+ tbl.addContainerProperty("column", String.class,
+ "drag/drop to/from here");
+ for (int i = 0; i < 5; i++) {
+ tbl.addItem();
+ }
+ addComponent(tbl);
+ tbl.setDragMode(TableDragMode.ROW);
+ tbl.setDropHandler(new DropHandler() {
+
+ @Override
+ public AcceptCriterion getAcceptCriterion() {
+ return AcceptAll.get();
+ }
+
+ @Override
+ public void drop(DragAndDropEvent event) {
+ tbl.getItem(tbl.addItem()).getItemProperty("column")
+ .setValue("You dropped something");
+ }
+ });
+ final CheckBox enabled = new CheckBox("Enabled", true);
+ addComponent(enabled);
+ enabled.setImmediate(true);
+ enabled.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ tbl.setEnabled(enabled.booleanValue());
+ }
+ });
+ }
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "DragAndDropWrapper must be disableable";
+ }
+}