blob: 99a34d7943918c2ff8a62298d8c52be8ca21eea5 (
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
85
86
87
88
89
90
91
92
93
94
95
96
|
package com.vaadin.tests.components.grid;
import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.widgetset.TestingWidgetSet;
import com.vaadin.tests.widgetset.client.EmptyEnum;
import com.vaadin.tests.widgetset.client.SimpleTestBean;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.ui.Label;
@Widgetset(TestingWidgetSet.NAME)
public class CustomRendererUI extends AbstractTestUI {
public static class Data {
private int[] array;
private EmptyEnum emptyProperty;
private SimpleTestBean bean;
private final String id;
public Data(String id) {
this.id = id;
}
public int[] getArray() {
return array;
}
public void setArray(int[] array) {
this.array = array;
}
public EmptyEnum getEmptyProperty() {
return emptyProperty;
}
public void setEmptyProperty(EmptyEnum emptyProperty) {
this.emptyProperty = emptyProperty;
}
public SimpleTestBean getBean() {
return bean;
}
public void setBean(SimpleTestBean bean) {
this.bean = bean;
}
@Override
public String toString() {
return id;
}
}
@Override
protected void setup(VaadinRequest request) {
Data data = new Data("test-data");
data.setArray(new int[] { 1, 1, 2, 3, 5, 8, 13 });
SimpleTestBean bean = new SimpleTestBean();
bean.setValue(42);
data.setBean(bean);
Grid<Data> grid = new Grid<>();
Label debugLabel = new Label("Debug label placeholder");
debugLabel.setId("debuglabel");
grid.addColumn(Data::getArray, new IntArrayRenderer());
grid.addColumn(Data::getEmptyProperty,
new RowAwareRenderer(debugLabel));
grid.addColumn(Data::getBean, new BeanRenderer());
grid.setSelectionMode(SelectionMode.NONE);
grid.setItems(data);
addComponent(grid);
addComponent(debugLabel);
}
@Override
protected String getTestDescription() {
return "Verifies that renderers operating on other data than "
+ "just Strings also work ";
}
@Override
protected Integer getTicketNumber() {
return 13334;
}
}
|