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
114
115
116
117
|
/*
* Copyright 2000-2014 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests;
import java.util.Locale;
import com.vaadin.server.Sizeable;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.DateField;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.Reindeer;
public class TestForBasicApplicationLayout extends CustomComponent {
private final Button click;
private final Button click2;
private final TabSheet tab;
public TestForBasicApplicationLayout() {
click = new Button("Set height -1", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
tab.setHeight(null);
}
});
click2 = new Button("Set height 100%", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
tab.setHeight(100, TabSheet.UNITS_PERCENTAGE);
}
});
final HorizontalSplitPanel sp = new HorizontalSplitPanel();
sp.setSplitPosition(290, Sizeable.UNITS_PIXELS);
final HorizontalSplitPanel sp2 = new HorizontalSplitPanel();
sp2.setSplitPosition(255, Sizeable.UNITS_PIXELS);
VerticalLayout pl = new VerticalLayout();
pl.setMargin(true);
final Panel p = new Panel("Accordion Panel", pl);
p.setSizeFull();
tab = new TabSheet();
tab.setSizeFull();
VerticalLayout reportLayout = new VerticalLayout();
final Panel report = new Panel("Monthly Program Runs", reportLayout);
final VerticalLayout controls = reportLayout;
controls.setMargin(true);
controls.addComponent(new Label("Report tab"));
controls.addComponent(click);
controls.addComponent(click2);
reportLayout.addComponent(controls);
final DateField cal = new DateField();
cal.setResolution(DateField.RESOLUTION_DAY);
cal.setLocale(new Locale("en", "US"));
reportLayout.addComponent(cal);
reportLayout.setExpandRatio(controls, 1);
report.addStyleName(Reindeer.PANEL_LIGHT);
report.setHeight(100, Sizeable.UNITS_PERCENTAGE);
sp2.setFirstComponent(report);
final Table table = TestForTablesInitialColumnWidthLogicRendering
.getTestTable(5, 200);
table.setPageLength(15);
table.setSelectable(true);
table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
table.setColumnCollapsingAllowed(true);
table.setColumnReorderingAllowed(true);
table.setSortDisabled(false);
table.setSizeFull();
table.addStyleName("table-inline");
sp2.setSecondComponent(table);
tab.addTab(new Label("Tab1"), "Summary", null);
tab.addTab(sp2, "Reports", null);
tab.addTab(new Label("Tab 3"), "Statistics", null);
tab.addTab(new Label("Tab 4"), "Error Tracking", null);
tab.setSelectedTab(sp2);
sp.setFirstComponent(p);
sp.setSecondComponent(tab);
setCompositionRoot(sp);
}
}
|