From: Jouni Koivuviita Date: Wed, 18 Apr 2012 08:41:23 +0000 (+0300) Subject: Fixes to BoxLayout based on first round of screenshot tests X-Git-Tag: 7.0.0.beta1~271 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d20aadde5e1cff073643cc18ca13c8efa8a996bf;p=vaadin-framework.git Fixes to BoxLayout based on first round of screenshot tests --- diff --git a/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java index 9c1fa89109..28b1a21230 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java @@ -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(" "); + } else { + this.captionText.setInnerText(captionText); + } } else if (this.captionText != null) { this.captionText.removeFromParent(); this.captionText = null; diff --git a/src/com/vaadin/terminal/gwt/server/ComponentSizeValidator.java b/src/com/vaadin/terminal/gwt/server/ComponentSizeValidator.java index 1111c9a296..335067ca7a 100644 --- a/src/com/vaadin/terminal/gwt/server/ComponentSizeValidator.java +++ b/src/com/vaadin/terminal/gwt/server/ComponentSizeValidator.java @@ -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; diff --git a/tests/testbench/com/vaadin/tests/components/table/TextFieldRelativeWidth.java b/tests/testbench/com/vaadin/tests/components/table/TextFieldRelativeWidth.java index ecf8d83ffa..f3a92d410c 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TextFieldRelativeWidth.java +++ b/tests/testbench/com/vaadin/tests/components/table/TextFieldRelativeWidth.java @@ -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); diff --git a/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java index 8dc33a47a4..3e1a709243 100644 --- a/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java +++ b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java @@ -29,7 +29,6 @@ public class TextFieldInLayoutInTable extends Application.LegacyApplication { table.setSizeFull(); mainWindow.addComponent(table); - mainWindow.getContent().setSizeFull(); } }