]> source.dussan.org Git - vaadin-framework.git/commitdiff
Testcase and fix for #2579 - Invalid window size calculation for small windows
authorArtur Signell <artur.signell@itmill.com>
Fri, 13 Feb 2009 11:04:43 +0000 (11:04 +0000)
committerArtur Signell <artur.signell@itmill.com>
Fri, 13 Feb 2009 11:04:43 +0000 (11:04 +0000)
svn changeset:6830/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
src/com/itmill/toolkit/tests/components/window/TestTooSmallSubwindowSize.java [new file with mode: 0644]

index c033766309712bebb2b2119dbf298b1e2b1a7caf..7de1f81349391f82b3bd1dc493f0bfd4d2e9bc53 100644 (file)
@@ -778,6 +778,8 @@ public class IWindow extends IToolkitOverlay implements Container,
             pixelWidth = getElement().getOffsetWidth() - borderWidth;
             if (pixelWidth < MIN_WIDTH) {
                 pixelWidth = MIN_WIDTH;
+                int rootWidth = pixelWidth + borderWidth;
+                DOM.setStyleAttribute(getElement(), "width", rootWidth + "px");
             }
 
             renderSpace.setWidth(pixelWidth);
@@ -810,6 +812,10 @@ public class IWindow extends IToolkitOverlay implements Container,
             int pixels = getElement().getOffsetHeight() - getExtraHeight();
             if (pixels < MIN_HEIGHT) {
                 pixels = MIN_HEIGHT;
+                int rootHeight = pixels + getExtraHeight();
+                DOM.setStyleAttribute(getElement(), "height", (rootHeight)
+                        + "px");
+
             }
             renderSpace.setHeight(pixels);
             height = pixels + "px";
diff --git a/src/com/itmill/toolkit/tests/components/window/TestTooSmallSubwindowSize.java b/src/com/itmill/toolkit/tests/components/window/TestTooSmallSubwindowSize.java
new file mode 100644 (file)
index 0000000..47f8309
--- /dev/null
@@ -0,0 +1,44 @@
+package com.itmill.toolkit.tests.components.window;
+
+import com.itmill.toolkit.tests.components.TestBase;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.Window;
+
+public class TestTooSmallSubwindowSize extends TestBase {
+
+    @Override
+    protected String getDescription() {
+        return "The size of the subwindow (outer size) is set to 60x60 pixels. Minimum size for the content area is 150x100, which means the window and shadow should be around 155x155 and the content area 150x100. The decoration at the lower left corner of the window must not be missing either.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 2579;
+    }
+
+    @Override
+    protected void setup() {
+        Window w = new Window("Scroll");
+        Label desc = new Label(
+                "This is a new child window with a preset"
+                        + " width, height and position. Resizing has been"
+                        + " disabled for this window. Additionally, this text label"
+                        + " is intentionally too large to fit the window. You can"
+                        + " use the scrollbars to view different parts of the window content.");
+        w.addComponent(desc);
+
+        // Set window position
+        w.setPositionX(100);
+        w.setPositionY(100);
+
+        // Set window size
+        w.setWidth(60, Window.UNITS_PIXELS);
+        w.setHeight(60, Window.UNITS_PIXELS);
+
+        // Disable resizing
+        w.setResizable(true);
+
+        getMainWindow().addWindow(w);
+    }
+
+}