summaryrefslogtreecommitdiff
path: root/swat.obsolete/apps/qooxdoo-examples/test/DockLayout_2.html
blob: 52ecefadec84a71c723e9be636f3b102c22878f5 (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
<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">
    The next generation of table-less layouts ;)
  </div>

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

    var dl1 = new qx.ui.layout.DockLayout;
    
    dl1.setTop(48);
    dl1.setLeft(20);
    dl1.setRight(335);
    dl1.setBottom(120);
    dl1.setMinWidth(400);
    dl1.setMinHeight(300);
    
    dl1.setBorder(2, "outset");
    dl1.setBackgroundColor("white");
    
    d.add(dl1);
    
    
    
    var t1 = new qx.ui.basic.Terminator;
    t1.setHeight(50);
    t1.setBackgroundColor("red");
    t1.setVerticalAlign("top");
    t1.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
    t1.addEventListener("click", selfRemove);

    var t2 = new qx.ui.basic.Terminator;
    // t2.setWidth(150);
    t2.setWidth("20%");
    t2.setBackgroundColor("gray");
    t2.setHorizontalAlign("left");
    t2.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
    t2.addEventListener("click", selfRemove);

    var t3 = new qx.ui.basic.Terminator;
    t3.setHeight(100);
    t3.setBackgroundColor("yellow");
    t3.setVerticalAlign("top");
    t3.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
    t3.addEventListener("click", selfRemove);

    var t4 = new qx.ui.basic.Terminator;
    t4.setWidth(40);
    t4.setBackgroundColor("orange");
    t4.setHorizontalAlign("right");
    t4.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
    t4.addEventListener("click", selfRemove);

    var t5 = new qx.ui.basic.Terminator;
    t5.setHeight(80);
    t5.setBackgroundColor("blue");
    t5.setVerticalAlign("bottom");
    t5.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
    t5.addEventListener("click", selfRemove);
   
    var t6 = new qx.ui.basic.Terminator;
    t6.setBackgroundColor("green");
    t6.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
    t6.addEventListener("click", selfRemove);

    dl1.add(t1, t2, t3, t4, t5, t6);
    
    
    
    
    
   
    
    
    
    var l1 = new qx.ui.basic.Label("Mode:");
    l1.setWidth(50);
    
    var btn1_1 = new qx.ui.form.Button("Vertical", "icon/16/button-ok.png");
    var btn1_2 = new qx.ui.form.Button("Horizontal", "icon/16/button-ok.png");
    var btn1_3 = new qx.ui.form.Button("Ordered", "icon/16/button-ok.png");
    
    btn1_1.addEventListener("click", function(e) {
      dl1.setMode("vertical");
    });

    btn1_2.addEventListener("click", function(e) {
      dl1.setMode("horizontal");
    });

    btn1_3.addEventListener("click", function(e) {
      dl1.setMode("ordered");
    });
    
    var h1 = new qx.ui.layout.HorizontalBoxLayout;
    h1.setVerticalChildrenAlign("middle");
    h1.add(l1, btn1_1, btn1_2, btn1_3);
    h1.setBottom(78);
    h1.setLeft(20);
    d.add(h1);
    
    
    
    
    
    
    
    
    
    var l2 = new qx.ui.basic.Label("Children:");
    l2.setWidth(50);
    
    var btn2_1 = new qx.ui.form.Button("Remove First", "icon/16/button-ok.png");
    var btn2_2 = new qx.ui.form.Button("Remove Last", "icon/16/button-ok.png");
    var btn2_3 = new qx.ui.form.Button("Add Top", "icon/16/button-ok.png");
    var btn2_4 = new qx.ui.form.Button("Add Right", "icon/16/button-ok.png");
    var btn2_5 = new qx.ui.form.Button("Add Bottom", "icon/16/button-ok.png");
    var btn2_6 = new qx.ui.form.Button("Add Left", "icon/16/button-ok.png");
    var btn2_7 = new qx.ui.form.Button("Add Auto", "icon/16/button-ok.png");

    btn2_1.addEventListener("execute", function(e) 
    {
      var c = dl1.getFirstChild();
      if (c) {
        dl1.remove(c);
      };      
    });

    btn2_2.addEventListener("execute", function(e) 
    {
      var c = dl1.getLastChild();
      if (c) {
        dl1.remove(c);
      };      
    });
    
    btn2_3.addEventListener("execute", function(e) 
    {
      var t = new qx.ui.basic.Terminator();
      
      t.setBackgroundColor(qx.renderer.color.Color.fromRandom());
      t.setHeight(2+Math.round(Math.random()*50));
      t.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
      t.addEventListener("click", selfRemove);
      
      dl1.addTop(t);
    });
    
    btn2_4.addEventListener("execute", function(e) 
    {
      var t = new qx.ui.basic.Terminator();
      
      t.setBackgroundColor(qx.renderer.color.Color.fromRandom());
      t.setWidth(2+Math.round(Math.random()*50));
      t.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
      t.addEventListener("click", selfRemove);
      
      dl1.addRight(t);
    });
    
    btn2_5.addEventListener("execute", function(e) 
    {
      var t = new qx.ui.basic.Terminator();
      
      t.setBackgroundColor(qx.renderer.color.Color.fromRandom());
      t.setHeight(2+Math.round(Math.random()*50));
      t.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
      t.addEventListener("click", selfRemove);
      
      dl1.addBottom(t);
    });
    
    btn2_6.addEventListener("execute", function(e) 
    {
      var t = new qx.ui.basic.Terminator();
      
      t.setBackgroundColor(qx.renderer.color.Color.fromRandom());
      t.setWidth(2+Math.round(Math.random()*50));
      t.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
      t.addEventListener("click", selfRemove);
      
      dl1.addLeft(t);
    });
    
    btn2_7.addEventListener("execute", function(e) 
    {
      var t = new qx.ui.basic.Terminator();
      
      t.setBackgroundColor(qx.renderer.color.Color.fromRandom());
      t.setBorder(qx.renderer.border.BorderPresets.getInstance().black);
      t.addEventListener("click", selfRemove);
      
      dl1.add(t);
    });    

    
    var h2 = new qx.ui.layout.HorizontalBoxLayout;
    h2.setVerticalChildrenAlign("middle");
    h2.add(l2, btn2_1, btn2_2, btn2_3, btn2_4, btn2_5, btn2_6, btn2_7);
    h2.setBottom(48);
    h2.setLeft(20);
    d.add(h2);    
  });
  </script>
</body>
</html>