blob: 8b65bc6b0ded6f409618c53ec3936d4d43399409 (
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
|
package com.vaadin.tests.tickets;
import com.vaadin.Application;
import com.vaadin.data.util.MethodProperty;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.CellStyleGenerator;
import com.vaadin.ui.Table.ColumnGenerator;
import com.vaadin.ui.UI.LegacyWindow;
public class Ticket2125 extends Application {
@Override
public void init() {
setMainWindow(new MainWindow("Ticket2125"));
}
class MainWindow extends LegacyWindow {
MainWindow(String caption) {
super(caption);
addComponent(new Label(
"Inspect w/ Firebug: row 5 should have a MYROW -style on the row, and MYCELL on all cells"));
Table table = new Table();
table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
addComponent(table);
for (int i = 0; i < 50; i++) {
table.addItem(new Integer(i));
}
table.addContainerProperty("String", String.class, "a string");
table.addContainerProperty("Boolean", Boolean.class, Boolean.TRUE);
table.addGeneratedColumn("Generated", new ColumnGenerator() {
@Override
public Component generateCell(Table source, Object itemId,
Object columnId) {
return new Label("Item " + itemId);
}
});
table.setCellStyleGenerator(new CellStyleGenerator() {
@Override
public String getStyle(Table source, Object itemId,
Object propertyId) {
if (new Integer(4).equals(itemId)) {
if (propertyId == null) {
return "MYROW";
} else {
return "MYCELL";
}
}
return null;
}
});
CheckBox b = new CheckBox("editmode", new MethodProperty<Boolean>(
table, "editable"));
b.setImmediate(true);
addComponent(b);
}
}
}
|