aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-01-04 17:18:28 +0200
committerLeif Åstrand <leif@vaadin.com>2013-01-04 17:18:28 +0200
commitc322474415ed2fc546e763a2329fdd82a62b06ec (patch)
tree4d64885414f4a462284a03a6681690366d2df82f /client
parentfb68bd53035fdd9cf0448623d5f6867fe17bab64 (diff)
downloadvaadin-framework-c322474415ed2fc546e763a2329fdd82a62b06ec.tar.gz
vaadin-framework-c322474415ed2fc546e763a2329fdd82a62b06ec.zip
Don't include relative sizes in expand compensation (#10222)
Change-Id: I1b94a8ffbbe66e64a585e1d7729dae3af6d815b6
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/orderedlayout/Slot.java8
-rw-r--r--client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java17
2 files changed, 24 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java
index 8b6ad14669..b59c3664c7 100644
--- a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java
+++ b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java
@@ -661,4 +661,12 @@ public final class Slot extends SimplePanel {
getElement().getParentElement().insertBefore(spacer, getElement());
}
}
+
+ public boolean isRelativeInDirection(boolean vertical) {
+ if (vertical) {
+ return hasRelativeHeight();
+ } else {
+ return hasRelativeWidth();
+ }
+ }
} \ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java
index a11251f0b0..84f946dec4 100644
--- a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java
+++ b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java
@@ -426,10 +426,25 @@ public class VAbstractOrderedLayout extends FlowPanel {
}
if (isExpanding) {
+ /*
+ * Expanded slots have relative sizes that together add up to 100%.
+ * To make room for slots without expand, we will add padding that
+ * is not considered for relative sizes and a corresponding negative
+ * margin for the unexpanded slots. We calculate the size by summing
+ * the size of all non-expanded non-relative slots.
+ *
+ * Relatively sized slots without expansion are considered to get
+ * 0px, but we still keep them visible (causing overflows) to help
+ * the developer see what's happening. Forcing them to only get 0px
+ * would make them disappear which would avoid overflows but would
+ * instead cause confusion as they would then just disappear without
+ * any obvious reason.
+ */
int totalSize = 0;
for (Widget w : getChildren()) {
Slot slot = (Slot) w;
- if (slot.getExpandRatio() == 0) {
+ if (slot.getExpandRatio() == 0
+ && !slot.isRelativeInDirection(vertical)) {
if (layoutManager != null) {
// TODO check caption position