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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
package com.vaadin.tests.components.table;
import java.net.MalformedURLException;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.Align;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.Reindeer;
public class TableInTabsheet extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
VerticalLayout vPrinc = new VerticalLayout();
vPrinc.setStyleName(Reindeer.LAYOUT_BLUE);
vPrinc.addComponent(title());
vPrinc.addComponent(page());
vPrinc.addComponent(new Label("Dvlop Tecnologia."));
setContent(vPrinc);
}
private VerticalLayout title() {
VerticalLayout vP = new VerticalLayout();
vP.setStyleName(Reindeer.LAYOUT_BLACK);
Label tit = new Label("<h1> Tab/Table Test</h1>", ContentMode.HTML);
vP.addComponent(tit);
return vP;
}
private VerticalLayout page() {
VerticalLayout vP = new VerticalLayout();
vP.setStyleName(Reindeer.LAYOUT_BLUE);
TabSheet t = new TabSheet();
t.setWidth(1000, Unit.PIXELS);
HorizontalLayout hP = new HorizontalLayout();
t.addTab(Ranking(), "Ranking");
try {
t.addTab(GDocs(""), "Dez 2011");
t.addTab(GDocs(""), "Jan 2012");
t.addTab(GDocs(""), "Abr 2012");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
hP.addComponent(t);
vP.addComponent(hP);
return vP;
}
private AbsoluteLayout Ranking() {
AbsoluteLayout vT = new AbsoluteLayout();
vT.setHeight(500, Unit.PIXELS);
vT.setWidth(900, Unit.PIXELS);
vT.setStyleName(Reindeer.LAYOUT_BLUE);
final Table table = new Table("Ranking Oficial");
table.addContainerProperty("Atleta", String.class, null);
table.addContainerProperty("P", String.class, null);
table.addContainerProperty("Dez/11", Integer.class, null);
table.setColumnAlignment("Dez/11", Align.CENTER);
table.addContainerProperty("Jan/12", Integer.class, null);
table.setColumnAlignment("Jan/12", Align.CENTER);
table.addContainerProperty("Abr/12", String.class, null);
table.addContainerProperty("Total", Integer.class, null);
table.setColumnAlignment("Total", Align.CENTER);
table.addItem(new Object[] { "Araujo", "D.1", 8, 8, " ", 16 }, 1);
table.addItem(new Object[] { "Claudio", "D.2", 2, 10, " ", 12 }, 2);
table.setPageLength(12);
vT.addComponent(table, "left: 50px; top: 50px;");
return vT;
}
private VerticalLayout GDocs(String end) throws MalformedURLException {
VerticalLayout vT = new VerticalLayout();
vT.setHeight(500, Unit.PIXELS);
vT.setWidth(900, Unit.PIXELS);
return vT;
}
@Override
protected String getTestDescription() {
return "Chaning to a different tab and then back to the first tab should properly render the table.";
}
@Override
protected Integer getTicketNumber() {
return Integer.valueOf(8714);
}
}
|