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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
<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="testCommand" class="manualFrame">
<style type="text/css">
#testCommand{
position: absolute;
right: 335px;
bottom: 48px;
width: 350px;
}
.setform select{
font-size: 11px;
min-width: 75px;
}
.setform button{
font-size: 11px;
}
</style>
<table class="setform"><tbody>
<tr>
<td>
<label for="sel_orientation">Orientation:</label>
</td>
<td>
<select id="sel_orientation">
<option selected="selected">horizontal</option>
<option>vertical</option>
</select>
</td>
</tr>
<tr>
<td>Width/Height:</td>
<td>
<select id="sel_width">
<option>100</option>
<option selected="selected">250</option>
<option>500</option>
<option>auto</option>
</select>
<select id="sel_height">
<option>100</option>
<option selected="selected">250</option>
<option>500</option>
<option>auto</option>
</select>
</td>
</tr>
<tr>
<td>Spacing/Padding:</td>
<td>
<select id="sel_spacing">
<option selected="selected">0</option>
<option>2</option>
<option>4</option>
<option>8</option>
</select>
<select id="sel_padding">
<option selected="selected">0</option>
<option>2</option>
<option>4</option>
<option>8</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="sel_order">Order/Stretching:</label>
</td>
<td>
<select id="sel_order">
<option selected="selected">default</option>
<option>reverse</option>
</select>
<select id="sel_stretch">
<option selected="selected">enabled</option>
<option>disabled</option>
</select>
</td>
</tr>
<tr>
<td>Horizontal/Vertical Align:</td>
<td>
<select id="sel_horalg">
<option selected="selected">left</option>
<option>center</option>
<option>right</option>
</select>
<select id="sel_veralg">
<option selected="selected">top</option>
<option>middle</option>
<option>bottom</option>
</select>
</td>
</tr>
<tr>
<td> </td>
<td>
<button id="btn_save">Apply</button>
</td>
</tr>
</tbody></table>
<p><b>Tests</b></p>
<ul>
<li><a href="javascript:test1()">Test 1: Remove blue widget</a></li>
<li><a href="javascript:test2()">Test 2: Add blue widget</a></li>
<li><a href="javascript:test3()">Test 3: Add blue widget at position 2</a></li>
<li><a href="javascript:test4()">Test 4: Add blue widget at position 4</a></li>
<li><a href="javascript:test5()">Test 5: Add green widget at before the cdrom</a></li>
<li><a href="javascript:test6()">Test 6: Add green widget at after the color palette</a></li>
<li><a href="javascript:test7()">Test 7: Add new widget to layout</a></li>
</ul>
</div>
<div id="demoDescription">
<p>Now something more complex. Try to configure multiple things and then press <apply>.</p>
<p>Added initial support for children align override: Try to click on the color palette.</p>
</div>
<script type="text/javascript">
var bl, w1, w2, w3, w4, w5, w6, w7, w8;
var _b = document.getElementById("btn_save");
var _t = document.getElementById("sel_orientation");
var _w = document.getElementById("sel_width");
var _h = document.getElementById("sel_height");
var _s = document.getElementById("sel_spacing");
var _p = document.getElementById("sel_padding");
var _o = document.getElementById("sel_order");
var _r = document.getElementById("sel_stretch");
var _l = document.getElementById("sel_horalg");
var _v = document.getElementById("sel_veralg");
function save()
{
var vt = _t.options[_t.selectedIndex].firstChild.nodeValue;
var vw = _w.options[_w.selectedIndex].firstChild.nodeValue;
var vh = _h.options[_h.selectedIndex].firstChild.nodeValue;
var vs = _s.options[_s.selectedIndex].firstChild.nodeValue;
var vp = _p.options[_p.selectedIndex].firstChild.nodeValue;
var vo = _o.options[_o.selectedIndex].firstChild.nodeValue;
var vr = _r.options[_r.selectedIndex].firstChild.nodeValue;
var vl = _l.options[_l.selectedIndex].firstChild.nodeValue;
var vv = _v.options[_v.selectedIndex].firstChild.nodeValue;
bl.setOrientation(vt);
bl.setWidth(vw == "auto" ? vw : parseInt(vw));
bl.setHeight(vh == "auto" ? vh : parseInt(vh));
bl.setSpacing(parseInt(vs));
bl.setPadding(parseInt(vp));
bl.setReverseChildrenOrder(vo == "reverse");
bl.setStretchChildrenOrthogonalAxis(vr == "enabled");
bl.setHorizontalChildrenAlign(vl);
bl.setVerticalChildrenAlign(vv);
};
if (_b.attachEvent)
_b.attachEvent("onclick", save);
else if (_b.addEventListener)
_b.addEventListener("click", save, false);
function test1()
{
bl.remove(w2);
qx.ui.core.Widget.flushGlobalQueues();
};
function test2()
{
bl.add(w2);
qx.ui.core.Widget.flushGlobalQueues();
};
function test3()
{
bl.addAt(w2, 2);
qx.ui.core.Widget.flushGlobalQueues();
};
function test4()
{
bl.addAt(w2, 4);
qx.ui.core.Widget.flushGlobalQueues();
};
function test5()
{
bl.addBefore(w3, w7);
qx.ui.core.Widget.flushGlobalQueues();
};
function test6()
{
bl.addAfter(w3, w4);
qx.ui.core.Widget.flushGlobalQueues();
};
function test7()
{
bl.addAt(w8, 3);
qx.ui.core.Widget.flushGlobalQueues();
};
qx.core.Init.getInstance().defineMain(function()
{
var d = qx.ui.core.ClientDocument.getInstance();
bl = new qx.ui.layout.BoxLayout("horizontal");
bl.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
bl.setBackgroundColor(new qx.renderer.color.Color("white"));
bl.setWidth(250);
bl.setHeight(250);
bl.setTop(48);
bl.setLeft(20);
w1 = new qx.ui.layout.CanvasLayout;
w1.setBackgroundColor(new qx.renderer.color.Color("orange"));
w1.setMinWidth(20);
w1.setMinHeight(20);
w1.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
w1.setAllowStretchX(false);
w1.setAllowStretchY(false);
w1.setVerticalAlign("middle");
w1.setHorizontalAlign("center");
w2 = new qx.ui.layout.CanvasLayout;
w2.setBackgroundColor(new qx.renderer.color.Color("blue"));
w2.setMinWidth(20);
w2.setMinHeight(20);
w2.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
w2.setAllowStretchX(false);
w2.setHorizontalAlign("center");
w3 = new qx.ui.layout.CanvasLayout;
w3.setBackgroundColor(new qx.renderer.color.Color("green"));
w3.setMinWidth(20);
w3.setMinHeight(20);
w3.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
w3.setAllowStretchY(false);
w3.setVerticalAlign("middle");
w4 = new qx.ui.basic.Image("icon/32/actions/format-color.png");
w4.setVerticalAlign("bottom");
w4.setHorizontalAlign("right");
w5 = new qx.ui.layout.CanvasLayout;
w5.setBackgroundColor(new qx.renderer.color.Color("yellow"));
w5.setMinWidth(20);
w5.setMinHeight(20);
w5.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
w6 = new qx.ui.layout.CanvasLayout;
w6.setBackgroundColor(new qx.renderer.color.Color("red"));
w6.setMinWidth(20);
w6.setMinHeight(20);
w6.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
w7 = new qx.ui.basic.Image("icon/64/devices/media-optical.png");
w7.setVerticalAlign("middle");
w7.setHorizontalAlign("center");
w8 = new qx.ui.layout.CanvasLayout;
w8.setBackgroundColor(new qx.renderer.color.Color("fuchsia"));
w8.setMinWidth(20);
w8.setMinHeight(20);
w8.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
w4.addEventListener("click", function()
{
var h, v;
switch(this.getHorizontalAlign())
{
case "center":
h = "right";
v = "bottom";
break;
case "right":
h = "left";
v = "top";
break;
default:
h = "center";
v = "middle";
};
this.setHorizontalAlign(h);
this.setVerticalAlign(v);
});
bl.add(w1, w2, w3, w4, w5, w6, w7);
d.add(bl);
});
</script>
</body>
</html>
|