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
|
/*
@ITMillApache2LicenseForJavaFiles@
*/
package com.itmill.toolkit.automatedtests.featurebrowser;
import com.itmill.toolkit.ui.CustomComponent;
import com.itmill.toolkit.ui.GridLayout;
import com.itmill.toolkit.ui.HorizontalLayout;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.Panel;
import com.itmill.toolkit.ui.TabSheet;
import com.itmill.toolkit.ui.VerticalLayout;
/**
* A few examples of layout possibilities.
*
* @author IT Mill Ltd.
*/
public class LayoutExample extends CustomComponent {
public LayoutExample() {
final VerticalLayout main = new VerticalLayout();
main.setMargin(true);
setCompositionRoot(main);
final GridLayout g = new GridLayout(2, 5);
g.setWidth("100%");
main.addComponent(g);
// panel
Panel p = new Panel("This is a normal panel");
p.setDebugId("NormalPanel");
Label l = new Label("A normal panel.");
p.addComponent(l);
g.addComponent(p);
// lightpanel
p = new Panel("This is a light panel");
p.setDebugId("LightPanel");
p.setStyleName(Panel.STYLE_LIGHT);
l = new Label("A light-style panel.");
p.addComponent(l);
g.addComponent(p);
TabSheet ts = new TabSheet();
g.addComponent(ts, 0, 1, 1, 1);
VerticalLayout ol = new VerticalLayout();
ol.setDebugId("VerticalOrderedLayout");
ol.setMargin(true);
ol.addComponent(new Label("Component 1"));
ol.addComponent(new Label("Component 2"));
ol.addComponent(new Label("Component 3"));
ts.addTab(ol, "Vertical OrderedLayout", null);
HorizontalLayout hl = new HorizontalLayout();
hl.setDebugId("HorizontalOrderedLayout");
hl.setMargin(true);
hl.addComponent(new Label("Component 1"));
hl.addComponent(new Label("Component 2"));
hl.addComponent(new Label("Component 3"));
ts.addTab(hl, "Horizontal OrderedLayout", null);
final GridLayout gl = new GridLayout(3, 3);
gl.setDebugId("GridLayout");
gl.setMargin(true);
gl.addComponent(new Label("Component 1.1"));
gl.addComponent(new Label("Component 1.2"));
gl.addComponent(new Label("Component 1.3"));
gl.addComponent(new Label("Component 2.2"), 1, 1);
gl.addComponent(new Label("Component 3.1"), 0, 2);
gl.addComponent(new Label("Component 3.3"), 2, 2);
ts.addTab(gl, "GridLayout", null);
/*- TODO spitpanel removed for now - do we need it here?
ts = new TabSheet();
ts.setHeight(150);
g.addComponent(ts, 0, 2, 1, 2);
SplitPanel sp = new SplitPanel();
sp.addComponent(new Label("Component 1"));
sp.addComponent(new Label("Component 2"));
ts.addTab(sp, "Vertical SplitPanel", null);
sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
sp.addComponent(new Label("Component 1"));
sp.addComponent(new Label("Component 2"));
ts.addTab(sp, "Horizontal SplitPanel", null);
-*/
}
}
|