]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed equal expand ratio for BoxLayout (no expand ratios set for defined sized layout)
authorJouni Koivuviita <jouni@jounikoivuviita.com>
Mon, 21 May 2012 10:27:48 +0000 (13:27 +0300)
committerJouni Koivuviita <jouni@jounikoivuviita.com>
Mon, 21 May 2012 10:27:48 +0000 (13:27 +0300)
src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java
tests/testbench/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java

index 25d917b7e87625041268ae59d7ebf9baff3f7fac..854b02018f1b7634c93945e7b8984afed40bd0f6 100644 (file)
@@ -216,6 +216,17 @@ public abstract class AbstractBoxLayoutConnector extends
         hasRelativeHeight.clear();
         needsMeasure.clear();
 
+        boolean equalExpandRatio = getWidget().vertical ? !isUndefinedHeight()
+                : !isUndefinedWidth();
+        for (ComponentConnector child : getChildren()) {
+            double expandRatio = getState().getChildData().get(child)
+                    .getExpandRatio();
+            if (expandRatio > 0) {
+                equalExpandRatio = false;
+                break;
+            }
+        }
+
         for (ComponentConnector child : getChildren()) {
             Slot slot = getWidget().getSlot(child);
 
@@ -225,7 +236,9 @@ public abstract class AbstractBoxLayoutConnector extends
 
             double expandRatio = getState().getChildData().get(child)
                     .getExpandRatio();
-            if (expandRatio == 0) {
+            if (equalExpandRatio) {
+                expandRatio = 1;
+            } else if (expandRatio == 0) {
                 expandRatio = -1;
             }
             slot.setExpandRatio(expandRatio);
index f41bc35d0e9681fa6abb16918fcf26d411fcef6f..8b96ae6f27603faffd4f8d584ca83a50aaf97c8d 100644 (file)
@@ -53,7 +53,7 @@ public class BoxLayoutTest extends AbstractTestRoot {
     protected void setup(WrappedRequest request) {
 
         view = new VerticalLayout();
-        view.setSizeFull();
+        // view.setSizeFull();
         view.setMargin(true);
         view.setSpacing(true);
 
@@ -72,6 +72,7 @@ public class BoxLayoutTest extends AbstractTestRoot {
     private Component createHorizontalTest() {
         HorizontalLayout l = new HorizontalLayout();
         l.setWidth("100%");
+        l.setSpacing(true);
 
         Label exp;