summaryrefslogtreecommitdiff
path: root/swat.obsolete/apps/qooxdoo-examples/test/FlowLayout_3.html
blob: 99c27e13bb1a6957e27fba70f4e5a4b01cb1afc3 (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
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
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>qooxdoo &raquo; Demo</title>
  <link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/>
  <!--[if IE]>
  <link type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/>
  <![endif]-->
  <script type="text/javascript" src="../../script/qx.js"></script>
</head>
<body>
  <script type="text/javascript" src="../../script/layout.js"></script>

  <div id="demoDescription">
    Tests for the new implementation of the qx.ui.layout.FlowLayout widget.
  </div>

  <script type="text/javascript">
  qx.core.Init.getInstance().defineMain(function()
  {
    var d = qx.ui.core.ClientDocument.getInstance();



    var flow1 = new qx.ui.layout.FlowLayout;

    flow1.setTop(48);
    flow1.setLeft(20);
    flow1.setRight(335);
    // flow1.setWidth("auto");
    flow1.setHeight("auto");

    flow1.setBorder(qx.renderer.border.BorderPresets.getInstance().groove);
    flow1.setPadding(8);

    flow1.setHorizontalSpacing(4);
    flow1.setVerticalSpacing(4);
    
    // flow1.setReverseChildrenOrder(true);
    
    d.add(flow1);

    
    
    var w1 = new qx.ui.basic.Terminator;
    
    w1.setBackgroundColor("orange");
    w1.setWidth(300);
    w1.setHeight(20);
    
    
    var w2 = new qx.ui.basic.Terminator;
    
    w2.setBackgroundColor("blue");
    w2.setWidth(200);
    w2.setHeight(50);


    var w3 = new qx.ui.basic.Terminator;
    
    w3.setBackgroundColor("green");
    w3.setWidth(100);
    w3.setHeight(150);
    w3.setMarginLeft(20);

    var w4 = new qx.ui.basic.Terminator;
    
    w4.setBackgroundColor("purple");
    w4.setWidth(100);
    w4.setHeight(20);
    
    var w5 = new qx.ui.basic.Terminator;
    
    w5.setBackgroundColor("yellow");
    w5.setWidth(50);
    w5.setHeight(80);
    
    var w6 = new qx.ui.basic.Terminator;
    
    w6.setBackgroundColor("red");
    w6.setWidth(400);
    w6.setHeight(50);     
    
    var i1 = new qx.ui.basic.Image("icon/32/clock.png");
    var i2 = new qx.ui.basic.Image("icon/32/colors.png");
    
    i2.setResizeToInner(true);
       
    var c1 = new qx.ui.basic.Label("Hello World");
    var c2 = new qx.ui.basic.Label("<ol><li>Simple HTML List</li><li>with one</li><li>and another item</li></ol>");
    
    var a1 = new qx.ui.form.Button("Press", "icon/16/bell.png");


    flow1.add(w1, i1, w2, w3, a1, c2, w4, i2, w5, c1, w6);
    
    
    
    
    
    w1.addEventListener("click", function(e) {
      this.setMaxWidth(this.getMaxWidth() == 50 ? null : 50);
    });
    
    w2.addEventListener("click", function(e)
    {
      if (this.getWidth() == 200)
      {
        this.setWidth(100); 
        this.setHeight(200);
      }
    else
      {
        this.setWidth(200);
        this.setHeight(50);
      };
    });
    
    i1.addEventListener("click", function(e) {
      this.setSource(this.getSource() == "icon/32/clock.png" ? "icon/128/clock.png" : "icon/32/clock.png");
    });
    
    i2.addEventListener("click", function(e)
    {
      this.setWidth(this.getWidth() == "auto" ? 128 : "auto");
      this.setHeight(this.getHeight() == "auto" ? 128 : "auto");
    });
    
    c1.addEventListener("click", function(e) {
      this.setHtml(this.getHtml() == "Hello World" ? "Yeah, qooxdoo is great" : "Hello World");
    });
    
    
    
    
    // *************************************************************
    
    var controlBox = new qx.ui.layout.VerticalBoxLayout;
    
    controlBox.setLeft(20);
    controlBox.setBottom(48);
    controlBox.setRight(335);
    controlBox.setHeight("auto");
    controlBox.setBorder(qx.renderer.border.BorderPresets.getInstance().groove);
    controlBox.setSpacing(4);
    controlBox.setPadding(8);
    
    d.add(controlBox);
    
    
    
    
    var cc0 = new qx.ui.basic.Label("Spacing: ");
    cc0.setWidth(50);
    
    var bc0 = new qx.ui.form.Button("0x0", "icon/16/button-ok.png");
    var bc1 = new qx.ui.form.Button("4x4", "icon/16/button-ok.png");
    var bc2 = new qx.ui.form.Button("8x8", "icon/16/button-ok.png");
    var bc3 = new qx.ui.form.Button("20x20", "icon/16/button-ok.png");
    var bc4 = new qx.ui.form.Button("0x10", "icon/16/button-ok.png");
    var bc5 = new qx.ui.form.Button("10x0", "icon/16/button-ok.png");
    
    bc0.addEventListener("execute", function(e) {
      flow1.setHorizontalSpacing(0);
      flow1.setVerticalSpacing(0);
    });

    bc1.addEventListener("execute", function(e) {
      flow1.setHorizontalSpacing(4);
      flow1.setVerticalSpacing(4);
    });

    bc2.addEventListener("execute", function(e) {
      flow1.setHorizontalSpacing(8);
      flow1.setVerticalSpacing(8);
    });

    bc3.addEventListener("execute", function(e) {
      flow1.setHorizontalSpacing(20);
      flow1.setVerticalSpacing(20);
    });

    bc4.addEventListener("execute", function(e) {
      flow1.setHorizontalSpacing(0);
      flow1.setVerticalSpacing(10);
    });

    bc5.addEventListener("execute", function(e) {
      flow1.setHorizontalSpacing(10);
      flow1.setVerticalSpacing(0);
    });
    
    var hc0 = new qx.ui.layout.HorizontalBoxLayout;
    
    hc0.add(cc0, bc0, bc1, bc2, bc3, bc4, bc5);
    hc0.setVerticalChildrenAlign("middle");
    hc0.setHeight("auto");
    
    controlBox.add(hc0);
    
    
    
    
    
    
    var cr0 = new qx.ui.basic.Label("Order: ");
    cr0.setWidth(50);
    
    var br0 = new qx.ui.form.Button("Default", "icon/16/button-ok.png");
    var br1 = new qx.ui.form.Button("Reversed", "icon/16/button-ok.png");    
    
    br0.addEventListener("execute", function(e) {
      flow1.setReverseChildrenOrder(false);
    });
    
    br1.addEventListener("execute", function(e) {
      flow1.setReverseChildrenOrder(true);
    });   
    
    
    
    var hc1 = new qx.ui.layout.HorizontalBoxLayout;
    
    hc1.add(cr0, br0, br1);
    hc1.setVerticalChildrenAlign("middle");
    hc1.setHeight("auto");
    
    controlBox.add(hc1);
    
    
    
    
    
    
    
    var ca0 = new qx.ui.basic.Label("Children: ");
    ca0.setWidth(50);
    
    var ba0 = new qx.ui.form.Button("New Atom", "icon/16/button-ok.png");
    var ba1 = new qx.ui.form.Button("New Image", "icon/16/button-ok.png");    
    var ba2 = new qx.ui.form.Button("New Atom to #3", "icon/16/button-ok.png");    
    var ba3 = new qx.ui.form.Button("New Image to #6", "icon/16/button-ok.png");    
    var ba4 = new qx.ui.form.Button("Remove First", "icon/16/button-ok.png");    
    
    ba0.addEventListener("execute", function(e) {
      flow1.add(new qx.ui.basic.Atom("New Atom", "icon/16/services.png"));
    });
    
    ba1.addEventListener("execute", function(e) {
      flow1.add(new qx.ui.basic.Image("icon/64/pipe.png"));
    });   
    
    ba2.addEventListener("execute", function(e) {
      flow1.addAt(new qx.ui.basic.Atom("New Atom", "icon/16/bell.png"), 3);
    });  
    
    ba3.addEventListener("execute", function(e) {
      flow1.addAt(new qx.ui.basic.Image("icon/64/vectorgraphics.png"), 6);
    });  
    
    ba4.addEventListener("click", function(e) {
      flow1.remove(flow1.getFirstChild());
    });              
    
    var ha1 = new qx.ui.layout.HorizontalBoxLayout;
    
    ha1.add(ca0, ba0, ba1, ba2, ba3, ba4);
    ha1.setVerticalChildrenAlign("middle");
    ha1.setHeight("auto");
    
    controlBox.add(ha1);   
    
    
  });
  </script>
</body>
</html>