]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for #3096 - Analyze layouts does not check sub windows
authorArtur Signell <artur.signell@itmill.com>
Fri, 21 Aug 2009 13:26:50 +0000 (13:26 +0000)
committerArtur Signell <artur.signell@itmill.com>
Fri, 21 Aug 2009 13:26:50 +0000 (13:26 +0000)
svn changeset:8523/svn branch:6.1

src/com/example/dialogtest/SubwindowInvalidLayout.java [new file with mode: 0644]
src/com/vaadin/terminal/gwt/server/CommunicationManager.java

diff --git a/src/com/example/dialogtest/SubwindowInvalidLayout.java b/src/com/example/dialogtest/SubwindowInvalidLayout.java
new file mode 100644 (file)
index 0000000..95c4675
--- /dev/null
@@ -0,0 +1,35 @@
+package com.example.dialogtest;\r
+\r
+import com.vaadin.tests.components.TestBase;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.VerticalLayout;\r
+import com.vaadin.ui.Window;\r
+\r
+public class SubwindowInvalidLayout extends TestBase {\r
+\r
+    @Override\r
+    protected String getDescription() {\r
+        return "The subwindow contains an invalid layout, which analyze layouts should detect.";\r
+    }\r
+\r
+    @Override\r
+    protected Integer getTicketNumber() {\r
+        return 3096;\r
+    }\r
+\r
+    @Override\r
+    protected void setup() {\r
+        Window window = new Window("Sub window");\r
+        window.center();\r
+\r
+        VerticalLayout vl = new VerticalLayout();\r
+        vl.setWidth(null);\r
+        Button b = new Button("A 100% wide button, invalid");\r
+        b.setWidth("100%");\r
+        vl.addComponent(b);\r
+        window.addComponent(vl);\r
+\r
+        getMainWindow().addWindow(window);\r
+    }\r
+\r
+}\r
index ce9b1cbdfc05cdf075113e1a2e4af7574132dda6..75be657ef07ab86fc02a853899110e48da1036fd 100644 (file)
@@ -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<Window>) w
+                                    .getChildWindows()) {
+                                invalidComponentRelativeSizes = ComponentSizeValidator
+                                        .validateComponentRelativeSizes(
+                                                subWindow.getContent(),
+                                                invalidComponentRelativeSizes,
+                                                null);
+                            }
+                        }
                     }
                 }
             }