aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2009-02-13 11:04:43 +0000
committerArtur Signell <artur.signell@itmill.com>2009-02-13 11:04:43 +0000
commit8acbd07628ecbfb99326dd1086bf1e9f1b28dd64 (patch)
tree025ff1681a184e4f75e4f1f4bcdec401c4899c40
parentab72d71d3e4a9547f2dd7bdd07e6b8da91a4e4e4 (diff)
downloadvaadin-framework-8acbd07628ecbfb99326dd1086bf1e9f1b28dd64.tar.gz
vaadin-framework-8acbd07628ecbfb99326dd1086bf1e9f1b28dd64.zip
Testcase and fix for #2579 - Invalid window size calculation for small windows
svn changeset:6830/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java6
-rw-r--r--src/com/itmill/toolkit/tests/components/window/TestTooSmallSubwindowSize.java44
2 files changed, 50 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
index c033766309..7de1f81349 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
@@ -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
index 0000000000..47f8309da3
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/components/window/TestTooSmallSubwindowSize.java
@@ -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);
+ }
+
+}