diff options
3 files changed, 166 insertions, 10 deletions
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index ebc80c4728..d384549ee3 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -185,19 +185,20 @@ public abstract class AbstractComponentConnector extends AbstractConnector if (getWidget() instanceof HasEnabled) { // set widget specific enabled state ((HasEnabled) getWidget()).setEnabled(widgetEnabled); + } - // make sure the caption has or has not v-disabled style - if (delegateCaptionHandling()) { - ServerConnector parent = getParent(); - if (parent instanceof HasComponentsConnector) { - ((HasComponentsConnector) parent).updateCaption(this); - } else if (parent == null && !(this instanceof UIConnector)) { - VConsole.error("Parent of connector " - + Util.getConnectorString(this) - + " is null. This is typically an indication of a broken component hierarchy"); - } + // make sure the caption has or has not v-disabled style + if (delegateCaptionHandling()) { + ServerConnector parent = getParent(); + if (parent instanceof HasComponentsConnector) { + ((HasComponentsConnector) parent).updateCaption(this); + } else if (parent == null && !(this instanceof UIConnector)) { + VConsole.error("Parent of connector " + + Util.getConnectorString(this) + + " is null. This is typically an indication of a broken component hierarchy"); } } + } protected void updateComponentSize() { diff --git a/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.html b/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.html new file mode 100644 index 0000000000..87bf0edb49 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.html @@ -0,0 +1,94 @@ +<?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.formlayout.CaptionEnableDisable?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td>v-disabled</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td> + <td>v-disabled</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-disabled</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]</td> + <td>v-disabled</td> +</tr> +<!--Enable--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td>v-disabled</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td> + <td>v-disabled</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-disabled</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]</td> + <td>v-disabled</td> +</tr> +<!--Disable--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td>v-disabled</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td> + <td>v-disabled</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-disabled</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutCaptionEnableDisable::/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]</td> + <td>v-disabled</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.java b/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.java new file mode 100644 index 0000000000..ce9067df29 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.java @@ -0,0 +1,61 @@ +package com.vaadin.tests.components.formlayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.TextField; + +public class CaptionEnableDisable extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + setContent(createFormLayout()); + + } + + public FormLayout createFormLayout() { + FormLayout layout = new FormLayout(); + final TextField textField = new TextField("TextField"); + textField.setEnabled(false); + layout.addComponent(textField); + + final ComboBox combobox = new ComboBox("Combobox"); + combobox.setEnabled(false); + layout.addComponent(combobox); + + final NativeSelect nativeSelect = new NativeSelect("NativeSelect"); + nativeSelect.setEnabled(false); + layout.addComponent(nativeSelect); + + final CheckBox checkBox = new CheckBox("Checkbox"); + checkBox.setEnabled(false); + layout.addComponent(checkBox); + + layout.addComponent(new Button("Toggle components enabled", + new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + combobox.setEnabled(!combobox.isEnabled()); + textField.setEnabled(!textField.isEnabled()); + checkBox.setEnabled(!checkBox.isEnabled()); + nativeSelect.setEnabled(!nativeSelect.isEnabled()); + } + })); + return layout; + } + + @Override + protected String getTestDescription() { + return ""; + } + + @Override + protected Integer getTicketNumber() { + return 12062; + } + +}
\ No newline at end of file |