summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-06-05 09:51:53 +0300
committerArtur Signell <artur@vaadin.com>2013-06-05 09:52:32 +0300
commitbd3f97586bbdfd8da9e3381c3ba02f4f0eadd93c (patch)
tree4ef642c61eedb3e0d8a3c380e85b35e76b02981c
parent892b8ba4e3f37ddda8c213a8534fc287b5cf00c9 (diff)
downloadvaadin-framework-bd3f97586bbdfd8da9e3381c3ba02f4f0eadd93c.tar.gz
vaadin-framework-bd3f97586bbdfd8da9e3381c3ba02f4f0eadd93c.zip
Properly disable combobox when parent is disabled (#10734)
Change-Id: I3fc238b684d213f509b136d520e67920cb6ed1a4
-rw-r--r--client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java10
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.html125
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java81
3 files changed, 213 insertions, 3 deletions
diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
index d9eac91e2b..f91ff9e2b9 100644
--- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
@@ -50,9 +50,6 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
getWidget().paintableId = uidl.getId();
getWidget().readonly = isReadOnly();
- getWidget().enabled = isEnabled();
-
- getWidget().tb.setEnabled(getWidget().enabled);
getWidget().updateReadOnly();
if (!isRealUpdate(uidl)) {
@@ -280,4 +277,11 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
widget.updateRootWidth();
}
}
+
+ @Override
+ public void setWidgetEnabled(boolean widgetEnabled) {
+ super.setWidgetEnabled(widgetEnabled);
+ getWidget().enabled = widgetEnabled;
+ getWidget().tb.setEnabled(widgetEnabled);
+ }
}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.html b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.html
new file mode 100644
index 0000000000..ab8c4f81d0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.html
@@ -0,0 +1,125 @@
+<?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>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.combobox.ComboBoxParentDisable?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
+ <td>6,16</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[2]/td/span</td>
+ <td>Item 1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/domChild[1]</td>
+ <td>371,22</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td>
+ <td>Item 1</td>
+</tr>
+<!--Disable combobox-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
+ <td>8,12</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td>
+ <td>Item 1</td>
+</tr>
+<!--Enable combobox-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td></td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
+ <td>8,12</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td>
+ <td>Item 1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/domChild[1]</td>
+ <td>371,22</td>
+</tr>
+<!--Disable parent-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
+ <td>8,12</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td>
+ <td>Item 1</td>
+</tr>
+<!--Enable parent-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td></td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
+ <td>8,12</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td>
+ <td>Item 1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/domChild[1]</td>
+ <td>371,22</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java
new file mode 100644
index 0000000000..84355c4d89
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java
@@ -0,0 +1,81 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.data.Property;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * The Application's "main" class
+ */
+@SuppressWarnings("serial")
+public class ComboBoxParentDisable extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ setContent(layout);
+
+ final FormLayout formLayout = new FormLayout();
+
+ final ComboBox combo = new ComboBox("Item:");
+ combo.addItem("Item 1");
+ combo.addItem("Item 2");
+ combo.addItem("Item 3");
+ combo.addItem("Item 4");
+ combo.addValueChangeListener(new MyValueChangeListener());
+ combo.setImmediate(true);
+
+ Button btn1 = new Button("Click me");
+ btn1.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ log.log("you clicked me");
+ }
+ });
+
+ formLayout.addComponent(combo);
+ formLayout.addComponent(btn1);
+
+ layout.addComponent(formLayout);
+
+ Button btn = new Button("Enable/Disable combobox",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ combo.setEnabled(!combo.isEnabled());
+ }
+ });
+ layout.addComponent(btn);
+ btn = new Button("Enable/Disable parent", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ formLayout.setEnabled(!formLayout.isEnabled());
+ }
+ });
+ layout.addComponent(btn);
+
+ }
+
+ private class MyValueChangeListener implements Property.ValueChangeListener {
+ @Override
+ public void valueChange(Property.ValueChangeEvent event) {
+ log.log("you made a selection change");
+ }
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Test for ensuring that disabling a parent properly disables the combobox";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 10734;
+ }
+} \ No newline at end of file