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
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>qooxdoo » Demo » Sample</title>
<link type="text/css" rel="stylesheet" href="../../css/layout.css"/>
<!--[if IE]>
<link type="text/css" rel="stylesheet" href="../../css/layout_ie.css"/>
<![endif]-->
<script type="text/javascript" src="../../script/sample.js"></script>
</head>
<body>
<script type="text/javascript" src="../../script/layout.js"></script>
<div id="demoDescription">
<p>Testing multiple parallel requests of files with different sizes.</p>
</div>
<script type="text/javascript">
qx.core.Init.getInstance().defineMain(function()
{
var lab1 = new qx.ui.basic.Label("40KB");
var lab2 = new qx.ui.basic.Label("400KB");
var spin1 = new qx.ui.form.Spinner(0, 3, 50);
var spin2 = new qx.ui.form.Spinner(0, 3, 20);
var grid = new qx.ui.layout.GridLayout;
grid.setLocation(20, 48);
grid.setDimension("auto", "auto");
grid.setHorizontalSpacing(10);
grid.setVerticalSpacing(4);
grid.setBorder(qx.renderer.border.BorderPresets.getInstance().thinOutset);
grid.setBackgroundColor("white");
grid.setPadding(10);
grid.setColumnCount(2);
grid.setRowCount(2);
grid.setColumnWidth(0, 50);
grid.setColumnWidth(1, 50);
grid.setRowHeight(0, 18);
grid.setRowHeight(1, 22);
qx.ui.core.ClientDocument.getInstance().add(grid);
grid.add(lab1, 0, 0);
grid.add(lab2, 1, 0);
grid.add(spin1, 0, 1);
grid.add(spin2, 1, 1);
var btn = new qx.ui.form.Button("Send", "icon/16/actions/dialog-ok.png");
btn.setLocation(20, 120);
qx.ui.core.ClientDocument.getInstance().add(btn);
var area = new qx.ui.form.TextArea("");
area.setLocation(20, 154);
area.setDimension(192, 400);
qx.ui.core.ClientDocument.getInstance().add(area);
btn.addEventListener("execute", function(e)
{
var s1 = parseInt(spin1.getValue());
var s2 = parseInt(spin2.getValue());
while ((s1+s2) > 0)
{
if (s1 > 0)
{
makeRequest(40);
s1--;
};
if (s2 > 0)
{
makeRequest(400);
s2--;
};
};
});
function makeRequest(size)
{
var req = new qx.io.remote.Request("data/filesize/" + size + "kb.xml", "GET", qx.util.Mime.XML);
req.addEventListener("completed", function(e) {
area.setValue(area.getValue() + "Request " + size + "kb: completed\n");
});
req.addEventListener("failed", function(e) {
area.setValue(area.getValue() + "Request " + size + "kb: failed\n");
});
req.addEventListener("timeout", function(e) {
area.setValue(area.getValue() + "Request " + size + "kb: timeout\n");
});
req.send();
};
});
</script>
</body>
</html>
|