From e47a291a690b7dad726e709742a3f0477a20fd80 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Fri, 12 Dec 2008 06:00:13 +0000 Subject: OL -> VerticalLayout as default for panel svn changeset:6183/svn branch:trunk --- src/com/itmill/toolkit/ui/Window.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/com/itmill/toolkit/ui/Window.java b/src/com/itmill/toolkit/ui/Window.java index 97867b8faf..aa8ccdb75c 100644 --- a/src/com/itmill/toolkit/ui/Window.java +++ b/src/com/itmill/toolkit/ui/Window.java @@ -114,6 +114,12 @@ public class Window extends Panel implements URIHandler, ParameterHandler { private Focusable pendingFocus; + /** + * Flag to trac if window has default layout and no defined size. This is + * invalid situations for sub windows. + */ + private boolean defaultLayout; + /* ********************************************************************* */ /** @@ -173,10 +179,17 @@ public class Window extends Panel implements URIHandler, ParameterHandler { */ public Window(String caption, Layout layout) { super(caption, layout); + defaultLayout = layout == null; setScrollable(true); setSizeUndefined(); } + @Override + public void setLayout(Layout newLayout) { + super.setLayout(newLayout); + defaultLayout = false; + } + /** * Gets the terminal type. * @@ -1039,9 +1052,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { "You can only add windows inside application-level windows"); } - if (window.getWidth() < 0 - && window.getLayout() instanceof VerticalLayout - && window.getLayout().getWidthUnits() == UNITS_PERCENTAGE) { + if (window.getWidth() < 0 && window.defaultLayout) { // set sane width for subwindow layout when window has undefined // width. This may though be odd for developer in some situations. // See #2321 -- cgit v1.2.3