r21325: delete children in reverse order since the array is manipulated during the...
[Samba/gbeck.git] / webapps / qooxdoo-0.6.3-sdk / frontend / demo / source / html / test / Transport_5.html
blob4fa0734abdee22c2b6669f26bda7f2d3e3cb49e5
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>qooxdoo &raquo; Demo</title>
5 <link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/>
6 <!--[if IE]>
7 <link type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/>
8 <![endif]-->
9 <script type="text/javascript" src="../../script/qx.js"></script>
10 </head>
11 <body>
12 <script type="text/javascript" src="../../script/layout.js"></script>
14 <div id="demoDescription">
15 <p>Simple test for qooxdoo's transport implementation using some data for an addressbook.</p>
16 <p>Using html content in this case.</p>
17 </div>
19 <script type="text/javascript">
20 qx.core.Init.getInstance().defineMain(function()
22 var d = qx.ui.core.ClientDocument.getInstance();
24 var lay = new qx.ui.layout.VerticalBoxLayout;
25 lay.setLocation(20, 48);
26 lay.setRight(335);
27 lay.setBottom(48);
28 qx.ui.core.ClientDocument.getInstance().add(lay);
32 var fsq = new qx.ui.groupbox.GroupBox("Request");
33 fsq.setHeight("auto");
34 lay.add(fsq);
37 var hlay = new qx.ui.layout.HorizontalBoxLayout;
38 hlay.setVerticalChildrenAlign("middle");
39 hlay.setSpacing(4);
40 hlay.auto();
41 fsq.add(hlay);
44 var cm1 = new qx.ui.form.ComboBox();
45 cm1.add(new qx.ui.form.ListItem("data/persons/anita.html"));
46 cm1.add(new qx.ui.form.ListItem("data/persons/harald.html"));
47 cm1.add(new qx.ui.form.ListItem("data/persons/lisbeth.html"));
48 cm1.add(new qx.ui.form.ListItem("data/persons/paul.html"));
49 cm1.setSelected(cm1.getList().getFirstChild());
50 cm1.setWidth(200);
51 cm1.addEventListener("changeSelected", upd);
53 hlay.add(cm1);
57 var async = new qx.ui.form.CheckBox("Async");
58 async.setChecked(true);
59 hlay.add(async);
62 var spin = new qx.ui.form.Spinner(1);
63 hlay.add(spin);
67 var btn = new qx.ui.form.Button("Send", "icon/16/apply.png");
68 btn.addEventListener("execute", upd);
69 hlay.add(btn);
72 var inf = new qx.ui.form.TextField("State");
73 inf.setWidth(80);
74 inf.setReadOnly(true);
75 hlay.add(inf);
78 var code = new qx.ui.form.TextField("Code");
79 code.setWidth(30);
80 code.setReadOnly(true);
81 hlay.add(code);
84 var typ = new qx.ui.form.TextField("Type");
85 typ.setWidth(80);
86 typ.setReadOnly(true);
87 hlay.add(typ);
90 var len = new qx.ui.form.TextField("Length");
91 len.setWidth(50);
92 len.setReadOnly(true);
93 hlay.add(len);
96 var checken = new qx.ui.form.CheckBox("enabled");
97 checken.setChecked(true);
98 hlay.add(checken);
100 checken.addEventListener("changeChecked", function(e) {
101 qx.io.remote.RequestQueue.getInstance().setEnabled(e.getData());
108 var fsr = new qx.ui.groupbox.GroupBox("Result");
109 fsr.setHeight("1*");
110 lay.add(fsr);
112 var area = new qx.ui.embed.HtmlEmbed("&#160;");
113 area.setDimension("100%", "100%");
114 fsr.add(area);
125 function upd(e)
127 var val = cm1.getSelected();
129 if (!val) {
130 return;
133 var req;
134 for( var i=0, max=parseInt(spin.getValue()); i<max; i++ )
136 req = new qx.io.remote.Request(val.getLabel(), "GET", "text/html");
138 req.setAsynchronous(async.getChecked());
139 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
141 req.setParameter("test1", "value1");
142 req.setParameter("test2", "value2");
143 req.setParameter("test3", "value3");
145 // Force to testing iframe implementation
146 // req.setCrossDomain(true);
148 req.addEventListener("sending", function(e) {
149 inf.setValue("Sending");
152 req.addEventListener("receiving", function(e) {
153 inf.setValue("Receiving");
156 req.addEventListener("completed", function(e)
158 inf.setValue("Completed");
159 typ.setValue(e.getData().getResponseHeader("Content-Type"));
160 len.setValue(e.getData().getResponseHeader("Content-Length"));
161 code.setValue(e.getData().getStatusCode().toString());
162 area.setHtml(e.getData().getContent());
165 req.addEventListener("failed", function(e)
167 inf.setValue("Failed");
168 typ.setValue(e.getData().getResponseHeader("Content-Type"));
169 len.setValue(e.getData().getResponseHeader("Content-Length"));
170 code.setValue(e.getData().getStatusCode().toString());
171 area.setHtml(e.getData().getContent());
174 req.addEventListener("timeout", function(e)
176 inf.setValue("Timeout");
177 typ.setValue(e.getData().getResponseHeader("Content-Type"));
178 len.setValue(e.getData().getResponseHeader("Content-Length"));
179 code.setValue(e.getData().getStatusCode().toString());
180 area.setHtml(e.getData().getContent());
183 req.addEventListener("aborted", function(e)
185 inf.setValue("Aborted");
186 typ.setValue(e.getData().getResponseHeader("Content-Type"));
187 len.setValue(e.getData().getResponseHeader("Content-Length"));
188 code.setValue(e.getData().getStatusCode().toString());
189 area.setHtml(e.getData().getContent());
192 req.send();
196 </script>
197 </body>
198 </html>