From: Artur Signell Date: Fri, 21 Aug 2009 13:26:50 +0000 (+0000) Subject: Fix for #3096 - Analyze layouts does not check sub windows X-Git-Tag: 6.7.0.beta1~2598 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f93447981aec5dd47275caf3b09c74f304bc2e4c;p=vaadin-framework.git Fix for #3096 - Analyze layouts does not check sub windows svn changeset:8523/svn branch:6.1 --- diff --git a/src/com/example/dialogtest/SubwindowInvalidLayout.java b/src/com/example/dialogtest/SubwindowInvalidLayout.java new file mode 100644 index 0000000000..95c4675726 --- /dev/null +++ b/src/com/example/dialogtest/SubwindowInvalidLayout.java @@ -0,0 +1,35 @@ +package com.example.dialogtest; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +public class SubwindowInvalidLayout extends TestBase { + + @Override + protected String getDescription() { + return "The subwindow contains an invalid layout, which analyze layouts should detect."; + } + + @Override + protected Integer getTicketNumber() { + return 3096; + } + + @Override + protected void setup() { + Window window = new Window("Sub window"); + window.center(); + + VerticalLayout vl = new VerticalLayout(); + vl.setWidth(null); + Button b = new Button("A 100% wide button, invalid"); + b.setWidth("100%"); + vl.addComponent(b); + window.addComponent(vl); + + getMainWindow().addWindow(window); + } + +} diff --git a/src/com/vaadin/terminal/gwt/server/CommunicationManager.java b/src/com/vaadin/terminal/gwt/server/CommunicationManager.java index ce9b1cbdfc..75be657ef0 100644 --- a/src/com/vaadin/terminal/gwt/server/CommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/CommunicationManager.java @@ -452,9 +452,22 @@ public class CommunicationManager implements Paintable.RepaintRequestListener, paintablePainted(p); if (analyzeLayouts) { + Window w = (Window) p; invalidComponentRelativeSizes = ComponentSizeValidator - .validateComponentRelativeSizes(((Window) p) - .getContent(), null, null); + .validateComponentRelativeSizes(w.getContent(), + null, null); + + // Also check any existing subwindows + if (w.getChildWindows() != null) { + for (Window subWindow : (Set) w + .getChildWindows()) { + invalidComponentRelativeSizes = ComponentSizeValidator + .validateComponentRelativeSizes( + subWindow.getContent(), + invalidComponentRelativeSizes, + null); + } + } } } }