]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test case and fix for #2245 - SplitPanel without both components cannot be painted
authorArtur Signell <artur.signell@itmill.com>
Mon, 1 Dec 2008 06:19:17 +0000 (06:19 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 1 Dec 2008 06:19:17 +0000 (06:19 +0000)
svn changeset:6049/svn branch:trunk

src/com/itmill/toolkit/tests/tickets/Ticket2245.java [new file with mode: 0644]
src/com/itmill/toolkit/ui/AbstractComponent.java
src/com/itmill/toolkit/ui/SplitPanel.java

diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket2245.java b/src/com/itmill/toolkit/tests/tickets/Ticket2245.java
new file mode 100644 (file)
index 0000000..816a191
--- /dev/null
@@ -0,0 +1,17 @@
+package com.itmill.toolkit.tests.tickets;
+
+import com.itmill.toolkit.Application;
+import com.itmill.toolkit.ui.SplitPanel;
+import com.itmill.toolkit.ui.Window;
+
+public class Ticket2245 extends Application {
+
+    @Override
+    public void init() {
+        Window main = new Window("The Main Window");
+        main.getLayout().setSizeFull();
+        setMainWindow(main);
+        SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);
+        main.addComponent(sp);
+    }
+}
index 7bcc6fb64216e3326006de14f123c11801ab9162..958d597babb33a1d465a86db793ffe6745711a4b 100644 (file)
@@ -609,7 +609,8 @@ public abstract class AbstractComponent implements Component, MethodEventSource
             if (isVisible()) {
 
                 // TODO split this method
-                if (getApplication().isDebugMode()
+                if (getApplication() != null
+                        && getApplication().isDebugMode()
                         && !DebugUtilities.validateComponentRelativeSizes(this,
                                 false)) {
                     addStyleName("invalidlayout");
index 0e51b9fceed1df6304058fcf9fb7d9438dcf0167..0f03df0f9904bb02adf0acb7dff5ebb6cf75b19a 100644 (file)
@@ -212,12 +212,16 @@ public class SplitPanel extends AbstractLayout {
         if (firstComponent != null) {
             firstComponent.paint(target);
         } else {
-            (new OrderedLayout()).paint(target);
+            OrderedLayout temporaryComponent = new OrderedLayout();
+            temporaryComponent.setParent(this);
+            temporaryComponent.paint(target);
         }
         if (secondComponent != null) {
             secondComponent.paint(target);
         } else {
-            (new OrderedLayout()).paint(target);
+            OrderedLayout temporaryComponent = new OrderedLayout();
+            temporaryComponent.setParent(this);
+            temporaryComponent.paint(target);
         }
     }