summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-04-12 15:46:35 +0300
committerLeif Åstrand <leif@vaadin.com>2012-04-12 15:46:50 +0300
commit215a2e419ddaaebe2d5d38012bfbfcde0576c7b3 (patch)
treed82a4e85d4c2186bfe09cd636f3e519bd9ab2e44
parent35778a62f170999106b9b8391491b62f4b46206f (diff)
downloadvaadin-framework-215a2e419ddaaebe2d5d38012bfbfcde0576c7b3.tar.gz
vaadin-framework-215a2e419ddaaebe2d5d38012bfbfcde0576c7b3.zip
Fix issues with minimum window sizes
Minimum width is only checked once per layout phase to avoid loops Maximum height is based on header and footer size instead of difference between inner and outer sizes
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java18
2 files changed, 18 insertions, 9 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java
index 2c5fadff3b..d08387fc6d 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java
@@ -893,9 +893,10 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
}
private int getDecorationHeight() {
- LayoutManager layoutManager = layout.getLayoutManager();
- return layoutManager.getOuterHeight(getElement())
- - layoutManager.getInnerHeight(contentPanel.getElement());
+ LayoutManager lm = layout.getLayoutManager();
+ int headerHeight = lm.getOuterHeight(header);
+ int footerHeight = lm.getOuterHeight(footer);
+ return headerHeight + footerHeight;
}
public int getMinWidth() {
@@ -905,7 +906,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
private int getDecorationWidth() {
LayoutManager layoutManager = layout.getLayoutManager();
return layoutManager.getOuterWidth(getElement())
- - layoutManager.getInnerWidth(contentPanel.getElement());
+ - contentPanel.getElement().getOffsetWidth();
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java b/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java
index 99910aae8b..85f4213d3e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java
@@ -46,6 +46,8 @@ public class WindowConnector extends AbstractComponentContainerConnector
private WindowServerRPC rpc;
+ boolean minWidthChecked = false;
+
@Override
public boolean delegateCaptionHandling() {
return false;
@@ -220,11 +222,16 @@ public class WindowConnector extends AbstractComponentContainerConnector
ComponentConnector layout = window.layout;
Element contentElement = window.contentPanel.getElement();
- boolean needsMinWidth = !isUndefinedWidth() || layout.isRelativeWidth();
- int minWidth = window.getMinWidth();
- if (needsMinWidth && lm.getInnerWidth(contentElement) < minWidth) {
- // Use minimum width if less than a certain size
- window.setWidth(minWidth + "px");
+ if (!minWidthChecked) {
+ boolean needsMinWidth = !isUndefinedWidth()
+ || layout.isRelativeWidth();
+ int minWidth = window.getMinWidth();
+ if (needsMinWidth && lm.getInnerWidth(contentElement) < minWidth) {
+ minWidthChecked = true;
+ // Use minimum width if less than a certain size
+ window.setWidth(minWidth + "px");
+ }
+ minWidthChecked = true;
}
boolean needsMinHeight = !isUndefinedHeight()
@@ -274,6 +281,7 @@ public class WindowConnector extends AbstractComponentContainerConnector
}
public void postLayout() {
+ minWidthChecked = false;
VWindow window = getWidget();
if (window.centered) {
window.center();