* Does the layout need a fixed height?
*/
private boolean needsFixedHeight() {
- if (!getWidget().vertical
- && isUndefinedHeight()
- && (hasRelativeHeight.size() > 0 || (hasVerticalAlignment
- .size() > 0 && hasVerticalAlignment.size() < getChildren()
- .size()))) {
- return true;
+ boolean isVertical = getWidget().vertical;
+ boolean hasChildrenWithVerticalAlignmentCenterOrBottom = !hasVerticalAlignment
+ .isEmpty();
+ boolean allChildrenHasVerticalAlignmentCenterOrBottom = hasVerticalAlignment
+ .size() == getChildren().size();
+
+ if(isVertical){
+ return false;
}
- return false;
+
+ else if(!isUndefinedHeight()){
+ return false;
+ }
+
+ else if (!hasChildrenWithVerticalAlignmentCenterOrBottom) {
+ return false;
+ }
+
+ else if (allChildrenHasVerticalAlignmentCenterOrBottom) {
+ return false;
+ }
+
+ return true;
}
/**
private void updateLayoutHeight() {
if (needsFixedHeight()) {
int h = getMaxHeight();
+ assert(h >= 0);
h += getLayoutManager().getBorderHeight(getWidget().getElement())
+ getLayoutManager().getPaddingHeight(
getWidget().getElement());
(Element) el.getParentElement().cast());
if (needsMeasure.contains(el)) {
int h = getLayoutManager().getOuterHeight(el);
+ if (h == -1) {
+ // Height has not yet been measured so using a more
+ // conventional method instead.
+ h = Util.getRequiredHeight(el);
+ }
+
String sHeight = el.getStyle().getHeight();
// Only add the caption size to the height of the slot if
// coption position is top or bottom
}
} else {
int h = getLayoutManager().getOuterHeight(el);
+ if (h == -1) {
+ // Height has not yet been measured so using a more
+ // conventional method instead.
+ h = Util.getRequiredHeight(el);
+ }
+
if (childCaptionElementHeight.containsKey(el)
&& (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM)) {
h += childCaptionElementHeight.get(el);
return state.styles != null && !state.styles.isEmpty();
}
+ public static final boolean isRelativeWidth(ComponentState state) {
+ return state.width != null && state.width.endsWith("%");
+ }
+
+ public static final boolean isRelativeHeight(ComponentState state) {
+ return state.height != null && state.height.endsWith("%");
+ }
+
/**
* Removes an event listener id.
*