VWindow window = getWidget();
ComponentConnector content = getContent();
boolean hasContent = (content != null);
Element contentElement = window.contentPanel.getElement();
Style contentStyle = window.contents.getStyle();
int headerHeight = lm.getOuterHeight(window.header);
contentStyle.setPaddingTop(headerHeight, Unit.PX);
contentStyle.setMarginTop(-headerHeight, Unit.PX);
int footerHeight = lm.getOuterHeight(window.footer);
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
* otherwise not take the scrollbar into account when calculating the
* height.
*/
if (hasContent) {
Element layoutElement = content.getWidget().getElement();
Style childStyle = layoutElement.getStyle();
// IE8 needs some hackery to measure its content correctly
Util.forceIE8Redraw(layoutElement);
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 {
childStyle.clearPosition();
}
}