summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/ui/VWindow.java20
-rw-r--r--client/src/com/vaadin/client/ui/window/WindowConnector.java8
2 files changed, 27 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java
index 38dfdba1b8..1331eb106a 100644
--- a/client/src/com/vaadin/client/ui/VWindow.java
+++ b/client/src/com/vaadin/client/ui/VWindow.java
@@ -38,7 +38,6 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.BrowserInfo;
@@ -793,6 +792,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
int w = Util.getTouchOrMouseClientX(event) - startX + origW;
int h = Util.getTouchOrMouseClientY(event) - startY + origH;
+ w = Math.max(w, getMinWidth());
+ h = Math.max(h, getMinHeight());
+
setWidth(w + "px");
setHeight(h + "px");
@@ -811,6 +813,22 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
}
}
+ private int getMinHeight() {
+ return getPixelValue(getElement().getStyle().getProperty("minHeight"));
+ }
+
+ private int getMinWidth() {
+ return getPixelValue(getElement().getStyle().getProperty("minWidth"));
+ }
+
+ private static int getPixelValue(String size) {
+ if (size == null || !size.endsWith("px")) {
+ return -1;
+ } else {
+ return Integer.parseInt(size.substring(0, size.length() - 2));
+ }
+ }
+
public void updateContentsSize() {
LayoutManager layoutManager = getLayoutManager();
layoutManager.setNeedsMeasure(ConnectorMap.get(client).getConnector(
diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java
index 90311e30ad..beaf549dcf 100644
--- a/client/src/com/vaadin/client/ui/window/WindowConnector.java
+++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java
@@ -207,6 +207,14 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
contentStyle.setPaddingBottom(footerHeight, Unit.PX);
contentStyle.setMarginBottom(-footerHeight, Unit.PX);
+ int minWidth = lm.getOuterWidth(window.header)
+ - lm.getInnerWidth(window.header);
+ int minHeight = footerHeight + headerHeight;
+
+ getWidget().getElement().getStyle().setPropertyPx("minWidth", minWidth);
+ getWidget().getElement().getStyle()
+ .setPropertyPx("minHeight", minHeight);
+
/*
* Must set absolute position if the child has relative height and
* there's a chance of horizontal scrolling as some browsers will