]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixes to BoxLayout based on first round of screenshot tests
authorJouni Koivuviita <jouni@jounikoivuviita.com>
Wed, 18 Apr 2012 08:41:23 +0000 (11:41 +0300)
committerJouni Koivuviita <jouni@jounikoivuviita.com>
Wed, 18 Apr 2012 08:41:23 +0000 (11:41 +0300)
src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java
src/com/vaadin/terminal/gwt/server/ComponentSizeValidator.java
tests/testbench/com/vaadin/tests/components/table/TextFieldRelativeWidth.java
tests/testbench/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java

index 9c1fa8910984a3cba866d600851b8b4b83501884..28b1a21230114de94be4362b28d014f9c3a4cfdb 100644 (file)
@@ -258,7 +258,11 @@ public class VBoxLayout extends FlowPanel {
                     this.captionText.addClassName("v-captiontext");
                     caption.appendChild(this.captionText);
                 }
-                this.captionText.setInnerText(captionText);
+                if (captionText.equals("")) {
+                    this.captionText.setInnerHTML("&nbsp;");
+                } else {
+                    this.captionText.setInnerText(captionText);
+                }
             } else if (this.captionText != null) {
                 this.captionText.removeFromParent();
                 this.captionText = null;
index 1111c9a296abe96cf77cd85ce5598a65d4ee72e9..335067ca7a546385a8895a613e99171f6286a816 100644 (file)
@@ -412,7 +412,19 @@ public class ComponentSizeValidator implements Serializable {
                 return true;
             }
 
-            if (parent instanceof GridLayout) {
+            if (parent instanceof AbstractOrderedLayout) {
+                boolean horizontal = true;
+                if (parent instanceof VerticalLayout) {
+                    horizontal = false;
+                }
+                if (horizontal
+                        && hasNonRelativeHeightComponent((AbstractOrderedLayout) parent)) {
+                    return true;
+                } else {
+                    return false;
+                }
+
+            } else if (parent instanceof GridLayout) {
                 GridLayout gl = (GridLayout) parent;
                 Area componentArea = gl.getComponentArea(component);
                 boolean rowHasHeight = false;
@@ -495,7 +507,20 @@ public class ComponentSizeValidator implements Serializable {
         if (parent.getWidth() < 0) {
             // Undefined width
 
-            if (parent instanceof GridLayout) {
+            if (parent instanceof AbstractOrderedLayout) {
+                AbstractOrderedLayout ol = (AbstractOrderedLayout) parent;
+                boolean horizontal = true;
+                if (ol instanceof VerticalLayout) {
+                    horizontal = false;
+                }
+
+                if (!horizontal && hasNonRelativeWidthComponent(ol)) {
+                    // valid situation, other components defined width
+                    return true;
+                } else {
+                    return false;
+                }
+            } else if (parent instanceof GridLayout) {
                 GridLayout gl = (GridLayout) parent;
                 Area componentArea = gl.getComponentArea(component);
                 boolean columnHasWidth = false;
index ecf8d83ffa4810612cb82288c397bba545f0c6de..f3a92d410c52cc65b303b262b4388221e67eea29 100644 (file)
@@ -43,7 +43,6 @@ public class TextFieldRelativeWidth extends TestBase {
             setPageLength(100);
             setHeight("100%");
             setSizeFull();
-            getLayout().setSizeFull();
             addContainerProperty("id", Integer.class, null);
             addContainerProperty("text", Component.class, null);
             addContainerProperty("button", Button.class, null);
index 8dc33a47a490fad65ed35ad0470994c4b1ecd359..3e1a709243cbf5e6abb1c26cba393a60260acbfc 100644 (file)
@@ -29,7 +29,6 @@ public class TextFieldInLayoutInTable extends Application.LegacyApplication {
 
         table.setSizeFull();
         mainWindow.addComponent(table);
-        mainWindow.getContent().setSizeFull();
     }
 
 }