blob: fd2a8ffb4944921918b7d29232413d6b8d4f8bfe (
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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
|
package com.itmill.toolkit.tests;
import com.itmill.toolkit.Application;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.OptionGroup;
import com.itmill.toolkit.ui.OrderedLayout;
import com.itmill.toolkit.ui.Panel;
import com.itmill.toolkit.ui.Window;
import com.itmill.toolkit.ui.Button.ClickEvent;
import com.itmill.toolkit.ui.Button.ClickListener;
public class ScrollbarStressTest extends Application {
final Window main = new Window("Scrollbar Stress Test");
final Panel panel = new Panel("Panel");
final Window subwindow = new Window("Subwindow");
final OptionGroup width = new OptionGroup("Width");
final OptionGroup height = new OptionGroup("Height");
@Override
public void init() {
setTheme("tests-tickets");
setMainWindow(main);
createControlWindow();
subwindow.setWidth("400px");
subwindow.setHeight("400px");
}
private void createControlWindow() {
final OptionGroup context = new OptionGroup("Context");
context.addItem("Main window");
context.addItem("Subwindow");
context.addItem("Panel");
context.setValue("Main window");
width.addItem("100%");
width.addItem("50%");
width.addItem("150%");
width.addItem("100px");
width.addItem("500px");
width.setValue("100%");
height.addItem("100%");
height.addItem("50%");
height.addItem("150%");
height.addItem("100px");
height.addItem("500px");
height.setValue("100%");
final Button set = new Button("Set", new ClickListener() {
public void buttonClick(ClickEvent event) {
if (context.getValue() == "Main window") {
drawInMainWindow();
} else if (context.getValue() == "Subwindow") {
drawInSubwindow();
} else if (context.getValue() == "Panel") {
drawInPanel();
}
}
});
OrderedLayout ol = new OrderedLayout(
OrderedLayout.ORIENTATION_HORIZONTAL);
ol.addComponent(context);
ol.addComponent(width);
ol.addComponent(height);
ol.addComponent(set);
ol.setSpacing(true);
ol.setMargin(true);
Window controller = new Window("Controller");
controller.setLayout(ol);
main.addWindow(controller);
}
private void drawInPanel() {
main.removeAllComponents();
OrderedLayout ol = new OrderedLayout();
panel.setLayout(ol);
ol = new OrderedLayout();
panel.setSizeFull();
panel.setLayout(ol);
ol.setSizeFull();
ol.setWidth((String) width.getValue());
ol.setHeight((String) height.getValue());
Label l = new Label("Label");
l.setStyleName("no-padding");
l.setSizeFull();
ol.addComponent(l);
main.addComponent(panel);
main.removeWindow(subwindow);
}
private void drawInSubwindow() {
main.removeAllComponents();
OrderedLayout ol = new OrderedLayout();
ol.setWidth((String) width.getValue());
ol.setHeight((String) height.getValue());
Label l = new Label("Label");
l.setStyleName("no-padding");
l.setSizeFull();
ol.addComponent(l);
subwindow.setLayout(ol);
main.addWindow(subwindow);
}
private void drawInMainWindow() {
main.removeAllComponents();
OrderedLayout ol = new OrderedLayout();
main.setLayout(ol);
ol.setWidth((String) width.getValue());
ol.setHeight((String) height.getValue());
Label l = new Label("Label");
l.setStyleName("no-padding");
l.setSizeFull();
ol.addComponent(l);
main.removeWindow(subwindow);
}
}
|