blob: bfc6e77b35ae8a8df091d90177825723d7efdcbc (
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
|
package com.vaadin.tests.components.table;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.v7.data.Item;
import com.vaadin.v7.ui.Select;
import com.vaadin.v7.ui.Table;
@SuppressWarnings("serial")
public class ColumnHeaderAlignments extends TestBase {
private static final String BAZ = "Baz (right)";
private static final String BAR = "Bar (center)";
private static final String FOO = "Foo (left)";
private Table fooTable;
private Table barTable;
private Table bazTable;
@Override
protected void setup() {
Select theme = new Select();
theme.addItem("reindeer");
theme.addItem("runo");
theme.addItem("base");
theme.setValue("reindeer");
theme.setNullSelectionAllowed(false);
theme.setImmediate(true);
theme.addValueChangeListener(event -> setTheme(
String.valueOf(event.getProperty().getValue())));
addComponent(theme);
CheckBox footers = new CheckBox("Show footers");
footers.addValueChangeListener(event -> {
boolean visible = event.getValue();
fooTable.setFooterVisible(visible);
barTable.setFooterVisible(visible);
bazTable.setFooterVisible(visible);
});
addComponent(footers);
HorizontalLayout tables = new HorizontalLayout();
fooTable = createTable(null);
tables.addComponent(fooTable);
barTable = createTable("strong");
tables.addComponent(barTable);
bazTable = createTable("black");
tables.addComponent(bazTable);
addComponent(tables);
}
private Table createTable(String style) {
Table table = new Table();
table.addContainerProperty(FOO, String.class, "");
table.addContainerProperty(BAR, String.class, "");
table.addContainerProperty(BAZ, String.class, "");
table.setColumnAlignment(FOO, Table.ALIGN_LEFT);
table.setColumnAlignment(BAR, Table.ALIGN_CENTER);
table.setColumnAlignment(BAZ, Table.ALIGN_RIGHT);
if (style != null) {
table.setStyleName(style);
}
for (int i = 0; i < 100; i++) {
Item item = table.addItem(i);
item.getItemProperty(FOO).setValue("foo");
item.getItemProperty(BAR).setValue("bar");
item.getItemProperty(BAZ).setValue("baz");
}
return table;
}
@Override
protected String getDescription() {
return "Aligned column headers should have style names telling the alignment";
}
@Override
protected Integer getTicketNumber() {
return 5066;
}
}
|