blob: e8261ec183fb37171102d5e03a29a832250a6507 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
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;
import com.vaadin.ui.VerticalLayout;
public class GridLayoutInForm extends TestBase {
@Override
protected void setup() {
final List<String> propertyIds = new ArrayList<String>();
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<String>(
propertyId));
}
final Form form = new Form(gridLayout);
form.setItemDataSource(item);
form.setSizeUndefined();
VerticalLayout panelLayout = new VerticalLayout();
panelLayout.setMargin(true);
Panel panel = new Panel(panelLayout);
panelLayout.addComponent(form);
panel.setHeight("500px");
addComponent(panel);
addComponent(new Button("Use 15 first fields",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
form.setVisibleItemProperties(propertyIds
.subList(0, 15));
}
}));
addComponent(new Button("Use 15 last fields",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
form.setVisibleItemProperties(propertyIds.subList(35,
50));
}
}));
addComponent(new Button("Use all fields", new Button.ClickListener() {
@Override
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);
}
}
|