blob: 001b2fe79b8c95364a5691e79d2750a20d0f5ea9 (
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
|
package com.vaadin.tests.components.table;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
import com.vaadin.v7.data.Property;
import com.vaadin.v7.ui.Table;
public class TableCacheBuildEfficiency extends TestBase {
@Override
protected String getDescription() {
return "On each add, row property values should be queried only once (one log row for first addition).";
}
@Override
protected Integer getTicketNumber() {
return 4299;
}
@Override
protected void setup() {
final CssLayout log = new CssLayout();
log.setWidth("100%");
final Table table = new Table() {
@Override
public Property<?> getContainerProperty(Object itemId,
Object propertyId) {
log("Fetched container property \"" + propertyId
+ "\" for item \"" + itemId + "\"");
return super.getContainerProperty(itemId, propertyId);
}
private void log(String string) {
log.addComponent(new Label(string));
}
};
table.addContainerProperty("foo", String.class, "bar");
Button b = new Button("Click to add row", event -> table.addItem());
getLayout().addComponent(table);
getLayout().addComponent(b);
getLayout().addComponent(log);
}
}
|