diff options
author | Matti Tahvonen <matti@vaadin.com> | 2013-09-27 19:00:53 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-10-04 09:52:57 +0000 |
commit | 07ca622a6b2edcf7a253762cf222155bdf460a88 (patch) | |
tree | d2ac9e4d93e03e6e2e009e2115532df9d366b16d /client | |
parent | 267a4cae6de31d143c3d8d1d8dd79d4616896603 (diff) | |
download | vaadin-framework-07ca622a6b2edcf7a253762cf222155bdf460a88.tar.gz vaadin-framework-07ca622a6b2edcf7a253762cf222155bdf460a88.zip |
Fixes #12564 (HorizontalLayout breaks w/ alignment & error indicator)
Removed some obsolete (hopefully!?) code doing some odd things with caption height calculation and some refactoring to make that part of code slightly more readable.
Change-Id: I960e4a9eba0388281868f18a182c8788cedf08f9
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index e0dc0d51df..ec4307e50b 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -19,6 +19,7 @@ import java.util.List; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.Element; +import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ComponentConnector; import com.vaadin.client.ConnectorHierarchyChangeEvent; @@ -611,13 +612,14 @@ public abstract class AbstractOrderedLayoutConnector extends LayoutManager layoutManager = getLayoutManager(); for (ComponentConnector child : getChildComponents()) { - Slot slot = getWidget().getSlot(child.getWidget()); + Widget childWidget = child.getWidget(); + Slot slot = getWidget().getSlot(childWidget); Element captionElement = slot.getCaptionElement(); - CaptionPosition pos = slot.getCaptionPosition(); + CaptionPosition captionPosition = slot.getCaptionPosition(); - Element childElement = child.getWidget().getElement(); - int h = layoutManager.getOuterHeight(childElement); - if (h == -1) { + int pixelHeight = layoutManager.getOuterHeight(childWidget + .getElement()); + if (pixelHeight == -1) { // Height has not yet been measured -> postpone actions that // depend on the max height return -1; @@ -625,14 +627,10 @@ public abstract class AbstractOrderedLayoutConnector extends boolean hasRelativeHeight = slot.hasRelativeHeight(); + boolean captionSizeShouldBeAddedtoComponentHeight = captionPosition == CaptionPosition.TOP + || captionPosition == CaptionPosition.BOTTOM; boolean includeCaptionHeight = captionElement != null - && (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM); - if (!hasRelativeHeight && !includeCaptionHeight - && captionElement != null) { - String sHeight = childElement.getStyle().getHeight(); - includeCaptionHeight = (sHeight == null || !sHeight - .endsWith("%")); - } + && captionSizeShouldBeAddedtoComponentHeight; if (includeCaptionHeight) { int captionHeight = layoutManager @@ -643,16 +641,16 @@ public abstract class AbstractOrderedLayoutConnector extends // depend on the max height return -1; } - h += captionHeight; + pixelHeight += captionHeight; } if (!hasRelativeHeight) { - if (h > highestNonRelative) { - highestNonRelative = h; + if (pixelHeight > highestNonRelative) { + highestNonRelative = pixelHeight; } } else { - if (h > highestRelative) { - highestRelative = h; + if (pixelHeight > highestRelative) { + highestRelative = pixelHeight; } } } |