From 63068ff9e905cf61b4bd0b5ab46836e796dd9244 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Tue, 12 Oct 2010 13:28:04 +0000 Subject: [PATCH] Merged #5778 related changes to 6.4 branch svn changeset:15521/svn branch:6.4 --- .../terminal/gwt/client/ui/VCssLayout.java | 5 +++ .../layouts/CssLayoutRemoveComponent.html | 37 ++++++++++++++++ .../layouts/CssLayoutRemoveComponent.java | 42 +++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.html create mode 100644 tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java index 4813dbcd21..e0a74735b7 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java @@ -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 index 0000000000..0c4c3ad12c --- /dev/null +++ b/tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.html @@ -0,0 +1,37 @@ + + + + + + +CssLayoutRemoveComponent + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CssLayoutRemoveComponent
open/run/com.vaadin.tests.layouts.CssLayoutRemoveComponent?restartApplication
clickvaadin=runcomvaadintestslayoutsCssLayoutRemoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCssLayout[0]/VCssLayout$FlowPane[0]/VButton[0]/domChild[0]/domChild[0]
verifyTextPresentCaption2
verifyTextNotPresentCaption1
+ + diff --git a/tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java b/tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java new file mode 100644 index 0000000000..4959e0cc3e --- /dev/null +++ b/tests/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java @@ -0,0 +1,42 @@ +package com.vaadin.tests.layouts; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.CssLayout; +import com.vaadin.ui.TextField; + +@SuppressWarnings("serial") +public class CssLayoutRemoveComponent extends TestBase { + + @Override + protected void setup() { + final CssLayout layout = new CssLayout(); + final TextField tf = new TextField("Caption1"); + Button b = new Button("Remove field ", new ClickListener() { + + public void buttonClick(ClickEvent event) { + layout.removeComponent(tf); + } + + }); + layout.addComponent(tf); + layout.addComponent(b); + layout.addComponent(new TextField("Caption2")); + layout.addComponent(new TextField("Caption3")); + + addComponent(layout); + } + + @Override + protected String getDescription() { + return "Clicking on the button should remove one text field but other textfields and their captions should stay intact."; + } + + @Override + protected Integer getTicketNumber() { + return 5778; + } + +} -- 2.39.5