import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.BrowserInfo;
-import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ConnectorMap;
import com.vaadin.client.Console;
import com.vaadin.client.Focusable;
public static final int Z_INDEX = 10000;
- /** For internal use only. May be removed or replaced in the future. */
- public ComponentConnector layout;
-
/** For internal use only. May be removed or replaced in the future. */
public Element contents;
}
private void updateContentsSize() {
+ Widget childWidget = getWidget();
+
// Update child widget dimensions
- if (client != null) {
- Widget childWidget = layout.getWidget();
+ if (client != null && childWidget != null) {
client.handleComponentRelativeSize(childWidget);
if (childWidget instanceof HasWidgets) {
client.runDescendentsLayout((HasWidgets) childWidget);
}
}
- LayoutManager layoutManager = LayoutManager.get(client);
+ LayoutManager layoutManager = getLayoutManager();
layoutManager.setNeedsMeasure(ConnectorMap.get(client).getConnector(
this));
layoutManager.layoutNow();
}
private int getDecorationHeight() {
- LayoutManager lm = layout.getLayoutManager();
+ LayoutManager lm = getLayoutManager();
int headerHeight = lm.getOuterHeight(header);
int footerHeight = lm.getOuterHeight(footer);
return headerHeight + footerHeight;
}
+ private LayoutManager getLayoutManager() {
+ return LayoutManager.get(client);
+ }
+
public int getMinWidth() {
return MIN_CONTENT_AREA_WIDTH + getDecorationWidth();
}
private int getDecorationWidth() {
- LayoutManager layoutManager = layout.getLayoutManager();
+ LayoutManager layoutManager = getLayoutManager();
return layoutManager.getOuterWidth(getElement())
- contentPanel.getElement().getOffsetWidth();
}
@Override
public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
// We always have 1 child, unless the child is hidden
- getWidget().layout = getContent();
getWidget().contentPanel.setWidget(getContentWidget());
}
public void layout() {
LayoutManager lm = getLayoutManager();
VWindow window = getWidget();
- ComponentConnector layout = window.layout;
+ ComponentConnector content = getContent();
+ boolean hasContent = (content != null);
Element contentElement = window.contentPanel.getElement();
if (!minWidthChecked) {
- boolean needsMinWidth = !isUndefinedWidth()
- || layout.isRelativeWidth();
+ boolean needsMinWidth = !isUndefinedWidth() || !hasContent
+ || content.isRelativeWidth();
int minWidth = window.getMinWidth();
if (needsMinWidth && lm.getInnerWidth(contentElement) < minWidth) {
minWidthChecked = true;
minWidthChecked = true;
}
- boolean needsMinHeight = !isUndefinedHeight()
- || layout.isRelativeHeight();
+ boolean needsMinHeight = !isUndefinedHeight() || !hasContent
+ || content.isRelativeHeight();
int minHeight = window.getMinHeight();
if (needsMinHeight && lm.getInnerHeight(contentElement) < minHeight) {
// Use minimum height if less than a certain size
* otherwise not take the scrollbar into account when calculating the
* height.
*/
- Element layoutElement = layout.getWidget().getElement();
- Style childStyle = layoutElement.getStyle();
- if (layout.isRelativeHeight() && !BrowserInfo.get().isIE9()) {
- childStyle.setPosition(Position.ABSOLUTE);
-
- Style wrapperStyle = contentElement.getStyle();
- if (window.getElement().getStyle().getWidth().length() == 0
- && !layout.isRelativeWidth()) {
- /*
- * Need to lock width to make undefined width work even with
- * absolute positioning
- */
- int contentWidth = lm.getOuterWidth(layoutElement);
- wrapperStyle.setWidth(contentWidth, Unit.PX);
+ if (hasContent) {
+ Element layoutElement = content.getWidget().getElement();
+ Style childStyle = layoutElement.getStyle();
+ if (content.isRelativeHeight() && !BrowserInfo.get().isIE9()) {
+ childStyle.setPosition(Position.ABSOLUTE);
+
+ Style wrapperStyle = contentElement.getStyle();
+ if (window.getElement().getStyle().getWidth().length() == 0
+ && !content.isRelativeWidth()) {
+ /*
+ * Need to lock width to make undefined width work even with
+ * absolute positioning
+ */
+ int contentWidth = lm.getOuterWidth(layoutElement);
+ wrapperStyle.setWidth(contentWidth, Unit.PX);
+ } else {
+ wrapperStyle.clearWidth();
+ }
} else {
- wrapperStyle.clearWidth();
+ childStyle.clearPosition();
}
- } else {
- childStyle.clearPosition();
}
+
}
@Override
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://arturwin.office.itmill.com:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.ui.EmptyWindow?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>emptyWindow</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--- /dev/null
+package com.vaadin.tests.components.ui;\r
+\r
+import com.vaadin.server.VaadinRequest;\r
+import com.vaadin.tests.components.AbstractTestUI;\r
+import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Window;\r
+\r
+public class EmptyWindow extends AbstractTestUI {\r
+\r
+ @Override\r
+ protected void setup(VaadinRequest request) {\r
+ addWindow(new Window("My empty window"));\r
+ setContent(new Label("UI"));\r
+ }\r
+\r
+ @Override\r
+ protected String getTestDescription() {\r
+ return "There should be an empty window on the screen. Currently it should have the min width defined in VWindow";\r
+ }\r
+\r
+ @Override\r
+ protected Integer getTicketNumber() {\r
+ return 10325;\r
+ }\r
+\r
+}\r