]> source.dussan.org Git - vaadin-framework.git/commitdiff
Use main window as current UI if not already set #9443
authorLeif Åstrand <leif@vaadin.com>
Wed, 5 Sep 2012 08:38:05 +0000 (11:38 +0300)
committerLeif Åstrand <leif@vaadin.com>
Wed, 5 Sep 2012 08:38:05 +0000 (11:38 +0300)
server/src/com/vaadin/Application.java

index e4e49391bb5987a65b8c265fb32316c66d4c15bd..9498534b4a598974ae8e602f5e2fcb26547511fa 100644 (file)
@@ -185,6 +185,11 @@ public class Application implements Terminal.ErrorListener, Serializable {
                 throw new IllegalStateException(
                         "mainWindow is attached to another application");
             }
+            if (UI.getCurrent() == null) {
+                // Assume setting a main window from Application.init if there's
+                // no current UI -> set the main window as the current UI
+                UI.setCurrent(mainWindow);
+            }
             this.mainWindow = mainWindow;
         }