r20445: add README file indicating that the swat directory is no longer relevant
[samba.git] / swat / apps / qooxdoo-examples / test / BoxLayout_1.html
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>
13
14   <div id="testCommand" class="manualFrame">
15     <style type="text/css">
16       #testCommand{
17         position: absolute;
18         right: 335px;
19         bottom: 48px;
20         width: 350px;
21       }
22     
23       .setform select{
24         font-size: 11px;
25         min-width: 75px;
26       }
27
28       .setform button{
29         font-size: 11px;
30       }
31     </style>
32
33     <table class="setform"><tbody>
34
35     <tr>
36       <td>
37         <label for="sel_orientation">Orientation:</label>
38       </td>
39       <td>
40         <select id="sel_orientation">
41           <option selected="selected">horizontal</option>
42           <option>vertical</option>
43         </select>
44       </td>
45     </tr>
46
47     <tr>
48       <td>Width/Height:</td>
49       <td>
50         <select id="sel_width">
51           <option>100</option>
52           <option selected="selected">250</option>
53           <option>500</option>
54           <option>auto</option>
55         </select>
56         <select id="sel_height">
57           <option>100</option>
58           <option selected="selected">250</option>
59           <option>500</option>          
60           <option>auto</option>
61         </select>
62       </td>
63     </tr>
64
65     <tr>
66       <td>Spacing/Padding:</td>
67       <td>
68         <select id="sel_spacing">
69           <option selected="selected">0</option>
70           <option>2</option>
71           <option>4</option>
72           <option>8</option>
73         </select>
74         <select id="sel_padding">
75           <option selected="selected">0</option>
76           <option>2</option>
77           <option>4</option>
78           <option>8</option>
79         </select>
80       </td>
81     </tr>
82
83     <tr>
84       <td>
85         <label for="sel_order">Order/Stretching:</label>
86       </td>
87       <td>
88         <select id="sel_order">
89           <option selected="selected">default</option>
90           <option>reverse</option>
91         </select>
92         <select id="sel_stretch">
93           <option selected="selected">enabled</option>
94           <option>disabled</option>
95         </select>
96       </td>
97     </tr>
98
99     <tr>
100       <td>Horizontal/Vertical Align:</td>
101       <td>
102         <select id="sel_horalg">
103           <option selected="selected">left</option>
104           <option>center</option>
105           <option>right</option>
106         </select>
107         <select id="sel_veralg">
108           <option selected="selected">top</option>
109           <option>middle</option>
110           <option>bottom</option>
111         </select>
112       </td>
113     </tr>
114
115     <tr>
116       <td>&#160;</td>
117       <td>
118         <button id="btn_save">Apply</button>
119       </td>
120     </tr>
121
122     </tbody></table>  
123     
124     <p><b>Tests</b></p>
125     <ul>
126       <li><a href="javascript:test1()">Test 1: Remove blue widget</a></li>
127       <li><a href="javascript:test2()">Test 2: Add blue widget</a></li>
128       <li><a href="javascript:test3()">Test 3: Add blue widget at position 2</a></li>
129       <li><a href="javascript:test4()">Test 4: Add blue widget at position 4</a></li>
130       <li><a href="javascript:test5()">Test 5: Add green widget at before the cdrom</a></li>
131       <li><a href="javascript:test6()">Test 6: Add green widget at after the color palette</a></li>
132       <li><a href="javascript:test7()">Test 7: Add new widget to layout</a></li>
133     </ul>
134   </div>
135
136   <div id="demoDescription">
137     <p>Now something more complex. Try to configure multiple things and then press &lt;apply&gt;.</p>
138   </div>
139
140   <script type="text/javascript">
141
142   var bl, w1, w2, w3, w4, w5, w6, w7, w8;
143
144   var _b = document.getElementById("btn_save");
145   var _t = document.getElementById("sel_orientation");
146   var _w = document.getElementById("sel_width");
147   var _h = document.getElementById("sel_height");
148   var _s = document.getElementById("sel_spacing");
149   var _p = document.getElementById("sel_padding");
150   var _o = document.getElementById("sel_order");
151   var _r = document.getElementById("sel_stretch");
152   var _l = document.getElementById("sel_horalg");
153   var _v = document.getElementById("sel_veralg");
154
155   function save()
156   {
157     var vt = _t.options[_t.selectedIndex].firstChild.nodeValue;
158     var vw = _w.options[_w.selectedIndex].firstChild.nodeValue;
159     var vh = _h.options[_h.selectedIndex].firstChild.nodeValue;
160     var vs = _s.options[_s.selectedIndex].firstChild.nodeValue;
161     var vp = _p.options[_p.selectedIndex].firstChild.nodeValue;
162     var vo = _o.options[_o.selectedIndex].firstChild.nodeValue;
163     var vr = _r.options[_r.selectedIndex].firstChild.nodeValue;
164     var vl = _l.options[_l.selectedIndex].firstChild.nodeValue;
165     var vv = _v.options[_v.selectedIndex].firstChild.nodeValue;
166     
167     bl.setOrientation(vt);
168     bl.setWidth(vw == "auto" ? vw : parseInt(vw));
169     bl.setHeight(vh == "auto" ? vh : parseInt(vh));
170     bl.setSpacing(parseInt(vs));
171     bl.setPadding(parseInt(vp));
172     bl.setReverseChildrenOrder(vo == "reverse");
173     bl.setStretchChildrenOrthogonalAxis(vr == "enabled");
174     bl.setHorizontalChildrenAlign(vl);
175     bl.setVerticalChildrenAlign(vv);
176   };
177
178   if (_b.attachEvent)
179     _b.attachEvent("onclick", save);
180   else if (_b.addEventListener)
181     _b.addEventListener("click", save, false);
182     
183     
184   function test1() 
185   {
186     bl.remove(w2);
187     qx.ui.core.Widget.flushGlobalQueues();
188   };  
189   
190   function test2() 
191   {
192     bl.add(w2);
193     qx.ui.core.Widget.flushGlobalQueues();
194   };
195   
196   function test3() 
197   {
198     bl.addAt(w2, 2);
199     qx.ui.core.Widget.flushGlobalQueues();
200   };  
201
202   function test4() 
203   {
204     bl.addAt(w2, 4);
205     qx.ui.core.Widget.flushGlobalQueues();
206   };  
207
208   function test5() 
209   {
210     bl.addBefore(w3, w7);
211     qx.ui.core.Widget.flushGlobalQueues();
212   };  
213
214   function test6() 
215   {
216     bl.addAfter(w3, w4);
217     qx.ui.core.Widget.flushGlobalQueues();
218   }; 
219   
220   function test7() 
221   {
222     bl.addAt(w8, 1);
223     qx.ui.core.Widget.flushGlobalQueues();
224   };
225
226   qx.core.Init.getInstance().defineMain(function()
227   {
228     var d = qx.ui.core.ClientDocument.getInstance();
229
230     bl = new qx.ui.layout.BoxLayout("horizontal");
231     bl.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
232     bl.setBackgroundColor(new qx.renderer.color.Color("white"));
233     bl.setWidth(250);
234     bl.setHeight(250);
235     bl.setTop(48);
236     bl.setLeft(20);
237
238     w1 = new qx.ui.layout.CanvasLayout;
239     w1.setBackgroundColor(new qx.renderer.color.Color("orange"));
240     w1.setMinWidth(20);
241     w1.setMinHeight(20);
242     w1.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
243
244     w2 = new qx.ui.layout.CanvasLayout;
245     w2.setBackgroundColor(new qx.renderer.color.Color("blue"));
246     w2.setMinWidth(20);
247     w2.setMinHeight(20);
248     w2.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
249
250     w3 = new qx.ui.layout.CanvasLayout;
251     w3.setBackgroundColor(new qx.renderer.color.Color("green"));
252     w3.setMinWidth(20);
253     w3.setMinHeight(20);
254     w3.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
255     
256     w4 = new qx.ui.basic.Image("icon/32/colors.png");
257
258     w5 = new qx.ui.layout.CanvasLayout;
259     w5.setBackgroundColor(new qx.renderer.color.Color("yellow"));
260     w5.setMinWidth(20);
261     w5.setMinHeight(20);
262     w5.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
263
264     w6 = new qx.ui.layout.CanvasLayout;
265     w6.setBackgroundColor(new qx.renderer.color.Color("red"));
266     w6.setMinWidth(20);
267     w6.setMinHeight(20);
268     w6.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
269     
270     w7 = new qx.ui.basic.Image("icon/64/cdrom.png");
271     
272     w8 = new qx.ui.layout.CanvasLayout;
273     w8.setBackgroundColor(new qx.renderer.color.Color("fuchsia"));
274     w8.setMinWidth(20);
275     w8.setMinHeight(20);
276     w8.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
277
278     bl.add(w1, w2, w3, w4, w5, w6, w7);
279     d.add(bl);
280   });
281   </script>
282 </body>
283 </html>