summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-02-05 11:59:42 +0200
committerVaadin Code Review <review@vaadin.com>2013-02-07 13:57:17 +0000
commit77aed50851264cf89025fcf0a082e83027d90f68 (patch)
treeb36c49e02ac088318c30e5b5ab14cf60d08c9e2e /client
parentfa95bdee6675ad6fc56b0d021227e5e25fe9316e (diff)
downloadvaadin-framework-77aed50851264cf89025fcf0a082e83027d90f68.tar.gz
vaadin-framework-77aed50851264cf89025fcf0a082e83027d90f68.zip
Fixed middle vertical alignments in HorizontalLayout #10852
Change-Id: I85dac7b89ec4ec670cf92e5c760090fbef5929af
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
index afe81c79a0..77def89e9e 100644
--- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
+++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
@@ -197,6 +197,12 @@ public abstract class AbstractOrderedLayoutConnector extends
private boolean hasChildrenWithRelativeHeight = false;
/**
+ * Keep track of whether any child is middle aligned. Used to determine if
+ * measurements are needed to make middle aligned children work.
+ */
+ private boolean hasChildrenWithMiddleAlignment = false;
+
+ /**
* Keeps track of whether slots should be expanded based on available space.
*/
private boolean needsExpand = false;
@@ -340,6 +346,7 @@ public abstract class AbstractOrderedLayoutConnector extends
processedResponseId = lastResponseId;
hasChildrenWithRelativeHeight = false;
+ hasChildrenWithMiddleAlignment = false;
needsExpand = getWidget().vertical ? !isUndefinedHeight()
: !isUndefinedWidth();
@@ -380,6 +387,10 @@ public abstract class AbstractOrderedLayoutConnector extends
getState().childData.get(child).alignmentBitmask);
slot.setAlignment(alignment);
+ if (alignment.isVerticalCenter()) {
+ hasChildrenWithMiddleAlignment = true;
+ }
+
double expandRatio = onlyZeroExpands ? 1 : getState().childData
.get(child).expandRatio;
@@ -429,8 +440,10 @@ public abstract class AbstractOrderedLayoutConnector extends
return false;
}
- else if (!hasChildrenWithRelativeHeight) {
- // Already works if there are no relative heights
+ else if (!hasChildrenWithRelativeHeight
+ && !hasChildrenWithMiddleAlignment) {
+ // Already works if there are no relative heights or middle aligned
+ // children
return false;
}