From: Automerge Date: Wed, 23 May 2012 17:07:08 +0000 (+0000) Subject: [merge from 6.7] Test application for #8855 X-Git-Tag: 7.0.0.alpha3~137^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b02102fe98227562f986d421abc999049dfa405d;p=vaadin-framework.git [merge from 6.7] Test application for #8855 svn changeset:23818/svn branch:6.8 --- diff --git a/tests/testbench/com/vaadin/tests/components/gridlayout/GridLayoutInForm.java b/tests/testbench/com/vaadin/tests/components/gridlayout/GridLayoutInForm.java new file mode 100644 index 0000000000..648bbd2d52 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/gridlayout/GridLayoutInForm.java @@ -0,0 +1,78 @@ +package com.vaadin.tests.components.gridlayout; + +import java.util.ArrayList; +import java.util.List; + +import com.vaadin.data.util.ObjectProperty; +import com.vaadin.data.util.PropertysetItem; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Form; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Panel; + +public class GridLayoutInForm extends TestBase { + + @Override + protected void setup() { + final List propertyIds = new ArrayList(); + for (int i = 0; i < 50; i++) { + propertyIds.add("property " + i); + } + + GridLayout gridLayout = new GridLayout(); + gridLayout.setSizeUndefined(); + gridLayout.setColumns(2); + gridLayout.setSpacing(true); + + PropertysetItem item = new PropertysetItem(); + for (String propertyId : propertyIds) { + item.addItemProperty(propertyId, new ObjectProperty( + propertyId)); + } + + final Form form = new Form(gridLayout); + form.setItemDataSource(item); + + form.setSizeUndefined(); + + Panel panel = new Panel(); + panel.addComponent(form); + panel.setHeight("500px"); + + addComponent(panel); + + addComponent(new Button("Use 15 first fields", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + form.setVisibleItemProperties(propertyIds + .subList(0, 15)); + } + })); + addComponent(new Button("Use 15 last fields", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + form.setVisibleItemProperties(propertyIds.subList(35, + 50)); + } + })); + + addComponent(new Button("Use all fields", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + form.setVisibleItemProperties(propertyIds); + } + })); + } + + @Override + protected String getDescription() { + return "Changing the number of visible fields in a Form using a GridLayout with spacing should not cause additional empty space in the end of the GridLayout"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(8855); + } + +}