summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/com/vaadin/tests/layouts')
-rw-r--r--uitest/src/com/vaadin/tests/layouts/AbsoluteLayoutAddRemove.java51
-rw-r--r--uitest/src/com/vaadin/tests/layouts/CaptionsInLayouts.java282
-rw-r--r--uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.html31
-rw-r--r--uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.java82
-rw-r--r--uitest/src/com/vaadin/tests/layouts/CssLayoutCustomCss.java92
-rw-r--r--uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.html32
-rw-r--r--uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java43
-rw-r--r--uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponentWithCaption.java42
-rw-r--r--uitest/src/com/vaadin/tests/layouts/CssLayoutSizeChangePropagation.java62
-rw-r--r--uitest/src/com/vaadin/tests/layouts/DeepComponentTrees.java116
-rw-r--r--uitest/src/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java51
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutCaptions.java230
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutExpandRatioModification.java84
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java52
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java28
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html57
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java69
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutNPE.java74
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutRemoveFinalRow.java47
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.html26
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.java67
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.html47
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.java65
-rw-r--r--uitest/src/com/vaadin/tests/layouts/HiddenHorizontalLayout.java59
-rw-r--r--uitest/src/com/vaadin/tests/layouts/LayoutPerformanceTests.java287
-rw-r--r--uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.html461
-rw-r--r--uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java120
-rw-r--r--uitest/src/com/vaadin/tests/layouts/MovingInvisibleField.html47
-rw-r--r--uitest/src/com/vaadin/tests/layouts/MovingInvisibleField.java57
-rw-r--r--uitest/src/com/vaadin/tests/layouts/OrderedLayoutBasics.java1210
-rw-r--r--uitest/src/com/vaadin/tests/layouts/OrderedLayoutCSSCompatibility.java31
-rw-r--r--uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java320
-rw-r--r--uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.html314
-rw-r--r--uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java215
-rw-r--r--uitest/src/com/vaadin/tests/layouts/TestLayoutPerformance.java135
-rw-r--r--uitest/src/com/vaadin/tests/layouts/TreeWithBordersInLayout.html27
-rw-r--r--uitest/src/com/vaadin/tests/layouts/TreeWithBordersInLayout.java42
-rw-r--r--uitest/src/com/vaadin/tests/layouts/VerticalLayoutExpandRatioModification.java78
-rw-r--r--uitest/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponents.java38
-rw-r--r--uitest/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponentsInitiallyHidden.java59
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/AbstractLayoutTests.java30
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java618
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java578
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html896
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java130
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/UndefWideLabel.java12
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java615
47 files changed, 8109 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/layouts/AbsoluteLayoutAddRemove.java b/uitest/src/com/vaadin/tests/layouts/AbsoluteLayoutAddRemove.java
new file mode 100644
index 0000000000..b2cadebd02
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/AbsoluteLayoutAddRemove.java
@@ -0,0 +1,51 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+
+public class AbsoluteLayoutAddRemove extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Tests that addComponent() and removeComponent() works";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2915;
+ }
+
+ @Override
+ protected void setup() {
+ Layout main = getLayout();
+
+ final Label l = new Label("A Label");
+ final AbsoluteLayout al = new AbsoluteLayout();
+ al.setWidth("300px");
+ al.setHeight("200px");
+ main.addComponent(al);
+
+ final Button b = new Button("Add", new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (l.getParent() == null) {
+ al.addComponent(l);
+ event.getButton().setCaption("Remove");
+ } else {
+ al.removeComponent(l);
+ event.getButton().setCaption("Add");
+ }
+
+ }
+
+ });
+ main.addComponent(b);
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/CaptionsInLayouts.java b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayouts.java
new file mode 100644
index 0000000000..03c3c43ccd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayouts.java
@@ -0,0 +1,282 @@
+package com.vaadin.tests.layouts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.UserError;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class CaptionsInLayouts extends TestBase {
+
+ private static final Object CAPTION = "CAPTION";
+ private static final Object CLASS = "C";
+ private static final Object WIDTH = "W";
+
+ private NativeSelect layoutSelect;
+ private Layout layout;
+ private VerticalLayout verticalLayout;
+ private HorizontalLayout horizontalLayout;
+ private GridLayout gridLayout;
+ private FormLayout formLayout;
+ private List<AbstractField<?>> components = new ArrayList<AbstractField<?>>();
+ private CssLayout cssLayout;
+ private HorizontalLayout layoutParent = new HorizontalLayout();
+
+ @Override
+ protected void setup() {
+ // setTheme("tests-tickets");
+ addComponent(createLayoutSelect());
+ addComponent(toggleRequired());
+ // addComponent(toggleCaptions());
+ addComponent(toggleError());
+ addComponent(toggleIcon());
+ addComponent(addCaptionText());
+ layoutParent.addComponent(new NativeButton("Button right of layout"));
+ addComponent(layoutParent);
+ addComponent(new NativeButton("Button below layout"));
+ createComponents();
+ layoutSelect.setValue(layoutSelect.getItemIds().iterator().next());
+ }
+
+ private Component addCaptionText() {
+ Button b = new Button("Add caption text");
+ b.addListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ prependCaptions("a");
+ }
+ });
+ return b;
+ }
+
+ protected void prependCaptions(String prepend) {
+ for (AbstractField<?> c : components) {
+ c.setCaption(prepend + c.getCaption());
+ }
+
+ }
+
+ private Component toggleRequired() {
+ CheckBox requiredToggle = new CheckBox();
+ requiredToggle.setImmediate(true);
+ requiredToggle.setCaption("Required");
+ requiredToggle.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ setRequired((Boolean) event.getProperty().getValue());
+ }
+ });
+ return requiredToggle;
+ }
+
+ private Component toggleIcon() {
+ CheckBox iconToggle = new CheckBox();
+ iconToggle.setImmediate(true);
+ iconToggle.setCaption("Icons");
+ iconToggle.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ setIcon((Boolean) event.getProperty().getValue());
+ }
+ });
+ return iconToggle;
+ }
+
+ protected void setRequired(boolean value) {
+ for (AbstractField<?> c : components) {
+ c.setRequired(value);
+ }
+
+ }
+
+ protected void setIcon(boolean value) {
+ for (AbstractField<?> c : components) {
+ if (!value) {
+ c.setIcon(null);
+ } else {
+ c.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
+ }
+ }
+
+ }
+
+ private Component toggleError() {
+ CheckBox errorToggle = new CheckBox();
+ errorToggle.setImmediate(true);
+ errorToggle.setCaption("Error");
+ errorToggle.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ setError((Boolean) event.getProperty().getValue());
+ }
+ });
+ return errorToggle;
+ }
+
+ protected void setError(boolean value) {
+ for (AbstractField<?> c : components) {
+ if (value) {
+ c.setComponentError(new UserError("error"));
+ } else {
+ c.setComponentError(null);
+
+ }
+ }
+
+ }
+
+ private void createComponents() {
+ TextField tfUndefWide = new TextField(
+ "Undefined wide text field with a very long caption, longer than the field and the layout. Lorem ipsum dolor sit amet.");
+ TextField tf100pxWide = new TextField(
+ "100 px wide text field with a very long caption, longer than 100px.");
+ tf100pxWide.setWidth("100px");
+
+ TextField tf500pxWide = new TextField(
+ "500 px wide text field with a very long caption, longer than 500px. Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
+ tf500pxWide.setWidth("500px");
+
+ components.add(tfUndefWide);
+ components.add(tf100pxWide);
+ components.add(tf500pxWide);
+
+ }
+
+ private void setLayout(Layout newLayout) {
+ if (layout == null) {
+ layoutParent.addComponent(newLayout, 0);
+ } else {
+ layoutParent.replaceComponent(layout, newLayout);
+ }
+ layout = newLayout;
+
+ for (Component c : components) {
+ if (c.getParent() != layout) {
+ layout.addComponent(c);
+ }
+ }
+
+ }
+
+ private Layout getLayout(String caption,
+ Class<? extends Layout> layoutClass, String width) {
+ Layout l;
+ if (layoutClass == VerticalLayout.class) {
+ if (verticalLayout == null) {
+ verticalLayout = new VerticalLayout();
+ verticalLayout.setStyleName("borders");
+ }
+ l = verticalLayout;
+ } else if (layoutClass == HorizontalLayout.class) {
+ if (horizontalLayout == null) {
+ horizontalLayout = new HorizontalLayout();
+ horizontalLayout.setStyleName("borders");
+ }
+ l = horizontalLayout;
+ } else if (layoutClass == GridLayout.class) {
+ if (gridLayout == null) {
+ gridLayout = new GridLayout();
+ gridLayout.setStyleName("borders");
+ }
+ l = gridLayout;
+ } else if (layoutClass == CssLayout.class) {
+ if (cssLayout == null) {
+ cssLayout = new CssLayout();
+ cssLayout.setStyleName("borders");
+ }
+ l = cssLayout;
+ } else if (layoutClass == FormLayout.class) {
+ if (formLayout == null) {
+ formLayout = new FormLayout();
+ formLayout.setStyleName("borders");
+ }
+ l = formLayout;
+ } else {
+ return null;
+ }
+
+ l.setCaption(caption);
+ if (width.equals("auto")) {
+ width = null;
+ }
+
+ l.setWidth(width);
+
+ // addComponent(l);
+
+ return l;
+ }
+
+ private Component createLayoutSelect() {
+ layoutSelect = new NativeSelect("Layout");
+ layoutSelect.addContainerProperty(CAPTION, String.class, "");
+ layoutSelect.addContainerProperty(CLASS, Class.class, "");
+ layoutSelect.addContainerProperty(WIDTH, String.class, "");
+ layoutSelect.setItemCaptionPropertyId(CAPTION);
+ layoutSelect.setNullSelectionAllowed(false);
+
+ for (Class<?> cls : new Class[] { HorizontalLayout.class,
+ VerticalLayout.class, GridLayout.class, CssLayout.class,
+ FormLayout.class }) {
+ for (String width : new String[] { "400px", "auto" }) {
+ Object id = layoutSelect.addItem();
+ Item i = layoutSelect.getItem(id);
+ i.getItemProperty(CAPTION).setValue(
+ cls.getSimpleName() + ", " + width);
+ i.getItemProperty(CLASS).setValue(cls);
+ i.getItemProperty(WIDTH).setValue(width);
+ }
+
+ }
+ layoutSelect.setImmediate(true);
+ layoutSelect.addListener(new ValueChangeListener() {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void valueChange(ValueChangeEvent event) {
+ Item i = layoutSelect.getItem(event.getProperty().getValue());
+
+ setLayout(getLayout((String) i.getItemProperty(CAPTION)
+ .getValue(), (Class<? extends Layout>) i
+ .getItemProperty(CLASS).getValue(), (String) i
+ .getItemProperty(WIDTH).getValue()));
+ }
+ });
+
+ return layoutSelect;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tests what happens when the caption changes in various layouts. Behavior should be consistent.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5424;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.html b/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.html
new file mode 100644
index 0000000000..6dab84d718
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.html
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>ComplexGLColumnExpansionWithColSpan</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ComplexGLColumnExpansionWithColSpan</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.ComplexGLColumnExpansionWithColSpan?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsComplexGLColumnExpansionWithColSpan::/VVerticalLayout[0]/VGridLayout[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>buttons-next-stacked-left</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.java b/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.java
new file mode 100644
index 0000000000..f4050ea085
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.java
@@ -0,0 +1,82 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.server.Sizeable;
+import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class ComplexGLColumnExpansionWithColSpan extends AbstractTestCase {
+ private int cols;
+
+ @Override
+ protected String getDescription() {
+ return "Buttons should stay stacked on left when clicking new button";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5227;
+ }
+
+ @Override
+ public void init() {
+ final VerticalLayout mainLayout = new VerticalLayout();
+
+ mainLayout.setSpacing(true);
+ mainLayout.setMargin(true);
+ mainLayout.setHeight(100, Sizeable.UNITS_PERCENTAGE);
+ mainLayout.setWidth(100, Sizeable.UNITS_PERCENTAGE);
+ setMainWindow(new LegacyWindow("Vaadin Test", mainLayout));
+
+ cols = 1;
+ final GridLayout gl = new GridLayout(cols, 3);
+ gl.setWidth("1000px");
+ // textfield spreads across all cols
+ final TextField textfield = new TextField();
+ textfield.setWidth(100, Sizeable.UNITS_PERCENTAGE);
+ Button b1 = new Button("new button");
+ Button b2 = new Button("nothing");
+ gl.addComponent(textfield, 0, 0);
+ gl.addComponent(b1, 0, 1);
+ gl.addComponent(b2, 0, 2);
+ b1.setWidth(270, Sizeable.UNITS_PIXELS);
+ b2.setWidth(270, Sizeable.UNITS_PIXELS);
+ b1.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ cols++;
+ gl.setColumns(cols);
+ Button b1 = new Button("new button" + cols);
+ Button b2 = new Button("nothing" + cols);
+ gl.addComponent(b1, cols - 1, 1);
+ gl.addComponent(b2, cols - 1, 2);
+ b1.setWidth(270, Sizeable.UNITS_PIXELS);
+ b2.setWidth(270, Sizeable.UNITS_PIXELS);
+ // adjust expand ratios...
+ if (cols > 0) {
+ // next to last colum 0, last column 100
+ gl.setColumnExpandRatio(cols - 2, 0);
+ gl.setColumnExpandRatio(cols - 1, 100);
+ }
+ gl.removeComponent(textfield);
+ gl.addComponent(textfield, 0, 0, cols - 1, 0);
+ }
+ });
+ gl.setSizeFull();
+ mainLayout.addComponent(gl);
+ mainLayout.setExpandRatio(gl, 100);
+ Button restart = new Button("restart");
+ mainLayout.addComponent(restart);
+ restart.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ mainLayout.getUI().getApplication().close();
+ }
+ });
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/CssLayoutCustomCss.java b/uitest/src/com/vaadin/tests/layouts/CssLayoutCustomCss.java
new file mode 100644
index 0000000000..2f717d2b64
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/CssLayoutCustomCss.java
@@ -0,0 +1,92 @@
+package com.vaadin.tests.layouts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Layout.MarginHandler;
+import com.vaadin.ui.NativeButton;
+
+public class CssLayoutCustomCss extends TestBase implements ClickListener {
+
+ protected Map<Component, String> css = new HashMap<Component, String>();
+ private CssLayout layout;
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+ layout = new CssLayout() {
+ @Override
+ protected String getCss(com.vaadin.ui.Component c) {
+ return css.get(c);
+ }
+ };
+ layout.setSizeFull();
+ addComponent(layout);
+
+ Button red, green;
+ layout.addComponent(red = createButton("color:red"));
+ layout.addComponent(createButton("color: blue"));
+ layout.addComponent(green = createButton("color: green"));
+
+ red.click();
+ green.click();
+ layout.addComponent(createMarginsToggle());
+ }
+
+ private Component createMarginsToggle() {
+ final CheckBox cb = new CheckBox("Margins");
+ cb.setImmediate(true);
+ cb.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ ((MarginHandler) layout).setMargin(cb.getValue());
+ }
+ });
+
+ return cb;
+ }
+
+ private Button createButton(String string) {
+ NativeButton button = new NativeButton(string);
+ css.put(button, string);
+ button.addListener(this);
+ return button;
+ }
+
+ @Override
+ protected String getDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Button b = event.getButton();
+ if (b.getCaption().contains("not ")) {
+ b.setCaption(b.getCaption().substring(4));
+ css.put(b, b.getCaption());
+ } else {
+ css.remove(b);
+ b.setCaption("not " + b.getCaption());
+ }
+ layout.markAsDirty();
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.html b/uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.html
new file mode 100644
index 0000000000..0932be5d81
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.html
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>CssLayoutRemoveComponent</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">CssLayoutRemoveComponent</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.CssLayoutRemoveComponent?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsCssLayoutRemoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCssLayout[0]/VCssLayout$FlowPane[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>caption1-hidden</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java b/uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java
new file mode 100644
index 0000000000..093dc782fb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponent.java
@@ -0,0 +1,43 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.TextField;
+
+@SuppressWarnings("serial")
+public class CssLayoutRemoveComponent extends TestBase {
+
+ @Override
+ protected void setup() {
+ final CssLayout layout = new CssLayout();
+ final TextField tf = new TextField("Caption1");
+ Button b = new Button("Remove field ", new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ layout.removeComponent(tf);
+ }
+
+ });
+ layout.addComponent(tf);
+ layout.addComponent(b);
+ layout.addComponent(new TextField("Caption2"));
+ layout.addComponent(new TextField("Caption3"));
+
+ addComponent(layout);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Clicking on the button should remove one text field but other textfields and their captions should stay intact.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5778;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponentWithCaption.java b/uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponentWithCaption.java
new file mode 100644
index 0000000000..df4fc8615d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/CssLayoutRemoveComponentWithCaption.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.TextField;
+
+public class CssLayoutRemoveComponentWithCaption extends TestBase {
+
+ @Override
+ protected void setup() {
+ final CssLayout layout = new CssLayout();
+ final TextField tf = new TextField("Caption");
+ Button b = new Button("Remove field and add new", new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ layout.removeComponent(tf);
+ addComponent(new TextField("new field"));
+
+ }
+
+ });
+ layout.addComponent(tf);
+ layout.addComponent(b);
+
+ addComponent(layout);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Clicking on the button should remove the text field and add a new 'new field' text field";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4204;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/CssLayoutSizeChangePropagation.java b/uitest/src/com/vaadin/tests/layouts/CssLayoutSizeChangePropagation.java
new file mode 100644
index 0000000000..ed3c5e66d3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/CssLayoutSizeChangePropagation.java
@@ -0,0 +1,62 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+
+public class CssLayoutSizeChangePropagation extends TestBase {
+
+ @Override
+ protected void setup() {
+ getLayout().setSizeFull();
+ final VerticalLayout sp = new VerticalLayout();
+
+ sp.setHeight("100%");
+
+ final CssLayout cssLayout = new CssLayout() {
+ @Override
+ protected String getCss(Component c) {
+ return "background-color: yellow;";
+ }
+ };
+ cssLayout.setSizeFull();
+ Label l = new Label("bö");
+ l.setSizeFull();
+ cssLayout.addComponent(l);
+
+ sp.addComponent(cssLayout);
+
+ Button button = new Button("b");
+ button.addListener(new ClickListener() {
+ boolean bool = true;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ sp.setExpandRatio(cssLayout, bool ? 1 : 0);
+ bool = !bool;
+ }
+ });
+
+ sp.addComponent(button);
+ sp.setExpandRatio(button, 1);
+
+ getLayout().addComponent(sp);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Upper part of view should become yellow on button click.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4351;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/DeepComponentTrees.java b/uitest/src/com/vaadin/tests/layouts/DeepComponentTrees.java
new file mode 100644
index 0000000000..e119b91b82
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/DeepComponentTrees.java
@@ -0,0 +1,116 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
+
+public class DeepComponentTrees extends TestBase {
+
+ private Panel root;
+
+ @Override
+ protected String getDescription() {
+ return "Vaadin should not choke on deep component trees. 15 levels should be minimum to survive.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+ private int i = 0;
+ private Class<?> currentValue = VerticalLayout.class;
+
+ @Override
+ protected void setup() {
+ Layout main = getLayout();
+ main.setSizeUndefined();
+ getMainWindow().getContent().setHeight(null);
+
+ Label l = new Label(
+ "This is a nice game to guess how many Layouts your FF2 (or any other browser) can deal with. Due to the worldwide attempt to decrease energy consumption, playing this game is only allowed above 60° longitude betwheen August and May (as excess energy consumed by you CPU is used to heat your room). It is considered wise to save all your work before starting the game.");
+
+ root = new Panel("Test box");
+ root.setWidth("600px");
+ root.setHeight("200px");
+ final Button b = new Button("Go try your luck with " + i + " layouts!");
+ b.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ FF2KILLER(i++);
+ b.setCaption("Go try your luck with " + i + " layouts!");
+ }
+
+ });
+
+ final ComboBox s = new ComboBox("Restart game with select:");
+ s.setNullSelectionAllowed(false);
+ s.addItem("-- Choose value --");
+ s.setValue("-- Choose value --");
+ s.addItem(VerticalLayout.class);
+ s.addItem(HorizontalLayout.class);
+ s.addItem(GridLayout.class);
+ s.addListener(new ComboBox.ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ Object value = s.getValue();
+ if (!value.equals("-- Choose value --")) {
+ currentValue = (Class<?>) value;
+ i = 0;
+ s.setValue("-- Choose value --");
+ b.setCaption("Go try your luck with " + i + " layouts!");
+ }
+
+ }
+ });
+ s.setImmediate(true);
+
+ main.addComponent(l);
+ main.addComponent(b);
+ main.addComponent(s);
+ main.addComponent(root);
+
+ }
+
+ private void FF2KILLER(int layouts) {
+ Layout layout = getTestLayout();
+ Layout r = layout;
+ for (int i = 0; i < layouts; i++) {
+ Layout lo = getTestLayout();
+ layout.addComponent(lo);
+ layout = lo;
+ }
+ layout.addComponent(new Label(
+ "FF did it! Vaadin, Mozilla and you win! Dare to try again?"));
+ root.setContent(r);
+ }
+
+ Layout getTestLayout() {
+ Layout l = new VerticalLayout();
+ if (currentValue == GridLayout.class) {
+ l = new GridLayout(1, 1);
+ } else {
+ try {
+ l = (Layout) currentValue.newInstance();
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ return l;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java b/uitest/src/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java
new file mode 100644
index 0000000000..f596fdb77e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java
@@ -0,0 +1,51 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.TextArea;
+
+public class FormLayoutWithInvisibleComponent extends TestBase {
+
+ private TextArea messages;
+
+ @Override
+ protected String getDescription() {
+ return "There is an initial invisible text field below the checkbox. Checking the checkbox should show the field as a textarea (40x10) and also show its caption(\"Messages visible\") and a required error (*).";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2706;
+ }
+
+ @Override
+ protected void setup() {
+ FormLayout formLayout = new FormLayout();
+ CheckBox control = new CheckBox("Messages On/Off");
+ control.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ messages.setVisible((Boolean) event.getProperty().getValue());
+ messages.setRequired(true);
+ messages.setCaption("Messages visible");
+ }
+
+ });
+ control.setImmediate(true);
+ formLayout.addComponent(control);
+
+ messages = new TextArea("Messages hidden");
+ messages.setRows(10);
+ messages.setColumns(40);
+ messages.setVisible(false);
+ messages.setEnabled(false);
+ formLayout.addComponent(messages);
+
+ addComponent(formLayout);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutCaptions.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutCaptions.java
new file mode 100644
index 0000000000..9f2715a09b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutCaptions.java
@@ -0,0 +1,230 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Validator;
+import com.vaadin.data.util.BeanItem;
+import com.vaadin.server.AbstractErrorMessage;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.DefaultFieldFactory;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.Form;
+import com.vaadin.ui.FormFieldFactory;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class GridLayoutCaptions extends TestBase {
+
+ class CustomForm extends Form {
+ private com.vaadin.ui.GridLayout layout;
+
+ private VerticalLayout wrapper = new VerticalLayout();
+ private CssLayout wrapper2 = new CssLayout();
+
+ private FormFieldFactory fff = new FormFieldFactory() {
+
+ @Override
+ public Field<?> createField(Item item, Object propertyId,
+ Component uiContext) {
+
+ if (propertyId.equals(DataPOJO.Fields.name.name())) {
+ Field<?> f = DefaultFieldFactory.get().createField(item,
+ propertyId, uiContext);
+ f.setCaption("This is a long caption for the name field");
+ return f;
+
+ } else if (propertyId.equals(DataPOJO.Fields.hp.name())) {
+ Field<?> f = DefaultFieldFactory.get().createField(item,
+ propertyId, uiContext);
+ f.setCaption("This is a long caption for the HP field, but it has a VL as a wrapper");
+
+ return f;
+
+ } else if (propertyId.equals(DataPOJO.Fields.place.name())) {
+ Field<?> f = DefaultFieldFactory.get().createField(item,
+ propertyId, uiContext);
+ f.setCaption("This is a long caption for the Place field, but it has a CSSLo as a wrapper");
+
+ return f;
+
+ } else if (propertyId.equals(DataPOJO.Fields.price.name())) {
+ Field<?> f = DefaultFieldFactory.get().createField(item,
+ propertyId, uiContext);
+ f.setCaption("With size undefined the caption behaves like this...");
+ f.setSizeFull();
+
+ return f;
+
+ } else {
+ return DefaultFieldFactory.get().createField(item,
+ propertyId, uiContext);
+ }
+ }
+ };
+
+ public CustomForm() {
+ super();
+ layout = new GridLayout(3, 3);
+ layout.addComponent(wrapper, 1, 0);
+ layout.addComponent(wrapper2, 2, 0);
+ layout.setSpacing(true);
+
+ setLayout(layout);
+ setFormFieldFactory(fff);
+
+ Label l = new Label("A label with caption");
+ l.setCaption("A really long caption that is clipped");
+
+ layout.addComponent(l, 0, 2);
+
+ Label l2 = new Label("A wrapped label with caption");
+ l2.setCaption("A really long caption that is not clipped");
+
+ VerticalLayout vl = new VerticalLayout();
+ vl.addComponent(l2);
+
+ layout.addComponent(vl, 1, 2);
+
+ }
+
+ public void createErrors() {
+ Validator.InvalidValueException ive = new Validator.InvalidValueException(
+ "Ipsum lipsum laarum lop... ");
+
+ for (Object propIDs : getItemDataSource().getItemPropertyIds()) {
+ ((TextField) getField(propIDs))
+ .setComponentError(AbstractErrorMessage
+ .getErrorMessageForException(ive));
+
+ }
+
+ }
+
+ public void clearErrors() {
+ for (Object propIDs : getItemDataSource().getItemPropertyIds()) {
+ ((TextField) getField(propIDs)).setComponentError(null);
+
+ }
+ }
+
+ @Override
+ protected void attachField(Object propertyId, Field field) {
+
+ if (propertyId.equals(DataPOJO.Fields.name.name())) {
+ layout.addComponent(field, 0, 0);
+
+ } else if (propertyId.equals(DataPOJO.Fields.hp.name())) {
+ wrapper.removeAllComponents();
+ wrapper.addComponent(field);
+ } else if (propertyId.equals(DataPOJO.Fields.place.name())) {
+ wrapper2.removeAllComponents();
+ wrapper2.addComponent(field);
+ } else if (propertyId.equals(DataPOJO.Fields.price.name())) {
+ layout.addComponent(field, 0, 1);
+ }
+
+ }
+ }
+
+ public static class DataPOJO {
+
+ public enum Fields {
+ name, price, hp, place;
+ }
+
+ private String name;
+ private int price;
+ private String hp;
+ private String place;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getPrice() {
+ return price;
+ }
+
+ public void setPrice(int price) {
+ this.price = price;
+ }
+
+ public String getHp() {
+ return hp;
+ }
+
+ public void setHp(String hp) {
+ this.hp = hp;
+ }
+
+ public String getPlace() {
+ return place;
+ }
+
+ public void setPlace(String place) {
+ this.place = place;
+ }
+
+ }
+
+ @Override
+ protected void setup() {
+ LegacyWindow mainWindow = getMainWindow();
+
+ Label label = new Label("Hello Vaadin user");
+ mainWindow.addComponent(label);
+
+ DataPOJO forDemo = new DataPOJO();
+
+ BeanItem<DataPOJO> bi = new BeanItem<DataPOJO>(forDemo);
+
+ final CustomForm aFormWithGl = new CustomForm();
+
+ aFormWithGl.setItemDataSource(bi);
+
+ mainWindow.addComponent(aFormWithGl);
+
+ Button b = new Button("Give me an error!", new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ aFormWithGl.createErrors();
+
+ }
+ });
+ mainWindow.addComponent(b);
+
+ Button b2 = new Button("Get rid of an error!",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ aFormWithGl.clearErrors();
+
+ }
+ });
+ mainWindow.addComponent(b2);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Captions in Gridlayout behaves differently than in other layouts";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5424;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutExpandRatioModification.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutExpandRatioModification.java
new file mode 100644
index 0000000000..acc5f07103
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutExpandRatioModification.java
@@ -0,0 +1,84 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class GridLayoutExpandRatioModification extends TestBase implements
+ ClickListener {
+
+ private boolean isVisible = false;
+ private GridLayout mainLayout;
+ private VerticalLayout vl1;
+ private VerticalLayout vl2;
+ private Button button;
+
+ @Override
+ public void setup() {
+ LegacyWindow main = getMainWindow();
+
+ mainLayout = new GridLayout(3, 3);
+ main.setContent(mainLayout);
+
+ // The upper layout
+ vl1 = new VerticalLayout();
+ Label label1 = new Label("The upper/left layout");
+ vl1.addComponent(label1);
+
+ // Button that hides or shows the bottom part
+ button = new Button("show / hide", this);
+
+ // The bottom layout
+ vl2 = new VerticalLayout();
+ TextField tf = new TextField("The bottom/right field");
+ tf.setHeight("100%");
+ tf.setWidth("100%");
+ vl2.addComponent(tf);
+
+ // Add everything to the view
+ mainLayout.addComponent(vl1, 0, 0);
+ mainLayout.addComponent(button, 1, 1);
+ mainLayout.addComponent(vl2, 2, 2);
+
+ // Set expand ratios, hide lower
+ mainLayout.setRowExpandRatio(0, 1);
+ mainLayout.setColumnExpandRatio(0, 1);
+ mainLayout.setRowExpandRatio(2, 0);
+ mainLayout.setColumnExpandRatio(2, 0);
+
+ // Maximize everything
+ main.setSizeFull();
+ mainLayout.setSizeFull();
+ vl1.setSizeFull();
+ vl2.setSizeFull();
+ }
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (isVisible) {
+ mainLayout.setRowExpandRatio(2, 0);
+ mainLayout.setColumnExpandRatio(2, 0);
+ isVisible = false;
+ } else {
+ mainLayout.setRowExpandRatio(2, 1);
+ mainLayout.setColumnExpandRatio(2, 1);
+ isVisible = true;
+ }
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Changing the expand ratio should repaint the layout correctly. Changing from 0 to something else should render the previously invisible component";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2454;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java
new file mode 100644
index 0000000000..e200c40744
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java
@@ -0,0 +1,52 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout.MarginHandler;
+import com.vaadin.ui.Panel;
+
+public class GridLayoutInsidePanel extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "The first Panel contains a VerticalLayout, which contains a GridLayout, which contains a Label. The second panel directly contains a GridLayout, which contains a Label. Both should be rendered in the same way.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2652;
+ }
+
+ @Override
+ protected void setup() {
+ {
+ GridLayout gl = new GridLayout(1, 1);
+ gl.setSizeUndefined();
+ gl.addComponent(new Label(
+ "A label which defines the size of the GL"));
+
+ Panel p = new Panel("Panel 1");
+ ((MarginHandler) p.getContent()).setMargin(false);
+ p.setSizeUndefined();
+ p.getContent().setSizeUndefined();
+
+ p.addComponent(gl);
+ addComponent(p);
+ }
+ {
+ GridLayout gl = new GridLayout(1, 1);
+ gl.setSizeUndefined();
+ gl.addComponent(new Label(
+ "A label which defines the size of the GL"));
+
+ Panel p = new Panel("Panel 2", gl);
+ ((MarginHandler) p.getContent()).setMargin(false);
+ p.setSizeUndefined();
+ p.getContent().setSizeUndefined();
+
+ addComponent(p);
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java
new file mode 100644
index 0000000000..6273b92838
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java
@@ -0,0 +1,28 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.Application;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.UI.LegacyWindow;
+
+public class GridLayoutInsidePanel2 extends Application.LegacyApplication {
+
+ private Layout layout;
+
+ @Override
+ public void init() {
+ LegacyWindow w = new LegacyWindow("Main");
+ setMainWindow(w);
+ layout = (Layout) w.getContent();
+ GridLayout gl = new GridLayout(1, 1);
+ gl.setSizeUndefined();
+ Label l = new Label("This should be visible");
+ l.setWidth("100px");
+ gl.addComponent(l);
+
+ layout.setSizeUndefined();
+ layout.addComponent(gl);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html b/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html
new file mode 100644
index 0000000000..77a17263f8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.GridLayoutMoveComponent?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>all-left</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsGridLayoutMoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>label-right</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsGridLayoutMoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>label-button-right</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsGridLayoutMoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>label-button-textfield-right</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java
new file mode 100644
index 0000000000..efd1277653
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java
@@ -0,0 +1,69 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TextField;
+
+public class GridLayoutMoveComponent extends TestBase {
+
+ @Override
+ protected void setup() {
+ final GridLayout grid = new GridLayout(2, 3);
+ grid.setCaption("Fixed size grid");
+ grid.setWidth("300px");
+ grid.setHeight("100px");
+ addComponent(grid);
+
+ final Label l = new Label("100% label");
+ final Button b = new Button("100px button");
+ b.setWidth("100px");
+ final TextField tf = new TextField("Undef textfield");
+
+ // Adding component to grid
+ grid.addComponent(l, 0, 0);
+ grid.addComponent(b, 0, 1);
+ grid.addComponent(tf, 0, 2);
+
+ addComponent(new Button("Shift label right",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ // Moving component from 0,0 -> 1,0
+ grid.removeComponent(l);
+ grid.addComponent(l, 1, 0);
+ }
+ }));
+
+ addComponent(new Button("Shift button right",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ grid.removeComponent(b);
+ grid.addComponent(b, 1, 1);
+ }
+ }));
+
+ addComponent(new Button("Shift text field right",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ grid.removeComponent(tf);
+ grid.addComponent(tf, 1, 2);
+ }
+ }));
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Click the buttons below the GridLayout to move the components to the right. Should definitely work no matter what.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5525;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutNPE.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutNPE.java
new file mode 100644
index 0000000000..3531a4e13c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutNPE.java
@@ -0,0 +1,74 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+
+public class GridLayoutNPE extends TestBase {
+
+ @Override
+ protected void setup() {
+ final VerticalLayout lo = new VerticalLayout();
+
+ final GridLayout gl = new GridLayout(2, 1);
+ gl.setSpacing(true);
+
+ final Label toRemove = new Label("First");
+ gl.addComponent(toRemove);
+ final Label toEdit = new Label("Second");
+ gl.addComponent(toEdit);
+
+ final Button b = new Button("remove 'First'");
+ final Button b2 = new Button("edit 'Second'");
+ b2.setVisible(false);
+
+ lo.addComponent(gl);
+ lo.addComponent(b);
+ lo.addComponent(b2);
+
+ b.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ gl.removeComponent(toRemove);
+
+ // move another component to where the first was removed
+ // before rendering to the client
+ gl.removeComponent(toEdit);
+ // this could also be the result of removeAllComponents()
+ // followed by a loop of addComponent(c)
+ gl.addComponent(toEdit, 0, 0);
+
+ b.setVisible(false);
+ b2.setVisible(true);
+
+ }
+
+ });
+
+ b2.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ toEdit.setValue("Second (edited)");
+ }
+
+ });
+
+ addComponent(lo);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "VGridLayout throws an NPE, causing client side to crash";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4019;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutRemoveFinalRow.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutRemoveFinalRow.java
new file mode 100644
index 0000000000..5d45f72142
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutRemoveFinalRow.java
@@ -0,0 +1,47 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+
+/**
+ * Tests removing rows from a GridLayout
+ */
+@SuppressWarnings("serial")
+public class GridLayoutRemoveFinalRow extends TestBase {
+
+ @Override
+ protected void setup() {
+ getLayout().setSpacing(true);
+
+ final GridLayout layout = new GridLayout(2, 2);
+ layout.setSpacing(true);
+ layout.addComponent(new Label("Label1"));
+ layout.addComponent(new Label("Label2"));
+ layout.addComponent(new Label("Label3"));
+ layout.addComponent(new Label("Label4"));
+ addComponent(layout);
+
+ Button removeRowBtn = new Button("Remove row",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ layout.removeRow(0);
+ }
+ });
+ addComponent(removeRowBtn);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Removing last row of a GridLayout throws a IllegalArgumentException";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4542;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.html b/uitest/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.html
new file mode 100644
index 0000000000..5237d5f49e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.html
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.GridLayoutSpanExpansion?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.java
new file mode 100644
index 0000000000..9753526a9e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.java
@@ -0,0 +1,67 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+
+public class GridLayoutSpanExpansion extends TestBase {
+
+ @Override
+ protected void setup() {
+ GridLayout heightSpan = new GridLayout(2, 2);
+ heightSpan.setHeight("200px");
+ heightSpan.setWidth("200px");
+ heightSpan.addComponent(new Label("1"), 0, 0);
+ heightSpan.addComponent(new Label("2"), 0, 1);
+ heightSpan.addComponent(new Label(
+ "This is a somewhat long text that spans over a few lines."),
+ 1, 0, 1, 1);
+ heightSpan.setRowExpandRatio(1, 1);
+ addComponent(heightSpan);
+
+ GridLayout widthSpan = new GridLayout(2, 2);
+ widthSpan.setHeight("100px");
+ widthSpan.setWidth("200px");
+ widthSpan.addComponent(new Label(
+ "This is a somewhat long text that spans over both columns."),
+ 0, 0, 1, 0);
+ Label label1 = new Label("1");
+ label1.setSizeUndefined();
+ widthSpan.addComponent(label1, 0, 1);
+ widthSpan.addComponent(new Label("2"), 1, 1);
+ widthSpan.setColumnExpandRatio(1, 1);
+ addComponent(widthSpan);
+
+ GridLayout multipleSpans = new GridLayout(3, 3);
+ multipleSpans.setWidth("400px");
+ multipleSpans.addComponent(new Button("Button 0,0"), 0, 0);
+ multipleSpans.addComponent(new Button("Button 1,0"), 1, 0);
+ multipleSpans.addComponent(
+ makeWideButton("A wide spanning button at 0,1"), 0, 1, 1, 1);
+ multipleSpans.addComponent(
+ makeWideButton("Another wide spanning button at 1,2"), 1, 2, 2,
+ 2);
+ multipleSpans.setColumnExpandRatio(0, 1);
+ multipleSpans.setColumnExpandRatio(1, 3);
+ multipleSpans.setColumnExpandRatio(2, 2);
+ addComponent(multipleSpans);
+ }
+
+ private static Button makeWideButton(String caption) {
+ Button wideButton = new Button(caption);
+ wideButton.setWidth("100%");
+ return wideButton;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "In the two first examples, the 1 and the 2 should be close to each other because of the expansion ratios. In the final example, there should be little extra space in the left column, much extra space in the middle and some extra space to the right";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(5868);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.html b/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.html
new file mode 100644
index 0000000000..f01a1a7026
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.html
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>GridLayoutWidthChange</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">GridLayoutWidthChange</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.GridLayoutWidthChange</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsGridLayoutWidthChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.java
new file mode 100644
index 0000000000..c0e6b27c7d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.java
@@ -0,0 +1,65 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class GridLayoutWidthChange extends TestBase {
+
+ private GridLayout generateLayout() {
+ VerticalLayout fields1 = new VerticalLayout();
+
+ NativeButton nb = new NativeButton("A button");
+ nb.setHeight("300px");
+ fields1.addComponent(nb);
+
+ VerticalLayout fields3 = new VerticalLayout();
+ fields3.addComponent(new TextField("field14"));
+
+ NativeButton b = new NativeButton("A big button");
+ b.setWidth("200px");
+ b.setHeight("200px");
+
+ GridLayout layout = new GridLayout(3, 2);
+ layout.setWidth("100%");
+ layout.addComponent(fields1, 0, 0, 0, 1);
+ layout.addComponent(b, 2, 1);
+
+ return layout;
+ }
+
+ @Override
+ protected void setup() {
+ final GridLayout layout1 = generateLayout();
+ final CustomComponent cc = new CustomComponent(layout1);
+ cc.setWidth("500px");
+ addComponent(cc);
+
+ Button testButton = new Button("Reduce GridLayout parent width",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ cc.setWidth((cc.getWidth() - 10) + "px");
+ }
+
+ });
+ addComponent(testButton);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "A 100% wide GridLayout is wrapped inside a CustomComponent. When the width of the CustomComponent is reduced, the size of the GridLayout should be reduced accordingly. The Buttons should stay in place vertically and just move closer to each other horizontally.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/HiddenHorizontalLayout.java b/uitest/src/com/vaadin/tests/layouts/HiddenHorizontalLayout.java
new file mode 100644
index 0000000000..dc0c8958ea
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/HiddenHorizontalLayout.java
@@ -0,0 +1,59 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+
+public class HiddenHorizontalLayout extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Test to verify that toggling layout visibility works properly.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3183;
+ }
+
+ @Override
+ public void setup() {
+
+ VerticalLayout vl = new VerticalLayout();
+ vl.setSizeFull();
+ getLayout().addComponent(vl);
+
+ final HorizontalLayout hl = new HorizontalLayout();
+ hl.setWidth("100%");
+ hl.setHeight("30px");
+ hl.addComponent(new Label("label1"));
+ hl.addComponent(new Label("label2"));
+ hl.addComponent(new Label("label3"));
+ hl.addComponent(new Label("label4"));
+ vl.addComponent(hl);
+
+ Label l = new Label("Steps to reproduce with Vaadin 6.0.1:<br/>"
+ + "1. set browser size smaller than fullscreen<br/>"
+ + "2. Refresh page with browser<br/>"
+ + "3. Click \"toggle layout visibility\"<br>"
+ + "4. Resize browser window to full <br/>"
+ + "5. Click \"toggle layout visibility\"<br/>",
+ ContentMode.XHTML);
+ vl.addComponent(l);
+ Button b = new Button("toggle layout visibility",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ hl.setVisible(!hl.isVisible());
+ }
+
+ });
+ vl.addComponent(b);
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/layouts/LayoutPerformanceTests.java b/uitest/src/com/vaadin/tests/layouts/LayoutPerformanceTests.java
new file mode 100644
index 0000000000..57c6173895
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/LayoutPerformanceTests.java
@@ -0,0 +1,287 @@
+package com.vaadin.tests.layouts;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.Iterator;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractOrderedLayout;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class LayoutPerformanceTests extends TestBase {
+ private static final String[] widths = { null, "100%", "200px" };
+
+ private enum ContainerType {
+ SIMPLE_WRAPS {
+ @Override
+ public ComponentContainer buildLayout(int depth, int leafs,
+ SampleType leafType, boolean fullHeight) {
+ if (depth == 0) {
+ return buildInnerLayout(leafs, leafType, fullHeight);
+ }
+
+ AbstractOrderedLayout layout = createOrderedLayout(depth,
+ fullHeight);
+ layout.addComponent(buildLayout(depth - 1, leafs, leafType,
+ fullHeight));
+ return layout;
+ }
+ },
+ BORDER_LAYOUT {
+ @Override
+ public ComponentContainer buildLayout(int depth, int leafs,
+ SampleType leafType, boolean fullHeight) {
+ if (depth == 0) {
+ return buildInnerLayout(leafs, leafType, fullHeight);
+ }
+
+ AbstractOrderedLayout layout = createOrderedLayout(depth,
+ fullHeight);
+ Component content = leafType.createContent();
+ content.setSizeUndefined();
+ layout.addComponent(content);
+ layout.addComponent(buildLayout(depth - 1, leafs, leafType,
+ fullHeight));
+ layout.setExpandRatio(layout.getComponent(1), 1);
+ return layout;
+ }
+ },
+ FRACTAL {
+ @Override
+ public ComponentContainer buildLayout(int depth, int leafs,
+ SampleType leafType, boolean fullHeight) {
+ if (depth == 0) {
+ return buildInnerLayout(leafs, leafType, fullHeight);
+ }
+
+ AbstractOrderedLayout layout = createOrderedLayout(depth,
+ fullHeight);
+ layout.addComponent(buildLayout(depth - 1, leafs, leafType,
+ fullHeight));
+ layout.addComponent(buildLayout(depth - 1, leafs, leafType,
+ fullHeight));
+ layout.setExpandRatio(layout.getComponent(0), 1);
+ layout.setExpandRatio(layout.getComponent(1), 2);
+ return layout;
+ }
+ };
+ public abstract ComponentContainer buildLayout(int depth, int leafs,
+ SampleType leafType, boolean fullHeight);
+
+ protected AbstractOrderedLayout createOrderedLayout(int depth,
+ boolean fullHeight) {
+ AbstractOrderedLayout layout = (depth % 2) == 0 ? new VerticalLayout()
+ : new HorizontalLayout();
+ layout.setWidth("100%");
+ if (fullHeight) {
+ layout.setHeight("100%");
+ } else {
+ layout.setHeight(null);
+ }
+
+ return layout;
+ }
+
+ public ComponentContainer buildInnerLayout(int leafs,
+ SampleType leafType, boolean fullHeight) {
+ VerticalLayout layout = new VerticalLayout();
+ if (fullHeight) {
+ layout.setHeight("100%");
+ layout.setWidth("100%");
+ }
+ for (int i = 0; i < leafs; i++) {
+ Component leaf = leafType.createContent();
+ if (leaf.getWidth() <= 0) {
+ leaf.setWidth(widths[i % 3]);
+ }
+ layout.addComponent(leaf);
+ }
+ return layout;
+ }
+ }
+
+ private enum SampleType {
+ SHORT_LABEL {
+ @Override
+ public Component createContent() {
+ return new Label("Short label");
+ }
+ },
+ LONG_LABEL {
+ @Override
+ public Component createContent() {
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < 100; i++) {
+ builder.append("A rather long text. ");
+ }
+ return new Label(builder.toString());
+ }
+ },
+ BUTTON {
+ @Override
+ public Component createContent() {
+ return new Button("Text");
+ }
+ },
+ TEXT_FIELD {
+ @Override
+ public Component createContent() {
+ return new TextField("Field label");
+ }
+ },
+ HORIZONTAL_LAYOUT {
+ @Override
+ public Component createContent() {
+ HorizontalLayout layout = new HorizontalLayout();
+ layout.addComponent(new Label("Left"));
+ layout.addComponent(new Label("Right"));
+ layout.setComponentAlignment(layout.getComponent(1),
+ Alignment.BOTTOM_RIGHT);
+
+ return layout;
+ }
+ },
+ WRAPPED_PANEL {
+ @Override
+ public Component createContent() {
+ HorizontalLayout horizontal = new HorizontalLayout();
+ horizontal.setWidth("100%");
+ horizontal.setHeight(null);
+ horizontal.setMargin(true);
+
+ VerticalLayout left = new VerticalLayout();
+ left.setWidth("100%");
+ left.addComponent(new Label("Text 1"));
+ left.addComponent(new Label("Text 2"));
+ left.addComponent(new Label("Text 3"));
+ horizontal.addComponent(left);
+
+ VerticalLayout right = new VerticalLayout();
+ right.setWidth("100%");
+ right.addComponent(new Label("Text 1"));
+ right.addComponent(new Label("Text 2"));
+ right.addComponent(new Label("Text 3"));
+ horizontal.addComponent(right);
+
+ Panel panel = new Panel(horizontal);
+ panel.setCaption("Panel caption");
+ panel.setWidth("100%");
+ panel.setHeight(null);
+
+ return panel;
+ }
+ };
+ public abstract Component createContent();
+ }
+
+ private Component testLayout = new Label("");
+
+ private final CheckBox wrapInPanel = new CheckBox("Wrap in Panel");
+ private final NativeSelect containerSelector = new NativeSelect(
+ "Wrapping structure", EnumSet.allOf(ContainerType.class));
+ @SuppressWarnings("boxing")
+ private final NativeSelect levels = new NativeSelect("Wrapping depth",
+ Arrays.asList(0, 1, 2, 3, 4, 5, 10, 15, 20, 25));
+ private final NativeSelect leafSelector = new NativeSelect("Leaf type",
+ EnumSet.allOf(SampleType.class));
+ @SuppressWarnings("boxing")
+ private final NativeSelect childAmount = new NativeSelect("Leaf count",
+ Arrays.asList(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048,
+ 4096, 8192, 16384));
+
+ @Override
+ protected void setup() {
+ HorizontalLayout controls = new HorizontalLayout();
+ controls.setSpacing(true);
+
+ controls.addComponent(wrapInPanel);
+ controls.addComponent(containerSelector);
+ controls.addComponent(levels);
+ controls.addComponent(leafSelector);
+ controls.addComponent(childAmount);
+
+ controls.addComponent(new Button("Clear", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ setTestLayout(new Label(""));
+ }
+ }));
+
+ controls.addComponent(new Button("Apply", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ SampleType leafType = (SampleType) leafSelector.getValue();
+ if (leafType == null) {
+ return;
+ }
+
+ ContainerType containerType = (ContainerType) containerSelector
+ .getValue();
+ if (containerType == null) {
+ return;
+ }
+
+ boolean wrapped = wrapInPanel.booleanValue();
+ ComponentContainer container = containerType.buildLayout(
+ ((Number) levels.getValue()).intValue(),
+ ((Number) childAmount.getValue()).intValue(), leafType,
+ !wrapped);
+ if (wrapped) {
+ Panel panel = new Panel(container);
+ panel.setSizeFull();
+ container = panel;
+ }
+ setTestLayout(container);
+ }
+ }));
+
+ for (Iterator<Component> i = controls.getComponentIterator(); i
+ .hasNext();) {
+ Component component = i.next();
+ if (component instanceof NativeSelect) {
+ NativeSelect nativeSelect = (NativeSelect) component;
+ nativeSelect.setNullSelectionAllowed(false);
+ nativeSelect.setValue(new ArrayList<Object>(nativeSelect
+ .getItemIds()).get(0));
+ }
+ controls.setComponentAlignment(component, Alignment.BOTTOM_LEFT);
+ }
+
+ VerticalLayout layout = getLayout();
+ layout.addComponent(controls);
+ layout.addComponent(testLayout);
+ layout.setExpandRatio(testLayout, 1);
+ layout.setSizeFull();
+ }
+
+ public void setTestLayout(Component testLayout) {
+ getLayout().replaceComponent(this.testLayout, testLayout);
+ getLayout().setExpandRatio(testLayout, 1);
+ this.testLayout = testLayout;
+ }
+
+ @Override
+ protected String getDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.html b/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.html
new file mode 100644
index 0000000000..31b3985a1c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.html
@@ -0,0 +1,461 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>MovingComponentsWhileOldParentInvisible</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">MovingComponentsWhileOldParentInvisible</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.MovingComponentsWhileOldParentInvisible?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.AbsoluteLayout</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VAbsoluteLayout[0]/VAbsoluteLayout$AbsoluteWrapper[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VAbsoluteLayout[0]/VAbsoluteLayout$AbsoluteWrapper[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>10,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1</td>
+ <td>199,6</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.Accordion</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VAccordion[0]/VAccordion$StackItem[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VAccordion[0]/VAccordion$StackItem[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>12,1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item2</td>
+ <td>186,11</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.CssLayout</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VCssLayout[0]/VCssLayout$FlowPane[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VCssLayout[0]/VCssLayout$FlowPane[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>14,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item3</td>
+ <td>199,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.FormLayout</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>14,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item4</td>
+ <td>199,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.GridLayout</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>14,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item5</td>
+ <td>199,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.HorizontalLayout</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>14,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item6</td>
+ <td>199,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.HorizontalSplitPanel</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VSplitPanelHorizontal[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VSplitPanelHorizontal[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>14,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item7</td>
+ <td>199,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.Panel</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>14,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item9</td>
+ <td>199,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.TabSheet</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTabsheet[0]/VTabsheetPanel[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTabsheet[0]/VTabsheetPanel[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>14,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item10</td>
+ <td>199,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.VerticalLayout</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<!--Next component container-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[1]</td>
+ <td>14,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item11</td>
+ <td>199,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::PID_ScomponentContainerSelect/domChild[0]</td>
+ <td>class com.vaadin.ui.VerticalSplitPanel</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VSplitPanelVertical[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>Label outside the component container</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VSplitPanelVertical[0]/VLabel[0]</td>
+ <td>Label inside the component container</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java b/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java
new file mode 100644
index 0000000000..87ce80d4f7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java
@@ -0,0 +1,120 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.tests.VaadinClasses;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.CustomLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.LoginForm;
+import com.vaadin.ui.PopupView;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.Window;
+
+public class MovingComponentsWhileOldParentInvisible extends TestBase {
+
+ private ComponentContainer cc = new AbsoluteLayout(); // initial dummy
+ // contents
+ private Label lab;
+
+ @Override
+ protected void setup() {
+ lab = new Label("Label inside the component container");
+ lab.setWidth(null);
+
+ ComboBox componentContainerSelect = new ComboBox("Container") {
+ {
+ pageLength = 0;
+ }
+ };
+ componentContainerSelect.setId("componentContainerSelect");
+ componentContainerSelect.setWidth("300px");
+ componentContainerSelect.setImmediate(true);
+ componentContainerSelect.setNullSelectionAllowed(false);
+ // componentContainer.addContainerProperty(CAPTION, String.class, "");
+ // componentContainer.addContainerProperty(CLASS, Class.class, "");
+
+ for (Class<? extends ComponentContainer> cls : VaadinClasses
+ .getComponentContainers()) {
+ if (cls == LoginForm.class || cls == CustomLayout.class
+ || CustomComponent.class.isAssignableFrom(cls)
+ || cls == PopupView.class || cls == Window.class
+ || cls == UI.class) {
+ // Does not support addComponent
+ continue;
+ }
+ componentContainerSelect.addItem(cls);
+ }
+ componentContainerSelect.addListener(new ValueChangeListener() {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void valueChange(ValueChangeEvent event) {
+ ComponentContainer oldCC = cc;
+ cc = createComponentContainer((Class<? extends ComponentContainer>) event
+ .getProperty().getValue());
+ cc.addComponent(lab);
+
+ replaceComponent(oldCC, cc);
+ }
+ });
+
+ componentContainerSelect.setValue(componentContainerSelect.getItemIds()
+ .iterator().next());
+ Button but1 = new Button("Move in and out of component container",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ cc.setVisible(!cc.isVisible());
+ if (!cc.isVisible()) {
+ getLayout().addComponent(lab);
+ lab.setValue(((String) lab.getValue()).replace(
+ "inside", "outside"));
+ } else {
+ cc.addComponent(lab);
+ lab.setValue(((String) lab.getValue()).replace(
+ "outside", "inside"));
+ }
+ }
+ });
+
+ addComponent(componentContainerSelect);
+ addComponent(cc);
+ addComponent(but1);
+ }
+
+ protected ComponentContainer createComponentContainer(
+ Class<? extends ComponentContainer> value) {
+ try {
+ ComponentContainer cc = value.newInstance();
+ cc.setWidth("300px");
+ cc.setHeight("300px");
+ return cc;
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Client side layouts can easily have a bug where its internal data structures gets messed up when child components from it are moved forth and back when it is invisible (registered, but renders are ignored until becomes visible again). Things are especially easy to mess up when the layout uses wrapper widget over each component (like VOrderedLayout and VGridLayout does). This tests Vertical (Ordered), Grid and CssLayout.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5372;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/MovingInvisibleField.html b/uitest/src/com/vaadin/tests/layouts/MovingInvisibleField.html
new file mode 100644
index 0000000000..a3f3f84dac
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/MovingInvisibleField.html
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.MovingInvisibleField?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>one-field-above-button</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingInvisibleField::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>one-field-below-button</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingInvisibleField::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>one-field-above-button</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/MovingInvisibleField.java b/uitest/src/com/vaadin/tests/layouts/MovingInvisibleField.java
new file mode 100644
index 0000000000..1285e5b52e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/MovingInvisibleField.java
@@ -0,0 +1,57 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+@SuppressWarnings("serial")
+public class MovingInvisibleField extends TestBase {
+
+ @Override
+ protected void setup() {
+ final VerticalLayout layout1 = new VerticalLayout();
+ final VerticalLayout layout2 = new VerticalLayout();
+
+ final TextField tfHidden = new TextField("Hidden text field caption",
+ "A hidden text field");
+ final TextField tfVisible = new TextField("Visible text field caption",
+ "A visible text field");
+ tfHidden.setVisible(false);
+ Button b = new Button("Move hidden textfield to other layout");
+ b.addListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (layout1.getComponentIndex(tfHidden) != -1) {
+ layout2.addComponent(tfVisible);
+ layout2.addComponent(tfHidden);
+ } else {
+ layout1.addComponent(tfVisible);
+ layout1.addComponent(tfHidden);
+ }
+
+ }
+
+ });
+
+ layout1.addComponent(tfVisible);
+ layout1.addComponent(tfHidden);
+
+ addComponent(layout1);
+ addComponent(b);
+ addComponent(layout2);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Above and below the button is a VerticalLayout. Initially the first one contains two components: a visiable and an invisible TextField. Click the button to move the TextFields to the second layout, both should be moved but only the visible rendered.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5278;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/OrderedLayoutBasics.java b/uitest/src/com/vaadin/tests/layouts/OrderedLayoutBasics.java
new file mode 100644
index 0000000000..9e0380a1f6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/OrderedLayoutBasics.java
@@ -0,0 +1,1210 @@
+package com.vaadin.tests.layouts;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.UserError;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractOrderedLayout;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.ListSelect;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class OrderedLayoutBasics extends TestBase {
+
+ String valignName[] = new String[] { "top", "middle", "bottom" };
+
+ Set<AbstractOrderedLayout> layouts = new HashSet<AbstractOrderedLayout>();
+ private AbstractOrderedLayout layoutContainer;
+ private int suffix = 0;
+
+ @Override
+ protected String getDescription() {
+ return "Various layout tests for VerticalLayout and HorizontalLayout";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+ @Override
+ public void setup() {
+ getMainWindow().getContent().setHeight(null);
+
+ layoutContainer = new VerticalLayout();
+ createUI(layoutContainer);
+ addComponent(layoutContainer);
+ }
+
+ private void createUI(Layout layout) {
+ layout.addComponent(wrapLayout(layout_field_100pct_button_field(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_field_100pct_button_field(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_overfilled(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_overfilled(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_overfilled_dynamic_height(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_overfilled_dynamic_height(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_symmetric_fields(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_symmetric_fields(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_leftAndRight(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_leftAndRight(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_fixed_filled(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_fixed_filled(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_dynamic(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_dynamic(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_labels(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_labels(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_captions(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_captions(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_captions_fixed_size(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_captions_fixed_size(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_captions_fixed_size_and_relative_size(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_captions_fixed_size_and_relative_size(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_captions_fixed_size_and_fixed_size(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_captions_fixed_size_and_fixed_size(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_add_remove_components(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_add_remove_components(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_pctFilled(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_pctFilled(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_underFilled(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_underFilled(new VerticalLayout())));
+ layout.addComponent(wrapLayout(layout_basic_test(new HorizontalLayout())));
+ layout.addComponent(wrapLayout(layout_basic_test(new VerticalLayout())));
+ }
+
+ private Layout wrapLayout(Layout ol) {
+ Panel p = new Panel(ol);
+ p.setSizeUndefined();
+ p.setCaption(ol.getCaption());
+ ol.setCaption(null);
+
+ VerticalLayout l = new VerticalLayout();
+ l.setSizeUndefined();
+ l.addComponent(p);
+ // p.setWidth("600px");
+
+ if (ol instanceof AbstractOrderedLayout) {
+ layouts.add((AbstractOrderedLayout) ol);
+ }
+ return l;
+ }
+
+ /* LAYOUTS */
+
+ @SuppressWarnings({ "unused", "deprecation" })
+ private Layout layout1() {
+ HorizontalLayout ol = new HorizontalLayout();
+ ol.setHeight("200px");
+ ol.setWidth("");
+ ol.setCaption("Fixed height (200px) and dynamic width");
+
+ TextField tf = new TextField("100px high TextField, valign: bottom");
+ tf.setHeight("100px");
+ tf.setWidth("");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+
+ ListSelect s = new ListSelect("100% high select");
+ s.setMultiSelect(true);
+ s.setHeight("100%");
+ s.setWidth("");
+ ol.addComponent(s);
+
+ s = new ListSelect("200 px high select");
+ s.setMultiSelect(true);
+ s.setHeight("200px");
+ s.setWidth("");
+ ol.addComponent(s);
+
+ // tf = new TextField("100% high TextField, right/bottom");
+ // tf.setHeight("100%");
+ // tf.setWidth("");
+ // ol.addComponent(tf);
+ // ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_RIGHT,
+ // AlignmentHandler.ALIGNMENT_BOTTOM);
+
+ // tf = new TextField("100% high, 200px wide TextField");
+ // tf.setHeight("100%");
+ // tf.setWidth("200px");
+ // ol.addComponent(tf);
+
+ return ol;
+
+ }
+
+ @SuppressWarnings({ "unused", "deprecation" })
+ private Layout layout2() {
+ HorizontalLayout ol = new HorizontalLayout();
+ ol.setHeight("70px");
+ ol.setWidth("");
+ ol.setCaption("Fixed height (50px) and dynamic width");
+
+ TextField tf = new TextField(
+ "100px high TextField, valign: bottom, should be partly outside");
+ tf.setHeight("100px");
+ tf.setWidth("");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+
+ tf = new TextField(
+ "100% high, 50px wide TextField, valign: bottom, should fill full height");
+ tf.setHeight("100%");
+ tf.setWidth("50px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+
+ Label l = new Label(
+ "100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");
+ tf.setHeight("100%");
+ tf.setWidth("50px");
+ ol.addComponent(l);
+ ol.setComponentAlignment(l, Alignment.BOTTOM_LEFT);
+
+ ListSelect s = new ListSelect(
+ "100% high select, should fit into layout");
+ s.setMultiSelect(true);
+ s.setHeight("100%");
+ s.setWidth("");
+ for (int i = 0; i < 10; i++) {
+ s.addItem(new Object());
+ }
+
+ ol.addComponent(s);
+
+ s = new ListSelect("200 px high select, should be partly outside");
+ s.setMultiSelect(true);
+ s.setHeight("200px");
+ s.setWidth("");
+ ol.addComponent(s);
+
+ return ol;
+ }
+
+ @SuppressWarnings({ "unused", "deprecation" })
+ private Layout layout3() {
+ HorizontalLayout ol = new HorizontalLayout();
+ ol.setHeight("");
+ ol.setWidth("500px");
+ ol.setCaption("Fixed width (500px) and dynamic height");
+ TextField tf;
+
+ tf = new TextField("100px high TextField, valign: bottom");
+ tf.setHeight("100px");
+ tf.setWidth("100%");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+
+ tf = new TextField("100px high TextField, valign: top");
+ tf.setHeight("100px");
+ tf.setWidth("100%");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
+
+ tf = new TextField("100% high, 50px wide TextField, valign: bottom");
+ tf.setHeight("100%");
+ tf.setWidth("50px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+
+ Label l = new Label(
+ "100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");
+ tf.setHeight("100%");
+ tf.setWidth("50px");
+ ol.addComponent(l);
+ ol.setComponentAlignment(l, Alignment.BOTTOM_LEFT);
+
+ ListSelect s = new ListSelect(
+ "100% high select, should fit into layout");
+ s.setMultiSelect(true);
+ s.setHeight("100%");
+ s.setWidth("100%");
+ for (int i = 0; i < 10; i++) {
+ s.addItem(new Object());
+ }
+
+ ol.addComponent(s);
+
+ s = new ListSelect(
+ "200 px high select, should make the layout 200px high");
+ s.setMultiSelect(true);
+ s.setHeight("200px");
+ s.setWidth("100%");
+ ol.addComponent(s);
+
+ return ol;
+ }
+
+ @SuppressWarnings({ "unused", "deprecation" })
+ private Layout layout3New() {
+ HorizontalLayout ol = new HorizontalLayout();
+ ol.setHeight("300px");
+ // ol.setWidth("500px");
+ ol.setWidth("");
+ ol.setCaption("Dynamic width and fixed height(300px)");
+ TextField tf;
+
+ tf = new TextField("100px high TextField, valign: bottom");
+ tf.setHeight("100px");
+ tf.setWidth("100%");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+
+ tf = new TextField("100px high TextField, valign: top");
+ tf.setHeight("100px");
+ tf.setWidth("100%");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
+
+ tf = new TextField("100% high, 50px wide TextField, valign: bottom");
+ tf.setHeight("100%");
+ tf.setWidth("50px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+
+ Label l = new Label(
+ "100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");
+ tf.setHeight("100%");
+ tf.setWidth("50px");
+ ol.addComponent(l);
+ ol.setComponentAlignment(l, Alignment.BOTTOM_LEFT);
+
+ ListSelect s = new ListSelect(
+ "100% high select, should fit into layout");
+ s.setMultiSelect(true);
+ s.setHeight("100%");
+ s.setWidth("100%");
+ for (int i = 0; i < 10; i++) {
+ s.addItem(new Object());
+ }
+
+ ol.addComponent(s);
+
+ s = new ListSelect(
+ "200 px high select, should make the layout 200px high");
+ s.setMultiSelect(true);
+ s.setHeight("200px");
+ s.setWidth("100%");
+ ol.addComponent(s);
+
+ return ol;
+ }
+
+ @SuppressWarnings("unused")
+ private Layout layout4(AbstractOrderedLayout ol) {
+ // ol.setHeight("300px");
+ // ol.setWidth("500px");
+ ol.setMargin(true);
+ ol.setSpacing(true);
+ ol.setWidth("");
+ ol.setCaption("Dynamic width and dynamic height");
+ TextArea tf;
+
+ tf = new TextArea("100% high TextField");
+ tf.setCaption(null);
+ tf.setRequired(true);
+ tf.setValue("100% high Field");
+ tf.setHeight("100%");
+ tf.setWidth("100px");
+ tf.setRows(2);
+ ol.addComponent(tf);
+
+ tf = new TextArea("100% high TextField");
+ tf.setCaption("100% high TextField");
+ tf.setRequired(true);
+ tf.setValue("100% high Field");
+ tf.setHeight("100%");
+ tf.setWidth("100px");
+ tf.setRows(2);
+ ol.addComponent(tf);
+
+ for (int i = 1; i < 4; i++) {
+ int w = i * 100;
+ tf = new TextArea("Field " + i);
+ tf.setRows(2);
+ tf.setValue(w + "px high, " + w + "px wide TextField, valign: "
+ + valignName[i % 3]);
+ tf.setWidth(w + "px");
+ tf.setHeight(w + "px");
+ ol.addComponent(tf);
+ if (i % 3 == 0) {
+ ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
+ } else if (i % 3 == 1) {
+ ol.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
+ } else {
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
+ }
+
+ }
+
+ tf = new TextArea("100% high TextField");
+ tf.setValue("100% high 100px wide");
+ tf.setRows(2);
+ tf.setHeight("100%");
+ tf.setWidth("100px");
+ ol.addComponent(tf);
+ return ol;
+ }
+
+ private Layout layout_field_100pct_button_field(AbstractOrderedLayout ol) {
+ ol.setHeight("500px");
+ ol.setWidth("916px");
+ ol.setMargin(false);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("Fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight()
+ + "px) / layout_field_100pct_button_field");
+ TextArea tf;
+
+ tf = new TextArea("300px x 300px Field");
+ // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setValue("300x300 field");
+ tf.setRows(2);
+ // tf.setSizeFull();
+ tf.setHeight("300px");
+ tf.setWidth("300px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
+
+ Button b;
+ b = new Button("This is a 100%x50% valign middle button");
+ b.setSizeFull();
+ b.setHeight("50%");
+ ol.addComponent(b);
+ ol.setExpandRatio(b, 1.0f);
+ ol.setComponentAlignment(b, Alignment.MIDDLE_RIGHT);
+
+ tf = new TextArea("300px x 300px Field");
+ // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setValue("300x300 field");
+ tf.setRows(2);
+ // tf.setSizeFull();
+ tf.setHeight("300px");
+ tf.setWidth("300px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+ return ol;
+ }
+
+ private Layout layout_basic_test(AbstractOrderedLayout ol) {
+ ol.setHeight("700px");
+ ol.setWidth("900px");
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("Fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight()
+ + "px) / layout_basic_test");
+ TextArea tf;
+
+ tf = new TextArea("300px x 300px Field");
+ // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setValue("300x300 field");
+ tf.setRows(2);
+ // tf.setSizeFull();
+ tf.setHeight("300px");
+ tf.setWidth("300px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
+
+ // Button b;
+ // b = new Button("This is a 100%x50% valign middle button");
+ // b.setSizeFull();
+ // b.setHeight("50%");
+ // ol.addComponent(b, 1.0f);
+ // ol.setComponentAlignment(b, AlignmentHandler.ALIGNMENT_RIGHT,
+ // AlignmentHandler.ALIGNMENT_VERTICAL_CENTER);
+
+ tf = new TextArea("300px x 300px Field");
+ // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setValue("300x300 field");
+ tf.setRows(2);
+ // tf.setSizeFull();
+ tf.setHeight("300px");
+ tf.setWidth("300px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+ return ol;
+ }
+
+ private Layout layout_symmetric_fields(AbstractOrderedLayout ol) {
+ ol.setHeight("900px");
+ ol.setWidth("900px");
+ ol.setMargin(false);
+ ol.setSpacing(false);
+
+ // ol.setWidth("");
+ ol.setCaption("Fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight()
+ + "px) / layout_symmetric_fields");
+ TextArea tf;
+
+ tf = new TextArea("300px x 300px Field");
+ tf.setValue("300x300 field");
+ tf.setRows(2);
+ tf.setHeight("300px");
+ tf.setWidth("300px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
+
+ tf = new TextArea("300px x 300px Field");
+ tf.setValue("300x300 field");
+ tf.setRows(2);
+ tf.setHeight("300px");
+ tf.setWidth("300px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.MIDDLE_CENTER);
+
+ tf = new TextArea("300px x 300px Field");
+ tf.setValue("300x300 field");
+ tf.setRows(2);
+ tf.setHeight("300px");
+ tf.setWidth("300px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+
+ return ol;
+ }
+
+ private Layout layout_leftAndRight(AbstractOrderedLayout ol) {
+ ol.setHeight("700px");
+ ol.setWidth("700px");
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("Fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight()
+ + "px) / layout_leftAndRight");
+ TextArea tf;
+
+ // tf = new TextField("100%x100% Field");
+ // tf.setCaption(null);
+ // tf.setValue("100% x 100% TextField");
+ // tf.setSizeFull();
+ // tf.setRequired(true);
+ // // tf.setComponentError(new UserError("It's broken!"));
+ //
+ // // tf.setHeight("100%");
+ // // tf.setWidth("100px");
+ // tf.setRows(2);
+ // ol.addComponent(tf);
+ //
+ // for (int i = 1; i < 5; i++) {
+ // int w = i * 100;
+ // tf = new TextField("Caption field " + i);
+ // tf.setRows(2);
+ // tf.setValue(w + "px high, " + w + "px wide TextField, valign: "
+ // + valignName[i % 3]);
+ // tf.setWidth(w + "px");
+ // tf.setHeight(w + "px");
+ // ol.addComponent(tf);
+ // ol.setComponentAlignment(tf,
+ // AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, valign[i % 3]);
+ // }
+ //
+ // tf.setValue(tf.getValue().toString() + " (100% wide)");
+ // tf.setWidth("100%");
+
+ // tf = new TextField("100%x70px Field");
+ // tf.setCaption(null);
+ // tf.setRequired(true);
+ // // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ // tf.setComponentError(new UserError("abc"));
+ // tf.setValue("100% high 70px wide TextField");
+ // tf.setRows(2);
+ // // tf.setSizeFull();
+ // tf.setHeight("100%");
+ // tf.setWidth("70px");
+ // ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_RIGHT,
+ // AlignmentHandler.ALIGNMENT_TOP);
+ // ol.addComponent(tf);
+
+ tf = new TextArea("300px x 300px Field");
+ // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setValue("300x300 field");
+ tf.setRows(2);
+ // tf.setSizeFull();
+ tf.setHeight("300px");
+ tf.setWidth("300px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
+
+ tf = new TextArea("300px x 300px Field");
+ // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setValue("300x300 field");
+ tf.setRows(2);
+ // tf.setSizeFull();
+ tf.setHeight("300px");
+ tf.setWidth("300px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+ return ol;
+ }
+
+ private Layout layout_fixed_filled(AbstractOrderedLayout ol) {
+ ol.setHeight("700px");
+ ol.setWidth("700px");
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("Filled with fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight() + "px)");
+ TextArea tf;
+
+ tf = new TextArea("60%x100% Field");
+ tf.setCaption("This one has a caption");
+ tf.setValue("60% x 100% TextField");
+ tf.setWidth("100%");
+ tf.setHeight("100%");
+ tf.setRequired(true);
+ // tf.setComponentError(new UserError("It's broken!"));
+
+ // tf.setHeight("100%");
+ // tf.setWidth("100px");
+ tf.setRows(2);
+ ol.addComponent(tf);
+ ol.setExpandRatio(tf, 1f);
+ //
+
+ tf = new TextArea("60%x60% Field");
+ tf.setCaption(null);
+ tf.setValue("60% x 60% TextField");
+ tf.setWidth("100%");
+ tf.setHeight("60%");
+ tf.setRequired(true);
+ ol.addComponent(tf);
+ ol.setExpandRatio(tf, 1f);
+ ol.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
+ // tf.setComponentError(new UserError("It's broken!"));
+
+ // tf.setHeight("100%");
+ // tf.setWidth("100px");
+ tf.setRows(2);
+ //
+ // for (int i = 1; i < 5; i++) {
+ // int w = i * 100;
+ // tf = new TextField("Caption field " + i);
+ // tf.setRows(2);
+ // tf.setValue(w + "px high, " + w + "px wide TextField, valign: "
+ // + valignName[i % 3]);
+ // tf.setWidth(w + "px");
+ // tf.setHeight(w + "px");
+ // ol.addComponent(tf);
+ // ol.setComponentAlignment(tf,
+ // AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, valign[i % 3]);
+ // }
+ //
+ // tf.setValue(tf.getValue().toString() + " (100% wide)");
+ // tf.setWidth("100%");
+
+ // tf = new TextField("100%x70px Field");
+ // tf.setCaption(null);
+ // tf.setRequired(true);
+ // // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ // tf.setComponentError(new UserError("abc"));
+ // tf.setValue("100% high 70px wide TextField");
+ // tf.setRows(2);
+ // // tf.setSizeFull();
+ // tf.setHeight("100%");
+ // tf.setWidth("70px");
+ // ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_RIGHT,
+ // AlignmentHandler.ALIGNMENT_TOP);
+ // ol.addComponent(tf);
+
+ tf = new TextArea("200px x 200px Field");
+ // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setValue("200x200 field");
+ tf.setRows(2);
+ // tf.setSizeFull();
+ tf.setHeight("200px");
+ tf.setWidth("200px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
+
+ tf = new TextArea("200px x 200px Field");
+ // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setValue("200x200 field");
+ tf.setRows(2);
+ // tf.setSizeFull();
+ tf.setHeight("200px");
+ tf.setWidth("200px");
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+ return ol;
+ }
+
+ private Layout layout_overfilled(AbstractOrderedLayout ol) {
+ ol.setHeight("300px");
+ ol.setWidth("700px");
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("OverFilled with fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight() + "px)");
+ TextArea tf;
+
+ for (int i = 0; i < 5; i++) {
+ tf = new TextArea("200x200px Field");
+ tf.setCaption("This one has a caption");
+ tf.setValue("200x200 TextField");
+ tf.setWidth("200px");
+ tf.setHeight("200px");
+ tf.setRequired(true);
+ // tf.setComponentError(new UserError("It's broken!"));
+
+ // tf.setHeight("100%");
+ // tf.setWidth("100px");
+ tf.setRows(2);
+ ol.addComponent(tf);
+ }
+
+ return ol;
+ }
+
+ private Layout layout_overfilled_dynamic_height(AbstractOrderedLayout ol) {
+ ol.setHeight(null);
+ ol.setWidth("700px");
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("OverFilled with fixed width (" + ol.getWidth()
+ + "px) and dynamic height");
+ TextArea tf;
+
+ for (int i = 0; i < 10; i++) {
+ tf = new TextArea("200x200px Field");
+ tf.setCaption("This one has a caption");
+ tf.setWidth("200px");
+ tf.setHeight(((i + 1) * 50) + "px");
+ tf.setValue(tf.getWidth() + "x" + tf.getHeight() + " TextField");
+ tf.setRequired(true);
+ // tf.setComponentError(new UserError("It's broken!"));
+
+ // tf.setHeight("100%");
+ // tf.setWidth("100px");
+ tf.setRows(2);
+ ol.addComponent(tf);
+ }
+
+ return ol;
+ }
+
+ // private Layout layout_add_components(AbstractOrderedLayout ol) {
+ // ol.setHeight("600px");
+ // ol.setWidth("600px");
+ // ol.setMargin(true);
+ // ol.setSpacing(true);
+ //
+ // // ol.setWidth("");
+ // ol.setCaption("Fixed width (" + ol.getWidth()
+ // + "px) and fixed height (" + ol.getHeight() + "px)");
+ //
+ // for (int i = 0; i < 3; i++) {
+ // Button b = createAddButton(ol);
+ // ol.addComponent(b);
+ // }
+ //
+ // return ol;
+ //
+ // }
+
+ private Layout layout_add_remove_components(AbstractOrderedLayout ol) {
+ ol.setHeight("600px");
+ ol.setWidth("600px");
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("Fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight()
+ + "px) / layout_add_remove_components");
+
+ for (int i = 0; i < 2; i++) {
+ AbstractOrderedLayout inner = createAddRemove(ol, "", "");
+ ol.addComponent(inner);
+ ol.setComponentAlignment(inner, Alignment.BOTTOM_RIGHT);
+ }
+
+ return ol;
+
+ }
+
+ private Layout layout_dynamic(AbstractOrderedLayout ol) {
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("Dynamic width, dynamic height");
+
+ for (int i = 0; i < 3; i++) {
+ Button b = new Button("Button " + i);
+ if (i == 2) {
+ b.setHeight("200px");
+ } else {
+ b.setHeight("100%");
+ }
+ ol.addComponent(b);
+ }
+
+ return ol;
+
+ }
+
+ private Layout layout_captions(AbstractOrderedLayout ol) {
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("Caption test with dynamic width");
+
+ TextField tf;
+ tf = new TextField("Short caption");
+ ol.addComponent(tf);
+
+ tf = new TextField(
+ "A very long caption which is probably much longer than the field");
+ ol.addComponent(tf);
+
+ tf = new TextField(
+ "A very long caption which is probably much longer than the field and includes indicators");
+ tf.setRequired(true);
+ tf.setComponentError(new UserError("abc123"));
+ ol.addComponent(tf);
+
+ // for (int i = 0; i < 3; i++) {
+ // Button b = new Button("Button " + i);
+ // if (i == 2) {
+ // b.setHeight("200px");
+ // } else {
+ // b.setHeight("100%");
+ // }
+ // ol.addComponent(b);
+ // }
+
+ return ol;
+
+ }
+
+ private Layout layout_captions_fixed_size(AbstractOrderedLayout ol) {
+ ol.setWidth("700px");
+ ol.setHeight("250px");
+
+ ol.setMargin(false);
+ ol.setSpacing(false);
+
+ // ol.setWidth("");
+ ol.setCaption("Caption test with fixed size");
+
+ TextField tf;
+ tf = new TextField("Short caption");
+ tf.setValue("Undefined width");
+ tf.setComponentError(new UserError("123"));
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+
+ tf = new TextField(
+ "A long caption which is probably much longer than the field");
+ tf.setValue("Undefined width");
+ tf.setRequired(true);
+ tf.setComponentError(new UserError("123"));
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+
+ tf = new TextField(
+ "A very long caption which is probably much longer than the field and includes indicators");
+ tf.setValue("Undefined width");
+ tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setRequired(true);
+ tf.setComponentError(new UserError("abc123"));
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+
+ // for (int i = 0; i < 3; i++) {
+ // Button b = new Button("Button " + i);
+ // if (i == 2) {
+ // b.setHeight("200px");
+ // } else {
+ // b.setHeight("100%");
+ // }
+ // ol.addComponent(b);
+ // }
+
+ return ol;
+
+ }
+
+ private Layout layout_captions_fixed_size_and_relative_size(
+ AbstractOrderedLayout ol) {
+ ol.setWidth("700px");
+ ol.setHeight("250px");
+
+ ol.setMargin(false);
+ ol.setSpacing(false);
+
+ // ol.setWidth("");
+ ol.setCaption("Caption test with fixed width (700x250)");
+
+ TextField tf;
+ tf = new TextField("Short caption");
+ tf.setSizeFull();
+ tf.setValue("100% wide field, ratio 1");
+
+ tf.setComponentError(new UserError("123"));
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+ ol.setExpandRatio(tf, 1);
+
+ tf = new TextField(
+ "A long caption which is probably much longer than the field");
+ tf.setValue("100% wide field, ratio 2");
+ tf.setSizeFull();
+ tf.setRequired(true);
+ tf.setComponentError(new UserError("123"));
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+ ol.setExpandRatio(tf, 2);
+
+ tf = new TextField(
+ "A very long caption which is probably much longer than the field and includes indicators");
+ tf.setValue("100% wide field, ratio 3");
+ tf.setSizeFull();
+ tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setRequired(true);
+ tf.setComponentError(new UserError("abc123"));
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+ ol.setExpandRatio(tf, 3);
+
+ // for (int i = 0; i < 3; i++) {
+ // Button b = new Button("Button " + i);
+ // if (i == 2) {
+ // b.setHeight("200px");
+ // } else {
+ // b.setHeight("100%");
+ // }
+ // ol.addComponent(b);
+ // }
+
+ return ol;
+
+ }
+
+ private Layout layout_captions_fixed_size_and_fixed_size(
+ AbstractOrderedLayout ol) {
+ ol.setWidth("700px");
+ ol.setHeight("250px");
+
+ ol.setMargin(false);
+ ol.setSpacing(false);
+
+ // ol.setWidth("");
+ ol.setCaption("Caption test with fixed width");
+
+ TextField tf;
+ tf = new TextField("Short caption");
+ tf.setValue("250px wide field");
+ tf.setWidth("250px");
+ tf.setComponentError(new UserError("123"));
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+
+ tf = new TextField(
+ "A long caption which is probably much longer than the field");
+ tf.setWidth("250px");
+ tf.setValue("250px wide field");
+ tf.setRequired(true);
+ tf.setComponentError(new UserError("123"));
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+
+ tf = new TextField(
+ "A very long caption which is probably much longer than the field and includes indicators");
+ tf.setValue("200px wide field");
+ tf.setWidth("200px");
+ tf.setIcon(new ThemeResource("icons/16/document-add.png"));
+ tf.setRequired(true);
+ tf.setComponentError(new UserError("abc123"));
+ ol.addComponent(tf);
+ ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
+
+ // for (int i = 0; i < 3; i++) {
+ // Button b = new Button("Button " + i);
+ // if (i == 2) {
+ // b.setHeight("200px");
+ // } else {
+ // b.setHeight("100%");
+ // }
+ // ol.addComponent(b);
+ // }
+
+ return ol;
+
+ }
+
+ private Layout layout_labels(AbstractOrderedLayout ol) {
+ // ol.setWidth("700px");
+ // ol.setHeight("200px");
+
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("Caption test with fixed width");
+
+ Label l;
+ l = new Label(
+ "This is a long text and should remain on one line as there is nothing forcing line breaks");
+ ol.addComponent(l);
+ // ol.setComponentAlignment(l, AlignmentHandler.ALIGNMENT_RIGHT,
+ // AlignmentHandler.ALIGNMENT_BOTTOM);
+
+ l = new Label("WTF OMG LOL");
+ ol.addComponent(l);
+ // ol.setComponentAlignment(l, AlignmentHandler.ALIGNMENT_RIGHT,
+ // AlignmentHandler.ALIGNMENT_BOTTOM);
+
+ return ol;
+
+ }
+
+ private AbstractOrderedLayout createAddRemove(AbstractOrderedLayout ol,
+ String width, String buttonSuffix) {
+ Button b = createAddButton(ol);
+ Button wb = createWideAddButton(ol);
+ Button r = createRemoveButton(ol, buttonSuffix);
+ VerticalLayout inner = new VerticalLayout();
+ inner.setCaption("Width: " + width);
+ inner.setWidth(width);
+
+ inner.addComponent(b);
+ inner.addComponent(wb);
+ inner.addComponent(r);
+
+ // inner.setHeight("132px");
+ return inner;
+ }
+
+ private Button createAddButton(AbstractOrderedLayout ol) {
+ Button b = new Button("Add before", new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ addBefore((AbstractOrderedLayout) event.getButton().getData(),
+ event.getButton().getParent(), "");
+ }
+
+ });
+ b.setData(ol);
+
+ return b;
+ }
+
+ private Button createWideAddButton(AbstractOrderedLayout ol) {
+ Button b = new Button("Add 100% before", new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ addBefore((AbstractOrderedLayout) event.getButton().getData(),
+ event.getButton().getParent(), "100%");
+ }
+
+ });
+ b.setData(ol);
+
+ return b;
+ }
+
+ private Button createRemoveButton(AbstractOrderedLayout ol, String suffix) {
+ Button b = new Button("Remove this " + suffix, new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ remove((AbstractOrderedLayout) event.getButton().getData(),
+ event.getButton().getParent());
+ }
+
+ });
+ b.setWidth("100%");
+ b.setData(ol);
+
+ return b;
+ }
+
+ protected void remove(AbstractOrderedLayout ol, Component c) {
+ ol.removeComponent(c);
+
+ }
+
+ protected void addBefore(AbstractOrderedLayout ol, Component c, String width) {
+ int index = 0;
+ Iterator<Component> iter = ol.getComponentIterator();
+ while (iter.hasNext()) {
+ if (iter.next() == c) {
+ break;
+ }
+ index++;
+ }
+ AbstractOrderedLayout inner = createAddRemove(ol, width,
+ String.valueOf(suffix++));
+ ol.addComponent(inner, index);
+ if (width.contains("%")) {
+ ol.setExpandRatio(inner, 1.0f);
+ }
+
+ ol.setComponentAlignment(inner, Alignment.BOTTOM_RIGHT);
+
+ }
+
+ private Layout layout_pctFilled(AbstractOrderedLayout ol) {
+ ol.setHeight("600px");
+ ol.setWidth("600px");
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("100 % filled with fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight() + "px)");
+ TextArea ta;
+
+ ta = new TextArea();
+ ta.setCaption("This one has a caption");
+ ta.setValue("60% expand TextField");
+ ta.setWidth("100%");
+ ta.setHeight("100%");
+ // ta.setRequired(true);
+ // ta.setComponentError(new UserError("It's broken!"));
+
+ // ta.setHeight("100%");
+ // ta.setWidth("100px");
+ ta.setRows(2);
+ ol.addComponent(ta);
+ ol.setExpandRatio(ta, 60);
+
+ ta = new TextArea();
+ ta.setValue("100px 100px TextField");
+ ta.setWidth("100px");
+ ta.setHeight("100px");
+ ta.setRows(2);
+ ol.addComponent(ta);
+ ol.setComponentAlignment(ta, Alignment.MIDDLE_CENTER);
+
+ //
+
+ ta = new TextArea("40%x40% Field");
+ // ta.setCaption(null);
+ ta.setValue("40% expand (40% height) TextField");
+ ta.setWidth("100%");
+ ta.setHeight("40%");
+ ol.addComponent(ta);
+ ol.setExpandRatio(ta, 40);
+ // ta.setRequired(true);
+ ol.setComponentAlignment(ta, Alignment.BOTTOM_RIGHT);
+
+ ta.setRows(2);
+
+ return ol;
+ }
+
+ @SuppressWarnings("unused")
+ private Layout layout_pctFilled2(AbstractOrderedLayout ol) {
+ ol.setHeight("600px");
+ ol.setWidth("600px");
+ ol.setMargin(true);
+ ol.setSpacing(false);
+
+ // ol.setWidth("");
+ ol.setCaption("100 % filled with fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight() + "px)");
+ TextArea ta;
+
+ ta = new TextArea();
+ // ta.setCaption("This one has a caption");
+ ta.setValue("80% x 20% TextField");
+ ta.setWidth("80%");
+ ta.setHeight("20%");
+ // ta.setRequired(true);
+ // ta.setComponentError(new UserError("It's broken!"));
+
+ // ta.setHeight("100%");
+ // ta.setWidth("100px");
+ ta.setRows(2);
+ ol.addComponent(ta);
+ //
+
+ ta = new TextArea("20%x60% Field");
+ ta.setCaption(null);
+ ta.setValue("20% x 60% TextField");
+ ta.setWidth("20%");
+ ta.setHeight("60%");
+ // ta.setRequired(true);
+ ol.setComponentAlignment(ta, Alignment.BOTTOM_RIGHT);
+
+ ta.setRows(2);
+ ol.addComponent(ta);
+
+ return ol;
+ }
+
+ private Layout layout_underFilled(AbstractOrderedLayout ol) {
+ ol.setHeight("700px");
+ ol.setWidth("700px");
+ ol.setMargin(true);
+ ol.setSpacing(true);
+
+ // ol.setWidth("");
+ ol.setCaption("Underfilled with fixed width (" + ol.getWidth()
+ + "px) and fixed height (" + ol.getHeight() + "px)");
+ TextArea ta;
+
+ ta = new TextArea("60%x100% Field");
+ ta.setCaption("Short capt");
+ ta.setValue("60% x 100% TextField");
+ ta.setWidth("60%");
+ ta.setHeight("100%");
+ ta.setRequired(true);
+ ta.setRows(2);
+
+ ol.addComponent(ta);
+ ol.setComponentAlignment(ta, Alignment.MIDDLE_CENTER);
+
+ ta = new TextArea("200px x 200px Field");
+ // ta.setIcon(new ThemeResource("icons/16/document-add.png"));
+ ta.setValue("200x200 field");
+ ta.setRows(2);
+ // ta.setSizeFull();
+ ta.setHeight("200px");
+ ta.setWidth("200px");
+ ol.addComponent(ta);
+ ol.setComponentAlignment(ta, Alignment.TOP_LEFT);
+
+ ta = new TextArea("200px x 200px Field");
+ // ta.setIcon(new ThemeResource("icons/16/document-add.png"));
+ ta.setValue("200x200 field");
+ ta.setRows(2);
+ // ta.setSizeFull();
+ ta.setHeight("200px");
+ ta.setWidth("200px");
+ ol.addComponent(ta);
+ ol.setComponentAlignment(ta, Alignment.BOTTOM_RIGHT);
+ return ol;
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/layouts/OrderedLayoutCSSCompatibility.java b/uitest/src/com/vaadin/tests/layouts/OrderedLayoutCSSCompatibility.java
new file mode 100644
index 0000000000..41f1de2c4a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/OrderedLayoutCSSCompatibility.java
@@ -0,0 +1,31 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.TextField;
+
+public class OrderedLayoutCSSCompatibility extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "This test is to make sure that spacing/margins in OrderedLayout is still backwards compatible";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2463;
+ }
+
+ @Override
+ protected void setup() {
+ HorizontalLayout l = new HorizontalLayout();
+ l.setMargin(true);
+ l.setSpacing(true);
+ l.addComponent(new TextField("abc"));
+ l.addComponent(new TextField("def"));
+
+ addComponent(l);
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java b/uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java
new file mode 100644
index 0000000000..177471e3c8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java
@@ -0,0 +1,320 @@
+package com.vaadin.tests.layouts;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.BeanItem;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.AbsoluteLayout.ComponentPosition;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.DefaultFieldFactory;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.Form;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.Window;
+
+public class TestAbsoluteLayout extends TestBase {
+
+ private static class MFieldFactory extends DefaultFieldFactory {
+
+ @Override
+ public Field<?> createField(Item item, Object propertyId,
+ Component uiContext) {
+ if (propertyId.equals("CSSString")) {
+ TextArea f = new TextArea();
+ f.setRows(5);
+ f.setHeight("8em");
+ f.setCaption("CSS string");
+ return f;
+ } else if (((String) propertyId).contains("Units")) {
+ NativeSelect s = new NativeSelect() {
+ };
+ s.addContainerProperty("caption", String.class, "");
+ s.setItemCaptionPropertyId("caption");
+ s.setNullSelectionAllowed(false);
+ for (int i = 0; i < Layout.Unit.values().length; i++) {
+ Item unitItem = s.addItem(i);
+ unitItem.getItemProperty("caption").setValue(
+ Layout.Unit.values()[i]);
+ }
+ return s;
+ }
+
+ return super.createField(item, propertyId, uiContext);
+ }
+
+ private static MFieldFactory instance;
+
+ public static DefaultFieldFactory get() {
+ if (instance == null) {
+ instance = new MFieldFactory();
+ }
+ return instance;
+ }
+ };
+
+ @Override
+ protected String getDescription() {
+ return "This is absolute layout tester.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+ @Override
+ protected void setup() {
+ AbsoluteLayout layout = new AbsoluteLayout();
+ setTheme("tests-tickets");
+ layout.setStyleName("cyan");
+ layout.setWidth("1000px");
+ layout.setHeight("500px");
+
+ layout.addComponent(new Label("Hello World"));
+
+ Button button = new Button("Centered button,z-index:10;");
+ button.setSizeFull();
+ layout.addComponent(button,
+ "top:40%;bottom:40%;right:20%;left:20%;z-index:10;");
+
+ Label label = new Label(
+ "Exotic positioned label. Fullsize, top:100px; left:2cm; right: 3.5in; bottom:12.12mm ");
+ label.setStyleName("yellow");
+ label.setSizeFull();
+ layout.addComponent(label,
+ "top:100px; left:2cm; right: 3.5in; bottom:12.12mm");
+
+ label = new Label("fullize, bottom:80%;left:80%;");
+ label.setStyleName("green");
+ label.setSizeFull();
+ layout.addComponent(label, "bottom:80%;left:80%;");
+
+ label = new Label("bottomright");
+ label.setSizeUndefined();
+ label.setStyleName("green");
+ layout.addComponent(label, "bottom:0px; right:0px;");
+
+ getLayout().setSizeFull();
+ getLayout().addComponent(layout);
+
+ getMainWindow().addWindow(new EditorWindow(layout));
+
+ }
+
+ public class EditorWindow extends Window {
+ private final AbsoluteLayout l;
+ private Form componentEditor;
+ private Form positionEditor;
+
+ public EditorWindow(AbsoluteLayout lo) {
+ super("AbsoluteLayout editor aka köyhän miehen wysiwyg");
+ l = lo;
+
+ setHeight("600px");
+
+ Button componentChooser = new Button("choose component to edit");
+ componentChooser.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ final Window chooser = new Window("Choose component");
+ chooser.getContent().setSizeUndefined();
+ chooser.setModal(true);
+
+ NativeSelect select = new NativeSelect(
+ "Choose component to edit");
+
+ select.setNullSelectionAllowed(false);
+
+ IndexedContainer container = new IndexedContainer();
+ container.addContainerProperty("caption", String.class, "");
+ Iterator<Component> componentIterator = l
+ .getComponentIterator();
+ while (componentIterator.hasNext()) {
+ AbstractComponent next = (AbstractComponent) componentIterator
+ .next();
+ Item item = container.addItem(next);
+
+ String caption = next.getClass().getSimpleName();
+
+ caption += "; cap: " + next.getCaption() + "; debugid"
+ + getId();
+
+ if (next instanceof Property) {
+ caption += " value:"
+ + ((Property<?>) next).getValue();
+ }
+
+ item.getItemProperty("caption").setValue(caption);
+ }
+ select.setContainerDataSource(container);
+ select.setItemCaptionPropertyId("caption");
+ select.setImmediate(true);
+
+ select.addListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ editcomponent((Component) event.getProperty()
+ .getValue());
+ getMainWindow().removeWindow(chooser);
+ }
+
+ });
+
+ chooser.addComponent(select);
+
+ getMainWindow().addWindow(chooser);
+
+ }
+ });
+
+ addComponent(componentChooser);
+
+ Button addComp = new Button("add component");
+ addComp.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ final Window chooser = new Window(
+ "Choose component type to add");
+ chooser.getContent().setSizeUndefined();
+ chooser.setModal(true);
+
+ NativeSelect select = new NativeSelect(
+ "Choose component to edit");
+
+ select.setNullSelectionAllowed(false);
+
+ IndexedContainer container = new IndexedContainer();
+
+ URL resource = AbstractComponent.class.getResource(".");
+ File directory = new File(resource.getFile());
+ if (directory.exists()) {
+ // Get the list of the files contained in the
+ // package
+ final String[] files = directory.list();
+ for (int j = 0; j < files.length; j++) {
+ // we are only interested in .class files
+ if (files[j].endsWith(".class")) {
+ // removes the .class extension
+ String p = resource.toString()
+ + files[j].substring(0,
+ files[j].length() - 6);
+ p = p.replaceAll(".*classes/", "");
+ p = p.replaceAll("/", ".");
+ Class<?> c;
+ try {
+ c = Class.forName(p);
+ if (AbstractComponent.class
+ .isAssignableFrom(c)
+ && !p.toLowerCase().contains(
+ "layout")
+ && !p.toLowerCase().contains(
+ "abstract")) {
+ container.addItem(c);
+ }
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ select.setContainerDataSource(container);
+ select.setImmediate(true);
+
+ select.addListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ Class<?> c = (Class<?>) event.getProperty()
+ .getValue();
+
+ try {
+ Component newInstance = (Component) c
+ .newInstance();
+ l.addComponent(newInstance);
+ editcomponent(newInstance);
+ getMainWindow().removeWindow(chooser);
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ });
+
+ chooser.addComponent(select);
+
+ getMainWindow().addWindow(chooser);
+
+ }
+ });
+
+ addComponent(addComp);
+
+ componentEditor = new Form();
+ componentEditor.setBuffered(true);
+ componentEditor.setCaption("Component properties:");
+ componentEditor.setFormFieldFactory(MFieldFactory.get());
+ addComponent(componentEditor);
+
+ positionEditor = new Form();
+ positionEditor.setCaption("Component position");
+ positionEditor.setBuffered(true);
+ positionEditor.setFormFieldFactory(MFieldFactory.get());
+ addComponent(positionEditor);
+
+ Button b = new Button("Commit changes", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ positionEditor.commit();
+ componentEditor.commit();
+ }
+ });
+ addComponent(b);
+
+ }
+
+ private void editcomponent(Component value) {
+
+ BeanItem<Component> beanItem = new BeanItem<Component>(value);
+ String c = "Component properties for "
+ + value.getClass().getSimpleName();
+ ArrayList<String> fields = new ArrayList<String>(
+ Arrays.asList(new String[] { "width", "widthUnits",
+ "height", "heightUnits", "caption", "styleName" }));
+ if (value instanceof Label) {
+ c += "(" + ((Label) value).getValue() + ")";
+ fields.add("value");
+ }
+
+ componentEditor.setItemDataSource(beanItem, fields);
+
+ BeanItem<ComponentPosition> positionItem = new BeanItem<ComponentPosition>(
+ l.getPosition(value));
+ componentEditor.setCaption(c);
+
+ positionEditor.setItemDataSource(positionItem);
+
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.html b/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.html
new file mode 100644
index 0000000000..2cc695e4fa
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.html
@@ -0,0 +1,314 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>TestLayoutClickListeners</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TestLayoutClickListeners</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.TestLayoutClickListeners</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>initial</td>
+</tr>
+<!--GridLayout-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>43,11</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>exact:GridLayout: left click on This is label 1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>82,14</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>exact:GridLayout: left click on This is tf5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VGridLayout[0]/domChild[0]/domChild[0]</td>
+ <td>491,79</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>exact:GridLayout: left click on &lt;none&gt;</td>
+</tr>
+<!--VerticalLayout-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
+ <td>74,13</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>exact:VerticalLayout: left click on This is tf6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VLabel[0]</td>
+ <td>53,13</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>exact:VerticalLayout: left click on This is label 3</td>
+</tr>
+<!--AbsoluteLayout-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VAbsoluteLayout[0]/VAbsoluteLayout$AbsoluteWrapper[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>exact:Button A button with its own click listener was clicked</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VAbsoluteLayout[0]/VAbsoluteLayout$AbsoluteWrapper[0]/VTextField[0]</td>
+ <td>101,14</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>exact:AbsoluteLayout: left click on This is its caption</td>
+</tr>
+<!--CssLayout-->
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[3]/VCssLayout[0]/VCssLayout$FlowPane[0]/VTextField[0]</td>
+ <td>108,13</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[3]/VCssLayout[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>76,12</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+ <td>exact:CSSLayout: left click on This is its caption</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>exact:CSSLayout: left click on This is its caption</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[3]/VCssLayout[0]/VCssLayout$FlowPane[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>exact:Button A button with its own click listener was clicked</td>
+</tr>
+<!--Drag in GridLayout-->
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>40,8</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>40,8</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::PID_SLog_row_0</td>
+ <td>exact:GridLayout: left click on This is label 1</td>
+</tr>
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>24,7</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>46,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::PID_SLog_row_0</td>
+ <td>exact:GridLayout: left click on This is label 1</td>
+</tr>
+<!--Drag in VerticalLayout-->
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>25,9</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>25,9</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::PID_SLog_row_0</td>
+ <td>exact:VerticalLayout: left click on This is tf5</td>
+</tr>
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[8]/domChild[0]/domChild[0]</td>
+ <td>28,11</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VTextField[0]</td>
+ <td>39,7</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::PID_SLog_row_0</td>
+ <td>exact:VerticalLayout: left click on This is tf5</td>
+</tr>
+<!--Drag in AbsoluteLayout-->
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VAbsoluteLayout[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+ <td>21,9</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VAbsoluteLayout[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+ <td>21,9</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::PID_SLog_row_0</td>
+ <td>exact:AbsoluteLayout: left click on This is its caption</td>
+</tr>
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VAbsoluteLayout[0]/VAbsoluteLayout$AbsoluteWrapper[0]/VTextField[0]</td>
+ <td>54,7</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VAbsoluteLayout[0]/VAbsoluteLayout$AbsoluteWrapper[1]/VTextField[0]</td>
+ <td>52,10</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::PID_SLog_row_0</td>
+ <td>exact:AbsoluteLayout: left click on This is its caption</td>
+</tr>
+<!--Drag in CSSLayout-->
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[3]/VCssLayout[0]/VCssLayout$FlowPane[0]/VTextField[0]</td>
+ <td>51,7</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[3]/VCssLayout[0]/VCssLayout$FlowPane[0]/VTextField[0]</td>
+ <td>51,7</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::PID_SLog_row_0</td>
+ <td>exact:CSSLayout: left click on This is its caption</td>
+</tr>
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[3]/VCssLayout[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>31,7</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[3]/VCssLayout[0]/VCssLayout$FlowPane[0]/VTextField[1]</td>
+ <td>33,7</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::PID_SLog_row_0</td>
+ <td>exact:CSSLayout: left click on This is its caption</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java b/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java
new file mode 100644
index 0000000000..44f40a7d78
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java
@@ -0,0 +1,215 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.event.LayoutEvents.LayoutClickEvent;
+import com.vaadin.event.LayoutEvents.LayoutClickListener;
+import com.vaadin.event.MouseEvents.ClickEvent;
+import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class TestLayoutClickListeners extends AbstractTestCase {
+
+ private Log log = new Log(5).setNumberLogRows(false);
+
+ @Override
+ public void init() {
+ LegacyWindow w = new LegacyWindow("main window");
+ setMainWindow(w);
+ setTheme("tests-tickets");
+
+ HorizontalLayout layoutsLayout = new HorizontalLayout();
+ layoutsLayout.setSpacing(true);
+ w.setContent(layoutsLayout);
+
+ layoutsLayout.addComponent(createClickableGridLayout());
+ layoutsLayout.addComponent(createClickableVerticalLayout());
+ layoutsLayout.addComponent(createClickableAbsoluteLayout());
+ layoutsLayout.addComponent(createClickableCSSLayout());
+
+ VerticalLayout mainLayout = new VerticalLayout();
+ mainLayout.setMargin(true);
+ mainLayout.setSpacing(true);
+ w.setContent(mainLayout);
+ mainLayout.addComponent(log);
+ mainLayout.addComponent(layoutsLayout);
+ }
+
+ private Component createClickableAbsoluteLayout() {
+ final AbsoluteLayout al = new AbsoluteLayout();
+ al.setCaption("AbsoluteLayout");
+ al.setStyleName("borders");
+ al.setWidth("300px");
+ al.setHeight("500px");
+ al.addComponent(new TextField("This is its caption",
+ "This is a textfield"), "top: 60px; left: 0px; width: 100px;");
+ al.addComponent(new TextField("Another textfield caption",
+ "This is another textfield"),
+ "top: 120px; left: 20px; width: 100px;");
+
+ al.addComponent(new Button("A button with its own click listener",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(
+ com.vaadin.ui.Button.ClickEvent event) {
+ log.log("Button " + event.getButton().getCaption()
+ + " was clicked");
+
+ }
+ }));
+ al.addListener(new LayoutClickListener() {
+
+ @Override
+ public void layoutClick(LayoutClickEvent event) {
+ logLayoutClick("AbsoluteLayout", event);
+ }
+ });
+
+ return al;
+
+ }
+
+ private Component createClickableCSSLayout() {
+ final CssLayout cl = new CssLayout();
+ cl.setCaption("CSSLayout");
+ cl.setStyleName("borders");
+ cl.setWidth("300px");
+ cl.setHeight("500px");
+ cl.addComponent(new TextField("This is its caption",
+ "This is a textfield"));
+ cl.addComponent(new TextField("Another textfield caption",
+ "This is another textfield"));
+
+ cl.addComponent(new Button("A button with its own click listener",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(
+ com.vaadin.ui.Button.ClickEvent event) {
+ log.log("Button " + event.getButton().getCaption()
+ + " was clicked");
+
+ }
+ }));
+ cl.addListener(new LayoutClickListener() {
+
+ @Override
+ public void layoutClick(LayoutClickEvent event) {
+ logLayoutClick("CSSLayout", event);
+ }
+ });
+
+ return cl;
+
+ }
+
+ private Layout createClickableGridLayout() {
+
+ GridLayout gl = new GridLayout(4, 4);
+ gl.setHeight("400px");
+ gl.setWidth("564px");
+ gl.setStyleName("borders");
+ gl.setSpacing(true);
+ addContent(gl, 4);
+ TextArea largeTextarea = new TextArea("Large textarea");
+ largeTextarea.setWidth("100%");
+ largeTextarea.setHeight("99%");
+ gl.addComponent(largeTextarea, 0, 3, 3, 3);
+
+ gl.addListener(new LayoutClickListener() {
+
+ @Override
+ public void layoutClick(LayoutClickEvent event) {
+ logLayoutClick("GridLayout", event);
+ }
+ });
+ gl.setRowExpandRatio(3, 1);
+ return wrap(gl, "GridLayout");
+ }
+
+ protected void logLayoutClick(String layout, LayoutClickEvent event) {
+ String target = "&lt;none>";
+ Component component = event.getChildComponent();
+ if (component != null) {
+ target = component.getCaption();
+ if (target == null && component instanceof Label) {
+ target = ((Label) component).getValue().toString();
+ }
+ }
+ String button = "left";
+ if (event.getButton() == ClickEvent.BUTTON_RIGHT) {
+ button = "right";
+ } else if (event.getButton() == ClickEvent.BUTTON_MIDDLE) {
+ button = "middle";
+
+ }
+ String type = "click";
+ if (event.isDoubleClick()) {
+ type = "double-click";
+ }
+ log.log(layout + ": " + button + " " + type + " on " + target);
+ // + ", coordinates relative to the layout ("
+ // + event.getRelativeX() + ", " + event.getRelativeY() + ")");
+
+ }
+
+ private Layout createClickableVerticalLayout() {
+
+ VerticalLayout gl = new VerticalLayout();
+ addContent(gl, 5);
+
+ gl.addListener(new LayoutClickListener() {
+
+ @Override
+ public void layoutClick(LayoutClickEvent event) {
+ logLayoutClick("VerticalLayout", event);
+
+ }
+ });
+
+ return wrap(gl, "Clickable VerticalLayout");
+ }
+
+ private void addContent(Layout gl, int nr) {
+ for (int i = 1; i < nr; i++) {
+ Label l = new Label("This is label " + i);
+ l.setWidth(null);
+ gl.addComponent(l);
+ }
+ for (int i = nr; i < nr * 2; i++) {
+ gl.addComponent(new TextField("This is tf" + i, "this is tf " + i));
+ }
+ }
+
+ private Layout wrap(Component c, String caption) {
+ VerticalLayout vl = new VerticalLayout();
+ Label l = new Label(caption);
+ l.setWidth(null);
+ vl.addComponent(l);
+ vl.addComponent(c);
+
+ return vl;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "All layouts have click listeners attached and the events are shown in the event log at the top";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3541;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/TestLayoutPerformance.java b/uitest/src/com/vaadin/tests/layouts/TestLayoutPerformance.java
new file mode 100644
index 0000000000..85ecf2897b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/TestLayoutPerformance.java
@@ -0,0 +1,135 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class TestLayoutPerformance extends TestBase {
+ private NativeSelect ns;
+ private int i;
+ private NativeSelect ns2;
+ private VerticalLayout testarea = new VerticalLayout();
+
+ @Override
+ protected String getDescription() {
+ return "Test app to test simple rendering to various layouts.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+ @Override
+ protected void setup() {
+ Label label = new Label("<h1>CssLayout performance test.</h1>",
+ ContentMode.XHTML);
+ getLayout().addComponent(label);
+
+ label = new Label(
+ "<em>Hint</em>. Use debug dialog to measure rendering times TODO: extend with size settings (to both layout and content).",
+ ContentMode.XHTML);
+ getLayout().addComponent(label);
+
+ ns = new NativeSelect("Select component to test");
+ ns.addItem(CssLayout.class);
+ ns.addItem(GridLayout.class);
+ ns.addItem(VerticalLayout.class);
+ ns.setNullSelectionAllowed(false);
+ ns.setValue(CssLayout.class);
+
+ ns2 = new NativeSelect("Select component to render inside layout.");
+ ns2.addItem(Label.class);
+ ns2.addItem(Button.class);
+ ns2.setNullSelectionAllowed(false);
+ ns2.setValue(Label.class);
+
+ final TextField n = new TextField("Number of components");
+
+ n.setValue("1000");
+
+ final CheckBox cb = new CheckBox("Generate captions", false);
+
+ Button b = new Button("Render component");
+
+ b.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ int components = Integer.parseInt(n.getValue());
+ Layout layout = getCurrentLayout();
+ for (int i = 0; i < components; i++) {
+ Component component = newTestComponent();
+ if (cb.getValue()) {
+ component.setCaption("caption " + i);
+ }
+ layout.addComponent(component);
+ }
+
+ testarea.removeAllComponents();
+ testarea.addComponent(layout);
+ }
+
+ });
+
+ getLayout().addComponent(ns);
+ getLayout().addComponent(ns2);
+ getLayout().addComponent(n);
+ getLayout().addComponent(cb);
+ getLayout().addComponent(b);
+ getLayout().addComponent(testarea);
+
+ }
+
+ private Layout getCurrentLayout() {
+ Class<?> value = (Class<?>) ns.getValue();
+ if (value == GridLayout.class) {
+ return new GridLayout(10, 1);
+ }
+
+ try {
+ return (Layout) value.newInstance();
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+
+ }
+
+ private Component newTestComponent() {
+ Class<?> componentClass = (Class<?>) ns2.getValue();
+ AbstractComponent newInstance = null;
+ try {
+ newInstance = (AbstractComponent) componentClass.newInstance();
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if (componentClass == Label.class) {
+ ((Label) newInstance).setValue("Test l " + (i++));
+ ((Label) newInstance).setSizeUndefined();
+ } else {
+ newInstance.setCaption("Test l " + (i++));
+ }
+ return newInstance;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/TreeWithBordersInLayout.html b/uitest/src/com/vaadin/tests/layouts/TreeWithBordersInLayout.html
new file mode 100644
index 0000000000..e1034c2f0e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/TreeWithBordersInLayout.html
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.TreeWithBordersInLayout?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>tree-with-borders</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/TreeWithBordersInLayout.java b/uitest/src/com/vaadin/tests/layouts/TreeWithBordersInLayout.java
new file mode 100644
index 0000000000..8786ae282c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/TreeWithBordersInLayout.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
+
+public class TreeWithBordersInLayout extends AbstractTestCase {
+
+ private static final Object CAPTION = "caption";
+
+ @Override
+ public void init() {
+ Layout mainLayout = new VerticalLayout();
+ mainLayout.setSizeUndefined();
+ setMainWindow(new LegacyWindow("main window", mainLayout));
+
+ setTheme("tests-tickets");
+
+ Tree t = new Tree();
+ t.addContainerProperty(CAPTION, String.class, "");
+ t.setItemCaptionPropertyId(CAPTION);
+ t.addItem("Item 1").getItemProperty(CAPTION).setValue("Item 1");
+
+ t.setSizeUndefined();
+ t.setStyleName("redblueborders");
+ mainLayout.addComponent(t);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The tree consists of one node and has a 10px blue red border and a 10px red right border. The tree node should be visible between the borders.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3915;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutExpandRatioModification.java b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutExpandRatioModification.java
new file mode 100644
index 0000000000..ef24150762
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutExpandRatioModification.java
@@ -0,0 +1,78 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class VerticalLayoutExpandRatioModification extends TestBase implements
+ ClickListener {
+
+ private boolean isVisible = false;
+ private VerticalLayout mainLayout;
+ private VerticalLayout vl1;
+ private VerticalLayout vl2;
+ private Button button;
+
+ @Override
+ public void setup() {
+ LegacyWindow main = getMainWindow();
+
+ mainLayout = new VerticalLayout();
+ main.setContent(mainLayout);
+
+ // The upper layout
+ vl1 = new VerticalLayout();
+ Label label1 = new Label("The upper layout");
+ vl1.addComponent(label1);
+
+ // Button that hides or shows the bottom part
+ button = new Button("show / hide", this);
+
+ // The bottom layout
+ vl2 = new VerticalLayout();
+ TextField tf = new TextField("The bottom field");
+ tf.setHeight("100%");
+ vl2.addComponent(tf);
+
+ // Add everything to the view
+ mainLayout.addComponent(vl1);
+ mainLayout.addComponent(button);
+ mainLayout.addComponent(vl2);
+
+ // Set expand ratios, hide lower
+ mainLayout.setExpandRatio(vl1, 1);
+ mainLayout.setExpandRatio(vl2, 0);
+
+ // Maximize everything
+ main.setSizeFull();
+ mainLayout.setSizeFull();
+ vl1.setSizeFull();
+ vl2.setSizeFull();
+ }
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (isVisible) {
+ mainLayout.setExpandRatio(vl2, 0);
+ isVisible = false;
+ } else {
+ mainLayout.setExpandRatio(vl2, 1);
+ isVisible = true;
+ }
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Changing the expand ratio should repaint the layout correctly. Changing from 0 to something else should render the previously invisible component";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2454;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponents.java b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponents.java
new file mode 100644
index 0000000000..906de9bb77
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponents.java
@@ -0,0 +1,38 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+
+public class VerticalLayoutWithRelativeSizeComponents extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "A undefined wide VerticalLayout containing a 100% wide label, a Button and another identical label. The labels should be as wide as the button (400px) and there should be no extra space between the bottom of the first label and the button.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2591;
+ }
+
+ @Override
+ protected void setup() {
+ getLayout().setSizeUndefined();
+ getMainWindow().getContent().setHeight(null);
+
+ Label l = new Label(
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum urna quis leo. In hac habitasse platea dictumst. Pellentesque tincidunt. Sed libero nisl, faucibus in, laoreet pellentesque, consectetur non, dolor. Sed tortor. Ut pretium sapien. Cras elementum enim non lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla velit est, aliquam a, pellentesque a, iaculis nec, sapien. Ut ultrices ligula vitae nulla. Morbi sem pede, iaculis ac, condimentum a, ornare eget, nisi. Aliquam hendrerit pulvinar massa. Vestibulum pretium purus eu augue. Sed posuere elit ut magna. Cras consequat faucibus nunc. Vestibulum quis diam.");
+ Label l2 = new Label(
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum urna quis leo. In hac habitasse platea dictumst. Pellentesque tincidunt. Sed libero nisl, faucibus in, laoreet pellentesque, consectetur non, dolor. Sed tortor. Ut pretium sapien. Cras elementum enim non lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla velit est, aliquam a, pellentesque a, iaculis nec, sapien. Ut ultrices ligula vitae nulla. Morbi sem pede, iaculis ac, condimentum a, ornare eget, nisi. Aliquam hendrerit pulvinar massa. Vestibulum pretium purus eu augue. Sed posuere elit ut magna. Cras consequat faucibus nunc. Vestibulum quis diam.");
+ l.setWidth("100%");
+ l2.setWidth("100%");
+
+ Button b = new Button("This defines the width");
+ b.setWidth("400px");
+ addComponent(l);
+ addComponent(b);
+ addComponent(l2);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponentsInitiallyHidden.java b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponentsInitiallyHidden.java
new file mode 100644
index 0000000000..f3d4029663
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponentsInitiallyHidden.java
@@ -0,0 +1,59 @@
+package com.vaadin.tests.layouts;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+
+public class VerticalLayoutWithRelativeSizeComponentsInitiallyHidden extends
+ TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Size calculations fail if expanded component is relative sized "
+ + "and initially invisible and when becoming visible at the "
+ + "same time some other component size changes.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4608;
+ }
+
+ @Override
+ protected void setup() {
+
+ VerticalLayout verticalLayout = getLayout();
+ verticalLayout.setHeight("500px");
+
+ final Label bar = new Label("Bar");
+ bar.setSizeUndefined();
+ final Label foobar = new Label("FooBar");
+ foobar.setSizeFull();
+ foobar.setVisible(false);
+
+ bar.setHeight("100px");
+
+ // bar.setHeight("100px");
+ bar.setVisible(false);
+
+ Button b = new Button(
+ "Click to set bar visible. Button should stay visible.");
+ b.addListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ bar.setVisible(true);
+ foobar.setVisible(true);
+ }
+ });
+
+ verticalLayout.addComponent(bar);
+ verticalLayout.addComponent(foobar);
+ verticalLayout.setExpandRatio(foobar, 1);
+ verticalLayout.addComponent(b);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/AbstractLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/AbstractLayoutTests.java
new file mode 100644
index 0000000000..c96d542a4c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/AbstractLayoutTests.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.layouts.layouttester;
+
+import com.vaadin.ui.Layout;
+
+public abstract class AbstractLayoutTests {
+
+ protected static final String FOLDER_16_PNG = "../icons/runo/16/folder.png";
+ protected static final String CALENDAR_32_PNG = "../runo/icons/32/calendar.png";
+ protected static final String LOCK_16_PNG = "../runo/icons/16/lock.png";
+ protected static final String GLOBE_16_PNG = "../runo/icons/16/globe.png";
+
+ abstract protected Layout getCaptionsTests();
+
+ abstract protected Layout getIconsTests();
+
+ abstract protected Layout getRequiredErrorIndicatorsTests();
+
+ abstract protected Layout getAlignmentTests();
+
+ abstract protected Layout getExpandRatiosTests();
+
+ abstract protected Layout getMarginSpacingTests();
+
+ abstract protected Layout getComponentAddReplaceMoveTests();
+
+ abstract protected Layout getComponentSizingTests();
+
+ abstract protected Layout getLayoutSizingTests();
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java
new file mode 100644
index 0000000000..8da94feb7f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java
@@ -0,0 +1,618 @@
+package com.vaadin.tests.layouts.layouttester;
+
+import java.util.Date;
+
+import com.vaadin.Application;
+import com.vaadin.server.Resource;
+import com.vaadin.server.SystemError;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.UserError;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.InlineDateField;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.Reindeer;
+
+public class GridLayoutTests extends AbstractLayoutTests {
+
+ private AbstractComponent rc1, col1, col2, col3, row1, row2, row3, x3, x22;
+
+ public GridLayoutTests(Application application) {
+ super();
+ }
+
+ @Override
+ protected Layout getAlignmentTests() {
+ HorizontalLayout hlo = new HorizontalLayout();
+ hlo.setSpacing(true);
+ GridLayout glo = getTestGrid();
+ glo.addStyleName(Reindeer.LAYOUT_WHITE);
+ Alignment[] alignments = new Alignment[] { Alignment.BOTTOM_LEFT,
+ Alignment.BOTTOM_CENTER, Alignment.BOTTOM_RIGHT,
+ Alignment.MIDDLE_LEFT, Alignment.MIDDLE_CENTER,
+ Alignment.MIDDLE_RIGHT, Alignment.TOP_LEFT,
+ Alignment.TOP_CENTER, Alignment.TOP_RIGHT };
+
+ glo.replaceComponent(col1, col1 = new TextField());
+ glo.replaceComponent(col2, col2 = new TextField());
+ glo.replaceComponent(col3, col3 = new TextField());
+ ((TextField) col1).setValue("BOTTOM_RIGHT");
+ ((TextField) col2).setValue("BOTTOM_LEFT");
+ ((TextField) col3).setValue("BOTTOM_CENTER");
+ glo.setComponentAlignment(col2, alignments[0]);
+ glo.setComponentAlignment(col3, alignments[1]);
+ glo.setComponentAlignment(col1, alignments[2]);
+
+ glo.setComponentAlignment(row1, alignments[3]);
+ glo.setComponentAlignment(row2, alignments[4]);
+ glo.setComponentAlignment(row3, alignments[5]);
+ hlo.addComponent(glo);
+ glo = getTestGrid();
+ glo.replaceComponent(row1, row1 = new DateField());
+ glo.replaceComponent(row2, row2 = new DateField());
+ glo.replaceComponent(row3, row3 = new DateField());
+ ((DateField) row1).setResolution(DateField.RESOLUTION_SEC);
+ ((DateField) row2).setResolution(DateField.RESOLUTION_SEC);
+ ((DateField) row3).setResolution(DateField.RESOLUTION_SEC);
+ glo.setComponentAlignment(col2, alignments[6]);
+ glo.setComponentAlignment(col3, alignments[7]);
+ glo.setComponentAlignment(col1, alignments[8]);
+ hlo.addComponent(glo);
+ return hlo;
+ }
+
+ @Override
+ protected Layout getCaptionsTests() {
+ GridLayout glo = getTestGrid();
+ glo.setWidth("600px");
+ String[] captions = new String[] {
+ "",
+ "abcdefghijklmnopq",
+ "abc def hij klm nop qrs tuv xyz qaz wsx edc rfv tgb yhn ujm mko nji bhu vgy cft cde" };
+ glo.replaceComponent(col1, col1 = new TextField());
+ glo.replaceComponent(col2, col2 = new TextField());
+ glo.replaceComponent(col3, col3 = new TextField());
+
+ col1.setCaption(captions[0]);
+ col2.setCaption(captions[1]);
+ col3.setCaption(captions[2]);
+ col3.setIcon(new ThemeResource(LOCK_16_PNG));
+
+ glo.replaceComponent(row1, row1 = new Label());
+ glo.replaceComponent(row2, row2 = new Label());
+ glo.replaceComponent(row3, row3 = new Label());
+
+ row1.setCaption(captions[0]);
+ row2.setCaption(captions[1]);
+ row3.setCaption(captions[2]);
+
+ glo.replaceComponent(x3, x3 = getTestTabsheet());
+ glo.replaceComponent(x22, x22 = getTestTable());
+ x22.setComponentError(new UserError("component error, user error"));
+
+ x3.setCaption(captions[1]);
+ x22.setCaption(captions[2]);
+
+ return glo;
+ }
+
+ @Override
+ protected Layout getComponentAddReplaceMoveTests() {
+ final GridLayout glo = getTestGrid();
+ glo.setHeight("350px");
+ Layout baseLayout = getBaseLayout();
+ final Button button1 = new Button("Test add");
+ final Button button2 = new Button("Test replace");
+ final Button button3 = new Button("Test move");
+ final Button button4 = new Button("Test remove comp 1,1");
+ final Button button5 = new Button("Test remove row 0");
+ final Button button6 = new Button("Test remove comp row3");
+
+ baseLayout.addComponent(button1);
+ baseLayout.addComponent(button2);
+ baseLayout.addComponent(button3);
+ baseLayout.addComponent(button4);
+ baseLayout.addComponent(button5);
+ baseLayout.addComponent(button6);
+ baseLayout.addComponent(glo);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ button4.setEnabled(false);
+ button5.setEnabled(false);
+ button6.setEnabled(false);
+
+ final HorizontalLayout source = new HorizontalLayout();
+ source.addComponent(new Label("MOVE LABEL 1"));
+ source.addComponent(new Label("MOVE LABEL 2"));
+
+ final AbstractComponent cc1 = getTestTabsheet();
+ cc1.setCaption("ADDED COMPONENT");
+
+ final AbstractComponent cc2 = getTestTabsheet();
+ cc2.setCaption("REPLACEMENT COMPONENT");
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.addComponent(cc1);
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.replaceComponent(x22, cc2);
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.moveComponentsFrom(source);
+ button3.setEnabled(false);
+ button4.setEnabled(true);
+ }
+ });
+ button4.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.removeComponent(1, 1);
+ button4.setEnabled(false);
+ button5.setEnabled(true);
+ }
+ });
+
+ button5.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.removeRow(0);
+ button5.setEnabled(false);
+ button6.setEnabled(true);
+ }
+ });
+ button6.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.removeComponent(row3);
+ button6.setEnabled(false);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getComponentSizingTests() {
+ final GridLayout glo = getTestGrid();
+ glo.setHeight("350px");
+ Layout baseLayout = getBaseLayout();
+ final Button button1 = new Button("full size, 3x1");
+ final Button button2 = new Button("200 px width, 3x1");
+ final Button button3 = new Button("200 px width, table");
+ final Button button4 = new Button("undefined size+add, table");
+
+ glo.replaceComponent(x22, x22 = getTestTable());
+
+ baseLayout.addComponent(button1);
+ baseLayout.addComponent(button2);
+ baseLayout.addComponent(button3);
+ baseLayout.addComponent(button4);
+ baseLayout.addComponent(glo);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ button4.setEnabled(false);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ x3.setSizeFull();
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ x3.setWidth("200px");
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ x22.setWidth("200px");
+ button3.setEnabled(false);
+ button4.setEnabled(true);
+ }
+ });
+ button4.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ x22.setSizeUndefined();
+ ((Table) x22).addItem(new Object[] { "NEW ROW1" }, 3);
+ ((Table) x22).addItem(new Object[] { "NEW ROW2" }, 4);
+ button4.setEnabled(false);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getExpandRatiosTests() {
+ final GridLayout glo = getTestGrid();
+ Layout baseLayout = getBaseLayout();
+ final Button button1 = new Button("set col 3 expand 1");
+ final Button button2 = new Button("set all cols expand 0.25");
+ final Button button3 = new Button("set row 0 expand 0.5");
+ final Button button4 = new Button("set row 3 expand 0.2");
+ glo.setHeight("400px");
+ glo.replaceComponent(x22, x22 = getTestTable());
+
+ baseLayout.addComponent(button1);
+ baseLayout.addComponent(button2);
+ baseLayout.addComponent(button3);
+ baseLayout.addComponent(button4);
+ baseLayout.addComponent(glo);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ button4.setEnabled(false);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setColumnExpandRatio(3, 1);
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setColumnExpandRatio(0, 0.25f);
+ glo.setColumnExpandRatio(1, 0.25f);
+ glo.setColumnExpandRatio(2, 0.25f);
+ glo.setColumnExpandRatio(3, 0.25f);
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setRowExpandRatio(0, 0.5f);
+ button3.setEnabled(false);
+ button4.setEnabled(true);
+ }
+ });
+ button4.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setRowExpandRatio(3, 0.3f);
+ button4.setEnabled(false);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getIconsTests() {
+ GridLayout glo = getTestGrid();
+ glo.setWidth("600px");
+ Resource[] icons = new Resource[] { new ThemeResource(CALENDAR_32_PNG),
+ new ThemeResource(LOCK_16_PNG) };
+
+ glo.replaceComponent(col1, col1 = new TextField("TEXTFIELD"));
+ glo.replaceComponent(col2, col2 = new Label("LABEL"));
+ glo.replaceComponent(col3, col3 = new Link("LINK", null));
+
+ col1.setIcon(icons[0]);
+ col2.setIcon(icons[1]);
+ col3.setIcon(icons[0]);
+ rc1.setIcon(icons[1]);
+ col3.setCaption("long test caption bewucbwuebco or bmort b cbwecubw wbeucwe asdasd asdasda asdasd");
+ col3.setComponentError(new UserError("component error, user error"));
+
+ glo.replaceComponent(row1, row1 = new DateField());
+ glo.replaceComponent(row2, row2 = new NativeSelect());
+ glo.replaceComponent(row3, row3 = getTestTabsheet());
+
+ row1.setIcon(icons[1]);
+ row2.setIcon(icons[0]);
+ row3.setIcon(icons[1]);
+
+ glo.replaceComponent(x3, x3 = new CheckBox("CHECKBOX"));
+ glo.replaceComponent(x22, x22 = new Panel("PANEL"));
+ x22.setIcon(new ThemeResource(CALENDAR_32_PNG));
+
+ x3.setIcon(icons[0]);
+ x22.setIcon(icons[1]);
+
+ return glo;
+ }
+
+ @Override
+ protected Layout getLayoutSizingTests() {
+ final GridLayout glo = getTestGrid();
+ Layout baseLayout = getBaseLayout();
+ baseLayout.setWidth("500px");
+ baseLayout.setHeight("500px");
+ final Button button1 = new Button("Set fixed height 350px");
+ final Button button2 = new Button(
+ "Set undefined size and add component");
+ final Button button3 = new Button("Set fixed width and height 75%");
+ final Button button4 = new Button("Set size full");
+
+ glo.replaceComponent(x22, x22 = getTestTable());
+
+ baseLayout.addComponent(button1);
+ baseLayout.addComponent(button2);
+ baseLayout.addComponent(button3);
+ baseLayout.addComponent(button4);
+ baseLayout.addComponent(glo);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ button4.setEnabled(false);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setHeight("350px");
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setSizeUndefined();
+ glo.addComponent(new Label("--- NEW LABEL ---"));
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setWidth("75%");
+ glo.setHeight("75%");
+ button3.setEnabled(false);
+ button4.setEnabled(true);
+ }
+ });
+ button4.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setSizeFull();
+ button4.setEnabled(false);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getMarginSpacingTests() {
+ final GridLayout glo = getTestGrid();
+ Layout baseLayout = getBaseLayout();
+ baseLayout.setWidth("500px");
+ baseLayout.setHeight("500px");
+ final Button button1 = new Button("Set margin on");
+ final Button button2 = new Button("Set spacing on");
+ final Button button3 = new Button("Set margin off");
+ final Button button4 = new Button("Set spacing off");
+
+ baseLayout.addComponent(button1);
+ baseLayout.addComponent(button2);
+ baseLayout.addComponent(button3);
+ baseLayout.addComponent(button4);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ button4.setEnabled(false);
+
+ baseLayout.addComponent(glo);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setMargin(true);
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setSpacing(true);
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setMargin(false);
+ button3.setEnabled(false);
+ button4.setEnabled(true);
+ }
+ });
+ button4.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ glo.setSpacing(false);
+ button4.setEnabled(false);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getRequiredErrorIndicatorsTests() {
+ GridLayout glo = getTestGrid();
+ glo.setWidth("600px");
+ Resource[] icons = new Resource[] { new ThemeResource(CALENDAR_32_PNG),
+ new ThemeResource(LOCK_16_PNG) };
+
+ glo.replaceComponent(col1, col1 = new TextField("TEXTFIELD"));
+ glo.replaceComponent(col2, col2 = new Label("LABEL"));
+ glo.replaceComponent(col3, col3 = new Link("LINK", null));
+
+ col1.setIcon(icons[0]);
+ col1.setComponentError(new UserError("component error, user error"));
+ col2.setComponentError(new SystemError("component error, system error"));
+ col3.setComponentError(new UserError("component error, user error"));
+
+ glo.replaceComponent(row1, row1 = new DateField());
+ glo.replaceComponent(row2, row2 = new NativeSelect());
+ glo.replaceComponent(row3, row3 = getTestTabsheet());
+
+ ((AbstractField<?>) col1).setRequired(true);
+ ((AbstractField<?>) col1).setValidationVisible(true);
+ ((AbstractField<?>) col1).setRequiredError("required error");
+
+ ((AbstractField<?>) row1).setRequired(true);
+ ((AbstractField<?>) row1).setValidationVisible(true);
+ ((AbstractField<?>) row1).setRequiredError("required error");
+
+ ((AbstractField<?>) row2).setRequired(true);
+ ((AbstractField<?>) row2).setValidationVisible(true);
+ ((AbstractField<?>) row2).setRequiredError("required error");
+ row2.setComponentError(new UserError("component error, user error"));
+
+ row3.setComponentError(new UserError("component error, user error"));
+ row3.setIcon(icons[1]);
+ row3.setCaption("long test caption bewucbwuebco or bmort b cbwecubw wbeucwe asdasd asdasda asdasd");
+
+ glo.replaceComponent(x3, x3 = new CheckBox("CHECKBOX"));
+ glo.replaceComponent(x22, x22 = new Panel("PANEL"));
+
+ x3.setComponentError(new UserError("component error, user error"));
+ x22.setComponentError(new UserError("component error, user error"));
+ x22.setIcon(icons[0]);
+
+ return glo;
+ }
+
+ private GridLayout getTestGrid() {
+ // Create a 4 by 4 grid layout.
+ GridLayout grid = new GridLayout(4, 4);
+ // Fill out the first row using the cursor.
+ grid.addComponent(rc1 = new Button("R/C 1"));
+
+ grid.addComponent(col1 = new Button("Col " + (grid.getCursorX() + 1)));
+ grid.addComponent(col2 = new Button("Col " + (grid.getCursorX() + 1)));
+ grid.addComponent(col3 = new Button("Col " + (grid.getCursorX() + 1)));
+
+ // Fill out the first column using coordinates.
+
+ grid.addComponent(row1 = new Button("Row " + 1), 0, 1);
+ grid.addComponent(row2 = new Button("Row " + 2), 0, 2);
+ grid.addComponent(row3 = new Button("Row " + 3), 0, 3);
+
+ // Add some components of various shapes.
+ grid.addComponent(x3 = new Button("3x1 button"), 1, 1, 3, 1);
+ grid.addComponent(new Label("1x2 cell"), 1, 2, 1, 3);
+ x22 = new InlineDateField("A 2x2 date field");
+ ((InlineDateField) x22).setResolution(DateField.RESOLUTION_DAY);
+ ((InlineDateField) x22).setValue(new Date(128028960000l));
+ grid.addComponent(x22, 2, 2, 3, 3);
+ grid.setWidth("450px");
+ grid.setHeight("450px");
+ return grid;
+ }
+
+ private VerticalLayout getBaseLayout() {
+ VerticalLayout vlo = new VerticalLayout();
+ vlo.setSizeUndefined();
+ return vlo;
+ }
+
+ private AbstractComponent getTestTabsheet() {
+ TabSheet tabsheet = new TabSheet();
+ tabsheet.setSizeUndefined();
+ tabsheet.addTab(new UndefWideLabel("TAB1"), "TAB1", new ThemeResource(
+ GLOBE_16_PNG));
+ tabsheet.addTab(new UndefWideLabel("TAB2"), "TAB2", null);
+ return tabsheet;
+ }
+
+ private Table getTestTable() {
+ Table t = new Table();
+ t.setSizeUndefined();
+ t.setPageLength(5);
+ t.addContainerProperty("test", String.class, null);
+ t.addItem(new Object[] { "qwertyuiop asdfghjklzxccvbnm,m,." }, 1);
+ t.addItem(new Object[] { "YGVYTCTCTRXRXRXRX" }, 2);
+ return t;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java
new file mode 100644
index 0000000000..0042f0ba11
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java
@@ -0,0 +1,578 @@
+package com.vaadin.tests.layouts.layouttester;
+
+import com.vaadin.Application;
+import com.vaadin.server.Resource;
+import com.vaadin.server.SystemError;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.UserError;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.Select;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.Reindeer;
+
+public class HorizontalLayoutTests extends AbstractLayoutTests {
+
+ public HorizontalLayoutTests(Application application) {
+ super();
+ }
+
+ @Override
+ protected Layout getAlignmentTests() {
+ Layout baseLayout = getBaseLayout();
+ HorizontalLayout vlo = getTestLaytout();
+ AbstractComponent[] components = new AbstractComponent[9];
+ String[] styles = { Reindeer.LAYOUT_BLUE, Reindeer.LAYOUT_WHITE };
+ Alignment[] alignments = new Alignment[] { Alignment.BOTTOM_LEFT,
+ Alignment.BOTTOM_CENTER, Alignment.BOTTOM_RIGHT,
+ Alignment.MIDDLE_LEFT, Alignment.MIDDLE_CENTER,
+ Alignment.MIDDLE_RIGHT, Alignment.TOP_LEFT,
+ Alignment.TOP_CENTER, Alignment.TOP_RIGHT };
+
+ vlo.addStyleName(Reindeer.LAYOUT_WHITE);
+ baseLayout.addComponent(vlo);
+ int index = 0;
+ for (int i = 0; i < components.length; i++) {
+ if (i > 0 && i % 3 == 0) {
+ vlo = getTestLaytout();
+ vlo.addStyleName(styles[index++]);
+ baseLayout.addComponent(vlo);
+ }
+ components[i] = new TextField();
+ ((TextField) components[i]).setValue("FIELD " + i);
+ vlo.addComponent(components[i]);
+ vlo.setComponentAlignment(components[i], alignments[i]);
+ }
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getCaptionsTests() {
+ Layout baseLayout = getBaseLayout();
+ AbstractComponent component = null;
+
+ String[] captions = new String[] {
+ "",
+ "abcdefghijklmnopq",
+ "abc def hij klm nop qrs tuv xyz qaz wsx edc rfv tgb yhn ujm mko nji bhu vgy cft cde" };
+
+ HorizontalLayout vlo = getTestLaytout();
+ for (int i = 0; i < captions.length; i++) {
+ component = new TextField();
+ ((TextField) component).setValue("FIELD " + i);
+ component.setCaption(captions[i]);
+ vlo.addComponent(component);
+ }
+ baseLayout.addComponent(vlo);
+ vlo = getTestLaytout();
+ for (int i = 0; i < captions.length; i++) {
+ component = new Label();
+ ((Label) component).setValue("Label " + i);
+ component.setCaption(captions[i]);
+ vlo.addComponent(component);
+ }
+ baseLayout.addComponent(vlo);
+ vlo = getTestLaytout();
+ for (int i = 0; i < captions.length; i++) {
+ component = new Select();
+ component.setCaption(captions[i]);
+ component.setIcon(new ThemeResource(LOCK_16_PNG));
+ vlo.addComponent(component);
+ }
+ baseLayout.addComponent(vlo);
+ vlo = getTestLaytout();
+ for (int i = 0; i < captions.length; i++) {
+ component = getTestTabsheet();
+ component.setCaption(captions[i]);
+ component.setComponentError(new UserError(
+ "component error, user error"));
+ vlo.addComponent(component);
+ }
+ baseLayout.addComponent(vlo);
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getComponentAddReplaceMoveTests() {
+ final HorizontalLayout vlo = getTestLaytout();
+ Layout baseLayout = getBaseLayout();
+ final HorizontalLayout source = new HorizontalLayout();
+ source.addComponent(new Label("OTHER LABEL 1"));
+ source.addComponent(new Label("OTHER LABEL 2"));
+
+ final AbstractComponent c1 = new Button("BUTTON");
+ final AbstractComponent c2 = new Label("<b>LABEL</b>",
+ ContentMode.XHTML);
+ final AbstractComponent c3 = new Table("TABLE");
+ c3.setHeight("100px");
+ c3.setWidth("100%");
+
+ final Button addButton = new Button("Test add");
+ final Button replaceButton = new Button("Test replace");
+ final Button moveButton = new Button("Test move");
+ final Button removeButton = new Button("Test remove");
+
+ replaceButton.setEnabled(false);
+ moveButton.setEnabled(false);
+ removeButton.setEnabled(false);
+
+ addButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.addComponent(new TextField());
+ addButton.setEnabled(false);
+ replaceButton.setEnabled(true);
+ }
+ });
+ replaceButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.replaceComponent(c1, c3);
+ replaceButton.setEnabled(false);
+ moveButton.setEnabled(true);
+ }
+ });
+ moveButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.moveComponentsFrom(source);
+ moveButton.setEnabled(false);
+ removeButton.setEnabled(true);
+ }
+ });
+ removeButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.removeComponent(c1);
+ vlo.removeComponent(c2);
+ removeButton.setEnabled(false);
+ }
+ });
+
+ baseLayout.addComponent(addButton);
+ baseLayout.addComponent(replaceButton);
+ baseLayout.addComponent(moveButton);
+ baseLayout.addComponent(removeButton);
+
+ vlo.addComponent(c1);
+ vlo.addComponent(c2);
+ vlo.addComponent(c3);
+ baseLayout.addComponent(vlo);
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getComponentSizingTests() {
+ final HorizontalLayout vlo = getTestLaytout();
+ Layout baseLayout = getBaseLayout();
+
+ final AbstractComponent c = getTestTable();
+
+ final Button biggerButton = new Button("full size");
+ final Button smallerButton = new Button("200 px width");
+ final Button originalButton = new Button("undefined size+add");
+
+ baseLayout.addComponent(biggerButton);
+ baseLayout.addComponent(smallerButton);
+ baseLayout.addComponent(originalButton);
+ vlo.addComponent(c);
+ baseLayout.addComponent(vlo);
+
+ biggerButton.setEnabled(true);
+ smallerButton.setEnabled(false);
+ originalButton.setEnabled(false);
+
+ biggerButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ c.setSizeFull();
+ biggerButton.setEnabled(false);
+ smallerButton.setEnabled(true);
+ }
+ });
+ smallerButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ c.setWidth("200px");
+ smallerButton.setEnabled(false);
+ originalButton.setEnabled(true);
+ }
+ });
+ originalButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ originalButton.setEnabled(false);
+ c.setSizeUndefined();
+ ((Table) c)
+ .addItem(
+ new Object[] { "VYVTCTC VYVYV ECECCE NIDSD SDMPOM" },
+ 3);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getLayoutSizingTests() {
+ final HorizontalLayout vlo = getTestLaytout();
+ vlo.setSpacing(false);
+ vlo.setMargin(false);
+ Layout baseLayout = getBaseLayout();
+ final AbstractComponent c1 = getTestTable();
+ c1.setSizeFull();
+ final AbstractComponent c2 = getTestTable();
+ c2.setSizeFull();
+
+ final Button button1 = new Button("Set fixed height 350px");
+ final Button button2 = new Button(
+ "Set undefined size and add component");
+ final Button button3 = new Button("Set fixed width and height 75%");
+ final Button button4 = new Button("Set size full");
+
+ baseLayout.addComponent(button1);
+ baseLayout.addComponent(button2);
+ baseLayout.addComponent(button3);
+ baseLayout.addComponent(button4);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ button4.setEnabled(false);
+
+ vlo.addComponent(c1);
+ vlo.addComponent(c2);
+ vlo.setExpandRatio(c1, 0.5f);
+ vlo.setExpandRatio(c2, 0.5f);
+
+ baseLayout.addComponent(vlo);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setHeight("350px");
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setSizeUndefined();
+ vlo.addComponent(new Label("--- NEW LABEL ---"));
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setWidth("75%");
+ vlo.setHeight("75%");
+ button3.setEnabled(false);
+ button4.setEnabled(true);
+ }
+ });
+ button4.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setSizeFull();
+ button4.setEnabled(false);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getExpandRatiosTests() {
+ final HorizontalLayout vlo = getTestLaytout();
+ Layout baseLayout = getBaseLayout();
+ final AbstractComponent c1 = getTestTable();
+ c1.setSizeFull();
+ final AbstractComponent c2 = getTestTable();
+ c2.setSizeFull();
+
+ final Button button1 = new Button("Expand to 1/undefined");
+ final Button button2 = new Button("Expand to 0.5/0.5");
+ final Button button3 = new Button("Expand to 0.75/0.25");
+
+ baseLayout.addComponent(button1);
+ baseLayout.addComponent(button2);
+ baseLayout.addComponent(button3);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+
+ vlo.addComponent(c1);
+ vlo.addComponent(c2);
+ baseLayout.addComponent(vlo);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setExpandRatio(c1, 1.0f);
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setExpandRatio(c1, 0.5f);
+ vlo.setExpandRatio(c2, 0.5f);
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setExpandRatio(c1, 0.75f);
+ vlo.setExpandRatio(c2, 0.25f);
+ button3.setEnabled(false);
+ }
+ });
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getIconsTests() {
+ HorizontalLayout vlo = getTestLaytout();
+ AbstractComponent[] components = new AbstractComponent[2];
+ Layout baseLayout = getBaseLayout();
+ Resource[] icons = new Resource[] { new ThemeResource(CALENDAR_32_PNG),
+ new ThemeResource(LOCK_16_PNG) };
+
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new TextField();
+ ((TextField) components[i]).setValue("FIELD " + i);
+ components[i].setIcon(icons[i]);
+ components[i]
+ .setCaption("long test caption bewucbwuebco or bmort b cbwecubw wbeucwe asdasd asdasda asdasd");
+ vlo.addComponent(components[i]);
+ }
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new Label();
+ ((Label) components[i]).setValue("Label " + i);
+ components[i].setIcon(icons[i]);
+ vlo.addComponent(components[i]);
+ }
+ baseLayout.addComponent(vlo);
+ vlo = getTestLaytout();
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new Select();
+ components[i].setIcon(icons[i]);
+ vlo.addComponent(components[i]);
+ }
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new Button();
+ components[i].setComponentError(new UserError(
+ "component error, user error"));
+ components[i].setIcon(icons[i]);
+ vlo.addComponent(components[i]);
+ }
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new Link("Link", null);
+ components[i].setIcon(icons[i]);
+ vlo.addComponent(components[i]);
+ }
+ baseLayout.addComponent(vlo);
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getMarginSpacingTests() {
+ final HorizontalLayout vlo = getTestLaytout();
+ vlo.setSpacing(false);
+ vlo.setMargin(false);
+ Layout baseLayout = getBaseLayout();
+ final AbstractComponent c1 = getTestTable();
+ c1.setSizeFull();
+ final AbstractComponent c2 = getTestTable();
+ c2.setSizeFull();
+
+ final Button button1 = new Button("Set margin on");
+ final Button button2 = new Button("Set spacing on");
+ final Button button3 = new Button("Set margin off");
+ final Button button4 = new Button("Set spacing off");
+
+ baseLayout.addComponent(button1);
+ baseLayout.addComponent(button2);
+ baseLayout.addComponent(button3);
+ baseLayout.addComponent(button4);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ button4.setEnabled(false);
+
+ vlo.addComponent(c1);
+ vlo.addComponent(c2);
+ vlo.setExpandRatio(c1, 0.5f);
+ vlo.setExpandRatio(c2, 0.5f);
+ baseLayout.addComponent(vlo);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setMargin(true);
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setSpacing(true);
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setMargin(false);
+ button3.setEnabled(false);
+ button4.setEnabled(true);
+ }
+ });
+ button4.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo.setSpacing(false);
+ button4.setEnabled(false);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getRequiredErrorIndicatorsTests() {
+ HorizontalLayout vlo = getTestLaytout();
+ Layout baseLayout = getBaseLayout();
+ AbstractComponent[] components = new AbstractComponent[4];
+ components[0] = new Label("LABEL");
+ components[0].setSizeUndefined();
+ components[1] = new Button("BUTTON");
+ components[2] = getTestTable();
+ components[3] = getTestTabsheet();
+ components[3].setIcon(new ThemeResource(LOCK_16_PNG));
+
+ AbstractField<?>[] fields = new AbstractField<?>[5];
+ fields[0] = new TextField();
+ fields[0].setRequired(true);
+ fields[0].setValidationVisible(true);
+ fields[0].setRequiredError("required error");
+
+ fields[1] = new TextField();
+ fields[1].setValue("TEXTFIELD2");
+ fields[1]
+ .setComponentError(new UserError("component error, user error"));
+
+ fields[2] = new Select();
+ fields[2].setComponentError(new SystemError(
+ "component error, system error"));
+ fields[3] = new DateField();
+ fields[3].setComponentError(new SystemError(
+ "component error, system error"));
+
+ fields[4] = new CheckBox();
+ fields[4]
+ .setComponentError(new UserError("component error, user error"));
+
+ for (int i = 0; i < components.length; i++) {
+ components[i].setComponentError(new UserError(
+ "component error, user error"));
+ vlo.addComponent(components[i]);
+ }
+ baseLayout.addComponent(vlo);
+ vlo = getTestLaytout();
+ for (int i = 0; i < fields.length; i++) {
+ vlo.addComponent(fields[i]);
+ }
+ baseLayout.addComponent(vlo);
+ return baseLayout;
+ }
+
+ private VerticalLayout getBaseLayout() {
+ VerticalLayout vlo = new VerticalLayout();
+ vlo.setSizeUndefined();
+ return vlo;
+ }
+
+ private HorizontalLayout getTestLaytout() {
+ HorizontalLayout vlo = new HorizontalLayout();
+ vlo.setHeight("100px");
+ vlo.setWidth("750px");
+ return vlo;
+ }
+
+ private AbstractComponent getTestTabsheet() {
+ TabSheet tabsheet = new TabSheet();
+ tabsheet.setSizeUndefined();
+ tabsheet.addTab(new UndefWideLabel("TAB1"), "TAB1", new ThemeResource(
+ GLOBE_16_PNG));
+ tabsheet.addTab(new UndefWideLabel("TAB2"), "TAB2", null);
+ return tabsheet;
+ }
+
+ private Table getTestTable() {
+ Table t = new Table();
+ t.setSizeUndefined();
+ t.setPageLength(5);
+ t.addContainerProperty("test", String.class, null);
+ t.addItem(new Object[] { "qwertyuiop asdfghjkl zxccvbnm,m,." }, 1);
+ t.addItem(new Object[] { "YGVYTCTCTRXRXRXRX" }, 2);
+ return t;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html
new file mode 100644
index 0000000000..8408aba9fd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html
@@ -0,0 +1,896 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>LayoutTesterApplication</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">LayoutTesterApplication</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.layouts.layouttester.LayoutTesterApplication?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>2</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>3</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>4</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>5</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>6</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>7</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>8</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>9</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>10</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>11</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>12</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>13</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>14</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>15</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>16</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>17</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>18</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>19</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>20</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>21</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>22</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>23</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>24</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>25</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>26</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>27</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>28</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VNativeSelect[0]/domChild[0]</td>
+ <td>label=class com.vaadin.ui.HorizontalLayout</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>29</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>30</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>31</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>32</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>33</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>34</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>35</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>36</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>37</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>38</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>39</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>40</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>41</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>42</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>43</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>44</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>45</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>46</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>47</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>48</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>49</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>50</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>51</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>52</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>53</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>54</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>55</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>56</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VNativeSelect[0]/domChild[0]</td>
+ <td>label=class com.vaadin.ui.GridLayout</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>57</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>58</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>59</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>60</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>61</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>62</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>63</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>64</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>65</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>66</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>67</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>68</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>69</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>70</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>71</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>72</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>73</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>74</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>75</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>76</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>77</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>78</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>79</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>80</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>81</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>82</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>83</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>84</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>85</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>86</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>87</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>88</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java
new file mode 100644
index 0000000000..e31ecc2498
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java
@@ -0,0 +1,130 @@
+package com.vaadin.tests.layouts.layouttester;
+
+import java.lang.reflect.Method;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.Reindeer;
+
+@SuppressWarnings("serial")
+public class LayoutTesterApplication extends AbstractTestCase {
+ Button nextButton = new Button("Next");
+ private int layoutIndex = -1;
+ private int layoutCount = 1;
+
+ private Method[] layoutGetters;
+ private LegacyWindow mainWindow;
+ private NativeSelect layoutSelector;
+
+ @Override
+ public void init() {
+ mainWindow = new LegacyWindow("LayoutTesterApplication");
+ setMainWindow(mainWindow);
+ loadLayoutGetters();
+ nextLaytout();
+
+ nextButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = -1577298910202253538L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ nextLaytout();
+ }
+ });
+ }
+
+ private void nextLaytout() {
+ try {
+ mainWindow.removeAllComponents();
+ HorizontalLayout vlo = new HorizontalLayout();
+ vlo.setSpacing(true);
+ ++layoutIndex;
+ if (layoutIndex >= layoutCount) {
+ layoutIndex = 0;
+ }
+ mainWindow.addComponent(vlo);
+ vlo.addComponent(nextButton);
+ vlo.addComponent(getLayoutTypeSelect());
+ vlo.addComponent(new UndefWideLabel(layoutGetters[layoutIndex]
+ .getName()));
+
+ Layout lo = null;
+ if (layoutSelector.getValue() == VerticalLayout.class) {
+ lo = getVerticalTestLayout(layoutIndex);
+ } else if (layoutSelector.getValue() == HorizontalLayout.class) {
+ lo = getHorizontalTestLayout(layoutIndex);
+ } else if (layoutSelector.getValue() == GridLayout.class) {
+ lo = getGridTestLayout(layoutIndex);
+ }
+ if (lo != null) {
+ lo.addStyleName(Reindeer.LAYOUT_BLUE);
+ mainWindow.addComponent(lo);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void loadLayoutGetters() {
+ layoutGetters = AbstractLayoutTests.class.getDeclaredMethods();
+ layoutCount = layoutGetters.length;
+ }
+
+ public Layout getVerticalTestLayout(int index) throws Exception {
+ VerticalLayoutTests vlotest = new VerticalLayoutTests(this);
+ return (Layout) layoutGetters[index].invoke(vlotest, (Object[]) null);
+ }
+
+ public Layout getHorizontalTestLayout(int index) throws Exception {
+ HorizontalLayoutTests hlotest = new HorizontalLayoutTests(this);
+ return (Layout) layoutGetters[index].invoke(hlotest, (Object[]) null);
+ }
+
+ public Layout getGridTestLayout(int index) throws Exception {
+ GridLayoutTests hlotest = new GridLayoutTests(this);
+ return (Layout) layoutGetters[index].invoke(hlotest, (Object[]) null);
+ }
+
+ private NativeSelect getLayoutTypeSelect() {
+ if (layoutSelector == null) {
+ layoutSelector = new NativeSelect();
+ layoutSelector.addItem(VerticalLayout.class);
+ layoutSelector.addItem(HorizontalLayout.class);
+ layoutSelector.addItem(GridLayout.class);
+ layoutSelector.setNullSelectionAllowed(false);
+ layoutSelector.setImmediate(true);
+ layoutSelector.select(VerticalLayout.class);
+ layoutSelector.addListener(new Property.ValueChangeListener() {
+ private static final long serialVersionUID = -605319614765838359L;
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ layoutIndex = -1;
+ nextLaytout();
+ }
+ });
+ }
+ return layoutSelector;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Test application for VerticalLayout, HorizontalLayout, and GridLayout";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5334;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/UndefWideLabel.java b/uitest/src/com/vaadin/tests/layouts/layouttester/UndefWideLabel.java
new file mode 100644
index 0000000000..c998ce458a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/UndefWideLabel.java
@@ -0,0 +1,12 @@
+package com.vaadin.tests.layouts.layouttester;
+
+import com.vaadin.ui.Label;
+
+public class UndefWideLabel extends Label {
+
+ public UndefWideLabel(String value) {
+ super(value);
+ setWidth(null);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java
new file mode 100644
index 0000000000..3e668289fe
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java
@@ -0,0 +1,615 @@
+package com.vaadin.tests.layouts.layouttester;
+
+import com.vaadin.Application;
+import com.vaadin.server.Resource;
+import com.vaadin.server.SystemError;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.UserError;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.Select;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class VerticalLayoutTests extends AbstractLayoutTests {
+
+ public VerticalLayoutTests(Application application) {
+ super();
+ }
+
+ @Override
+ protected Layout getAlignmentTests() {
+ Layout baseLayout = getBaseLayout();
+ ((HorizontalLayout) baseLayout).setSpacing(true);
+ VerticalLayout vlo = getTestLaytout();
+ AbstractComponent[] components = new AbstractComponent[9];
+ Alignment[] alignments = new Alignment[] { Alignment.BOTTOM_CENTER,
+ Alignment.BOTTOM_LEFT, Alignment.BOTTOM_RIGHT,
+ Alignment.MIDDLE_CENTER, Alignment.MIDDLE_LEFT,
+ Alignment.MIDDLE_RIGHT, Alignment.TOP_CENTER,
+ Alignment.TOP_LEFT, Alignment.TOP_RIGHT };
+
+ for (int i = 0; i < components.length / 2; i++) {
+ components[i] = new TextField();
+ ((TextField) components[i]).setValue("FIELD " + i);
+ vlo.addComponent(components[i]);
+ vlo.setComponentAlignment(components[i], alignments[i]);
+ vlo.addComponent(new Label("<hr />", ContentMode.XHTML));
+ }
+ baseLayout.addComponent(vlo);
+ vlo = getTestLaytout();
+ for (int i = components.length / 2; i < components.length; i++) {
+ components[i] = new TextField();
+ ((TextField) components[i]).setValue("FIELD " + i);
+ vlo.addComponent(components[i]);
+ vlo.setComponentAlignment(components[i], alignments[i]);
+ vlo.addComponent(new Label("<hr />", ContentMode.XHTML));
+ }
+ baseLayout.addComponent(vlo);
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getCaptionsTests() {
+ Layout baseLayout = getBaseLayout();
+ VerticalLayout vlo = getTestLaytout();
+ AbstractComponent component = null;
+
+ String[] captions = new String[] {
+ "",
+ "abcdefghijklmnopq",
+ "abc def hij klm nop qrs tuv xyz qaz wsx edc rfv tgb yhn ujm mko nji bhu vgy cft cde" };
+
+ for (int i = 0; i < captions.length; i++) {
+ component = new TextField();
+ ((TextField) component).setValue("FIELD " + i);
+ component.setCaption(captions[i]);
+ vlo.addComponent(component);
+ }
+ for (int i = 0; i < captions.length; i++) {
+ component = new Label();
+ ((Label) component).setValue("Label " + i);
+ component.setCaption(captions[i]);
+ vlo.addComponent(component);
+ }
+ baseLayout.addComponent(vlo);
+ vlo = getTestLaytout();
+ for (int i = 0; i < captions.length; i++) {
+ component = new Select();
+ component.setCaption(captions[i]);
+ component.setIcon(new ThemeResource(LOCK_16_PNG));
+ vlo.addComponent(component);
+ }
+ for (int i = 0; i < captions.length; i++) {
+ component = getTestTabsheet();
+ component.setCaption(captions[i]);
+ component.setComponentError(new UserError(
+ "component error, user error"));
+ vlo.addComponent(component);
+ }
+ baseLayout.addComponent(vlo);
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getComponentAddReplaceMoveTests() {
+ Layout baseLayout = getBaseLayout();
+ final VerticalLayout vlo = getTestLaytout();
+ final VerticalLayout vlo2 = getTestLaytout();
+
+ final HorizontalLayout source = new HorizontalLayout();
+ source.addComponent(new Label("OTHER LABEL 1"));
+ source.addComponent(new Label("OTHER LABEL 2"));
+
+ final AbstractComponent c1 = new Button("BUTTON");
+ final AbstractComponent c2 = new Label("<b>LABEL</b>",
+ ContentMode.XHTML);
+ final AbstractComponent c3 = new Table("TABLE");
+ c3.setHeight("100px");
+ c3.setWidth("100%");
+
+ final Button addButton = new Button("Test add");
+ final Button replaceButton = new Button("Test replace");
+ final Button moveButton = new Button("Test move");
+ final Button removeButton = new Button("Test remove");
+
+ replaceButton.setEnabled(false);
+ moveButton.setEnabled(false);
+ removeButton.setEnabled(false);
+
+ addButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.addComponent(new TextField());
+ addButton.setEnabled(false);
+ replaceButton.setEnabled(true);
+ }
+ });
+ replaceButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.replaceComponent(c1, c3);
+ replaceButton.setEnabled(false);
+ moveButton.setEnabled(true);
+ }
+ });
+ moveButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.moveComponentsFrom(source);
+ moveButton.setEnabled(false);
+ removeButton.setEnabled(true);
+ }
+ });
+ removeButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.removeComponent(c1);
+ vlo2.removeComponent(c2);
+ removeButton.setEnabled(false);
+ }
+ });
+
+ vlo.addComponent(addButton);
+ vlo.addComponent(replaceButton);
+ vlo.addComponent(moveButton);
+ vlo.addComponent(removeButton);
+
+ baseLayout.addComponent(vlo);
+ vlo2.addComponent(c1);
+ vlo2.addComponent(c2);
+ vlo2.addComponent(c3);
+ baseLayout.addComponent(vlo2);
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getComponentSizingTests() {
+ Layout baseLayout = getBaseLayout();
+ final VerticalLayout vlo = getTestLaytout();
+
+ final AbstractComponent c = getTestTable();
+
+ final Button biggerButton = new Button("full size");
+ final Button smallerButton = new Button("200 px width");
+ final Button originalButton = new Button("undefined size and add");
+
+ vlo.addComponent(biggerButton);
+ vlo.addComponent(smallerButton);
+ vlo.addComponent(originalButton);
+ baseLayout.addComponent(vlo);
+ final VerticalLayout vlo2 = getTestLaytout();
+ vlo2.addComponent(c);
+ baseLayout.addComponent(vlo2);
+
+ biggerButton.setEnabled(true);
+ smallerButton.setEnabled(false);
+ originalButton.setEnabled(false);
+
+ biggerButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ c.setSizeFull();
+ biggerButton.setEnabled(false);
+ smallerButton.setEnabled(true);
+ }
+ });
+ smallerButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ c.setWidth("200px");
+ smallerButton.setEnabled(false);
+ originalButton.setEnabled(true);
+ }
+ });
+ originalButton.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ originalButton.setEnabled(false);
+ c.setSizeUndefined();
+ ((Table) c)
+ .addItem(
+ new Object[] { "VYVTCTC VYVYV ECECCE NIDSD SDMPOM" },
+ 3);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getLayoutSizingTests() {
+ Layout baseLayout = getBaseLayout();
+ final VerticalLayout vlo = getTestLaytout();
+
+ vlo.setSpacing(false);
+ vlo.setMargin(false);
+
+ final AbstractComponent c1 = getTestTable();
+ c1.setSizeFull();
+ final AbstractComponent c2 = getTestTable();
+ c2.setSizeFull();
+
+ final Button button1 = new Button("Set fixed height 350px");
+ final Button button2 = new Button(
+ "Set undefined size and add component");
+ final Button button3 = new Button("Set fixed width and height 75%");
+ final Button button4 = new Button("Set size full");
+
+ vlo.addComponent(button1);
+ vlo.addComponent(button2);
+ vlo.addComponent(button3);
+ vlo.addComponent(button4);
+ baseLayout.addComponent(vlo);
+ final VerticalLayout vlo2 = getTestLaytout();
+
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ button4.setEnabled(false);
+
+ vlo2.addComponent(c1);
+ vlo2.addComponent(new Label(
+ "<div style='height: 1px'></div><hr /><div style='height: 1px'></div>",
+ ContentMode.XHTML));
+ vlo2.addComponent(c2);
+ vlo2.setExpandRatio(c1, 0.5f);
+ vlo2.setExpandRatio(c2, 0.5f);
+ baseLayout.addComponent(vlo2);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setHeight("350px");
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setSizeUndefined();
+ Label newLabel = new Label("--- NEW LABEL ---");
+ newLabel.setSizeUndefined();
+ vlo2.addComponent(newLabel);
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setWidth("75%");
+ vlo2.setHeight("75%");
+ button3.setEnabled(false);
+ button4.setEnabled(true);
+ }
+ });
+ button4.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setSizeFull();
+ button4.setEnabled(false);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getExpandRatiosTests() {
+ Layout baseLayout = getBaseLayout();
+ final VerticalLayout vlo = getTestLaytout();
+
+ final AbstractComponent c1 = getTestTable();
+ c1.setSizeFull();
+ final AbstractComponent c2 = getTestTable();
+ c2.setSizeFull();
+
+ final Button button1 = new Button("Expand to 1/undefined");
+ final Button button2 = new Button("Expand to 0.5/0.5");
+ final Button button3 = new Button("Expand to 0.75/0.25");
+
+ vlo.addComponent(button1);
+ vlo.addComponent(button2);
+ vlo.addComponent(button3);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+
+ baseLayout.addComponent(vlo);
+ final VerticalLayout vlo2 = getTestLaytout();
+
+ vlo2.addComponent(c1);
+ vlo2.addComponent(c2);
+ baseLayout.addComponent(vlo2);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setExpandRatio(c1, 1.0f);
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setExpandRatio(c1, 0.5f);
+ vlo2.setExpandRatio(c2, 0.5f);
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setExpandRatio(c1, 0.75f);
+ vlo2.setExpandRatio(c2, 0.25f);
+ button3.setEnabled(false);
+ }
+ });
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getIconsTests() {
+ Layout baseLayout = getBaseLayout();
+ VerticalLayout vlo = getTestLaytout();
+ AbstractComponent[] components = new AbstractComponent[2];
+
+ Resource[] icons = new Resource[] { new ThemeResource(CALENDAR_32_PNG),
+ new ThemeResource(LOCK_16_PNG) };
+
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new TextField();
+ ((TextField) components[i]).setValue("FIELD " + i);
+ components[i].setIcon(icons[i]);
+ components[i]
+ .setCaption("long test caption bewucbwuebco or bmort b cbwecubw wbeucwe asdasd asdasda asdasd");
+ vlo.addComponent(components[i]);
+ }
+
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new Label();
+ ((Label) components[i]).setValue("Label " + i);
+ components[i].setIcon(icons[i]);
+ vlo.addComponent(components[i]);
+ }
+
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new Select();
+ components[i].setIcon(icons[i]);
+ vlo.addComponent(components[i]);
+ }
+ baseLayout.addComponent(vlo);
+ final VerticalLayout vlo2 = getTestLaytout();
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new Button();
+ components[i].setComponentError(new UserError(
+ "component error, user error"));
+ components[i].setIcon(icons[i]);
+ vlo2.addComponent(components[i]);
+ }
+
+ for (int i = 0; i < components.length; i++) {
+ components[i] = new Link("Link", null);
+ components[i].setIcon(icons[i]);
+ vlo2.addComponent(components[i]);
+ }
+ baseLayout.addComponent(vlo2);
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getMarginSpacingTests() {
+ Layout baseLayout = getBaseLayout();
+ final VerticalLayout vlo = getTestLaytout();
+ vlo.setSpacing(false);
+ vlo.setMargin(false);
+
+ final AbstractComponent c1 = getTestTable();
+ c1.setSizeFull();
+ final AbstractComponent c2 = getTestTable();
+ c2.setSizeFull();
+
+ final Button button1 = new Button("Set margin on");
+ final Button button2 = new Button("Set spacing on");
+ final Button button3 = new Button("Set margin off");
+ final Button button4 = new Button("Set spacing off");
+
+ vlo.addComponent(button1);
+ vlo.addComponent(button2);
+ vlo.addComponent(button3);
+ vlo.addComponent(button4);
+ button1.setEnabled(true);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ button4.setEnabled(false);
+
+ baseLayout.addComponent(vlo);
+ final VerticalLayout vlo2 = getTestLaytout();
+
+ vlo2.addComponent(c1);
+ // Must add something around the hr to avoid the margins collapsing
+ vlo2.addComponent(new Label(
+ "<div style='height: 1px'></div><hr /><div style='height: 1px'></div>",
+ ContentMode.XHTML));
+ vlo2.addComponent(c2);
+ vlo2.setExpandRatio(c1, 0.5f);
+ vlo2.setExpandRatio(c2, 0.5f);
+ baseLayout.addComponent(vlo2);
+
+ button1.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setMargin(true);
+ button1.setEnabled(false);
+ button2.setEnabled(true);
+ }
+ });
+ button2.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setSpacing(true);
+ button2.setEnabled(false);
+ button3.setEnabled(true);
+ }
+ });
+ button3.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setMargin(false);
+ button3.setEnabled(false);
+ button4.setEnabled(true);
+ }
+ });
+ button4.addListener(new Button.ClickListener() {
+ private static final long serialVersionUID = 7716267156088629379L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ vlo2.setSpacing(false);
+ button4.setEnabled(false);
+ }
+ });
+
+ return baseLayout;
+ }
+
+ @Override
+ protected Layout getRequiredErrorIndicatorsTests() {
+ Layout baseLayout = getBaseLayout();
+ VerticalLayout vlo = getTestLaytout();
+ AbstractComponent[] components = new AbstractComponent[4];
+ components[0] = new Label("LABEL");
+ components[0].setSizeUndefined();
+ components[1] = new Button("BUTTON");
+ components[2] = getTestTable();
+ components[3] = getTestTabsheet();
+ components[3].setIcon(new ThemeResource(LOCK_16_PNG));
+
+ AbstractField<?>[] fields = new AbstractField<?>[6];
+ fields[0] = new TextField();
+ fields[0].setRequired(true);
+ fields[0].setValidationVisible(true);
+ fields[0].setRequiredError("required error");
+
+ fields[1] = new TextField();
+ fields[1].setValue("TEXTFIELD2");
+ fields[1]
+ .setComponentError(new UserError("component error, user error"));
+
+ fields[2] = new Select();
+ fields[2].setComponentError(new SystemError(
+ "component error, system error"));
+ fields[3] = new DateField();
+ fields[3].setComponentError(new SystemError(
+ "component error, system error"));
+
+ fields[4] = new CheckBox();
+ fields[4]
+ .setComponentError(new UserError("component error, user error"));
+
+ fields[5] = new NativeSelect();
+ fields[5].setRequired(true);
+ fields[5].setValidationVisible(true);
+ fields[5].setRequiredError("required error");
+ fields[5]
+ .setComponentError(new UserError("component error, user error"));
+ fields[5].setIcon(new ThemeResource(CALENDAR_32_PNG));
+
+ for (int i = 0; i < components.length; i++) {
+ components[i].setComponentError(new UserError(
+ "component error, user error"));
+ vlo.addComponent(components[i]);
+ }
+ baseLayout.addComponent(vlo);
+ final VerticalLayout vlo2 = getTestLaytout();
+ for (int i = 0; i < fields.length; i++) {
+ vlo2.addComponent(fields[i]);
+ }
+
+ baseLayout.addComponent(vlo2);
+ return baseLayout;
+ }
+
+ private HorizontalLayout getBaseLayout() {
+ HorizontalLayout hlo = new HorizontalLayout();
+ hlo.setSizeUndefined();
+ return hlo;
+ }
+
+ private VerticalLayout getTestLaytout() {
+ VerticalLayout vlo = new VerticalLayout();
+ vlo.setHeight("500px");
+ vlo.setWidth("400px");
+ return vlo;
+ }
+
+ private AbstractComponent getTestTabsheet() {
+ TabSheet tabsheet = new TabSheet();
+ tabsheet.setSizeUndefined();
+ tabsheet.addTab(new UndefWideLabel("TAB1"), "TAB1", new ThemeResource(
+ GLOBE_16_PNG));
+ tabsheet.addTab(new UndefWideLabel("TAB2"), "TAB2", null);
+ return tabsheet;
+ }
+
+ private Table getTestTable() {
+ Table t = new Table();
+ t.setSizeUndefined();
+ t.setPageLength(5);
+ t.addContainerProperty("test", String.class, null);
+ t.addItem(new Object[] { "qwertyuiop asdfghjköäxccvbnm,m,." }, 1);
+ t.addItem(new Object[] { "YGVYTCTCTRXRXRXRX" }, 2);
+ return t;
+ }
+}