]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merged #5778 related changes to 6.4 branch
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 12 Oct 2010 13:28:04 +0000 (13:28 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 12 Oct 2010 13:28:04 +0000 (13:28 +0000)
svn changeset:15521/svn branch:6.4

src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java
tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.html [new file with mode: 0644]
tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java [new file with mode: 0644]

index 4813dbcd2154a2b2302d3c7e15662d9cfff2049e..e0a74735b7a5c19e4db3a8a00a75b1220b19a81a 100644 (file)
@@ -170,6 +170,11 @@ public class VCssLayout extends SimplePanel implements Paintable, Container {
                 final Paintable child = client.getPaintable(r);
                 if (oldWidgets.contains(child)) {
                     oldWidgets.remove(child);
+                    VCaption vCaption = widgetToCaption.get(child);
+                    if (vCaption != null) {
+                        add(vCaption);
+                        oldWidgets.remove(vCaption);
+                    }
                 }
 
                 add((Widget) child);
diff --git a/tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.html b/tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.html
new file mode 100644 (file)
index 0000000..0c4c3ad
--- /dev/null
@@ -0,0 +1,37 @@
+<?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="" />
+<title>CssLayoutRemoveComponent</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">CssLayoutRemoveComponent</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.layouts.CssLayoutRemoveComponent?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestslayoutsCssLayoutRemoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCssLayout[0]/VCssLayout$FlowPane[0]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td>Caption2</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextNotPresent</td>
+       <td>Caption1</td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java b/tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java
new file mode 100644 (file)
index 0000000..4959e0c
--- /dev/null
@@ -0,0 +1,42 @@
+package com.vaadin.tests.layouts;\r
+\r
+import com.vaadin.tests.components.TestBase;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.Button.ClickEvent;\r
+import com.vaadin.ui.Button.ClickListener;\r
+import com.vaadin.ui.CssLayout;\r
+import com.vaadin.ui.TextField;\r
+\r
+@SuppressWarnings("serial")\r
+public class CssLayoutRemoveComponent extends TestBase {\r
+\r
+    @Override\r
+    protected void setup() {\r
+        final CssLayout layout = new CssLayout();\r
+        final TextField tf = new TextField("Caption1");\r
+        Button b = new Button("Remove field ", new ClickListener() {\r
+\r
+            public void buttonClick(ClickEvent event) {\r
+                layout.removeComponent(tf);\r
+            }\r
+\r
+        });\r
+        layout.addComponent(tf);\r
+        layout.addComponent(b);\r
+        layout.addComponent(new TextField("Caption2"));\r
+        layout.addComponent(new TextField("Caption3"));\r
+\r
+        addComponent(layout);\r
+    }\r
+\r
+    @Override\r
+    protected String getDescription() {\r
+        return "Clicking on the button should remove one text field but other textfields and their captions should stay intact.";\r
+    }\r
+\r
+    @Override\r
+    protected Integer getTicketNumber() {\r
+        return 5778;\r
+    }\r
+\r
+}\r