sweetgui 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. data/examples/nodetree.rb +96 -0
  2. data/icons/Thumbs.db +0 -0
  3. data/icons/action_back.gif +0 -0
  4. data/icons/action_forward.gif +0 -0
  5. data/icons/action_go.gif +0 -0
  6. data/icons/action_paste.gif +0 -0
  7. data/icons/action_print.gif +0 -0
  8. data/icons/action_refresh.gif +0 -0
  9. data/icons/action_refresh_blue.gif +0 -0
  10. data/icons/action_save.gif +0 -0
  11. data/icons/action_stop.gif +0 -0
  12. data/icons/application_dreamweaver.gif +0 -0
  13. data/icons/application_firefox.gif +0 -0
  14. data/icons/application_flash.gif +0 -0
  15. data/icons/arrow_down.gif +0 -0
  16. data/icons/arrow_left.gif +0 -0
  17. data/icons/arrow_right.gif +0 -0
  18. data/icons/arrow_up.gif +0 -0
  19. data/icons/box.gif +0 -0
  20. data/icons/calendar.gif +0 -0
  21. data/icons/comment.gif +0 -0
  22. data/icons/comment_blue.gif +0 -0
  23. data/icons/comment_delete.gif +0 -0
  24. data/icons/comment_new.gif +0 -0
  25. data/icons/comment_yellow.gif +0 -0
  26. data/icons/copy.gif +0 -0
  27. data/icons/cut.gif +0 -0
  28. data/icons/date.gif +0 -0
  29. data/icons/date_delete.gif +0 -0
  30. data/icons/date_new.gif +0 -0
  31. data/icons/file_acrobat.gif +0 -0
  32. data/icons/file_font.gif +0 -0
  33. data/icons/file_font_truetype.gif +0 -0
  34. data/icons/flag_blue.gif +0 -0
  35. data/icons/flag_green.gif +0 -0
  36. data/icons/flag_orange.gif +0 -0
  37. data/icons/flag_red.gif +0 -0
  38. data/icons/flag_white.gif +0 -0
  39. data/icons/folder.gif +0 -0
  40. data/icons/folder_delete.gif +0 -0
  41. data/icons/folder_images.gif +0 -0
  42. data/icons/folder_lock.gif +0 -0
  43. data/icons/folder_new.gif +0 -0
  44. data/icons/folder_page.gif +0 -0
  45. data/icons/icon_accept.gif +0 -0
  46. data/icons/icon_airmail.gif +0 -0
  47. data/icons/icon_alert.gif +0 -0
  48. data/icons/icon_attachment.gif +0 -0
  49. data/icons/icon_clock.gif +0 -0
  50. data/icons/icon_component.gif +0 -0
  51. data/icons/icon_download.gif +0 -0
  52. data/icons/icon_email.gif +0 -0
  53. data/icons/icon_extension.gif +0 -0
  54. data/icons/icon_favourites.gif +0 -0
  55. data/icons/icon_get_world.gif +0 -0
  56. data/icons/icon_history.gif +0 -0
  57. data/icons/icon_home.gif +0 -0
  58. data/icons/icon_info.gif +0 -0
  59. data/icons/icon_key.gif +0 -0
  60. data/icons/icon_link.gif +0 -0
  61. data/icons/icon_mail.gif +0 -0
  62. data/icons/icon_monitor_mac.gif +0 -0
  63. data/icons/icon_monitor_pc.gif +0 -0
  64. data/icons/icon_network.gif +0 -0
  65. data/icons/icon_package.gif +0 -0
  66. data/icons/icon_package_get.gif +0 -0
  67. data/icons/icon_package_open.gif +0 -0
  68. data/icons/icon_padlock.gif +0 -0
  69. data/icons/icon_security.gif +0 -0
  70. data/icons/icon_settings.gif +0 -0
  71. data/icons/icon_user.gif +0 -0
  72. data/icons/icon_wand.gif +0 -0
  73. data/icons/icon_world.gif +0 -0
  74. data/icons/icon_world_dynamic.gif +0 -0
  75. data/icons/image.gif +0 -0
  76. data/icons/image_new.gif +0 -0
  77. data/icons/interface_browser.gif +0 -0
  78. data/icons/interface_dialog.gif +0 -0
  79. data/icons/interface_installer.gif +0 -0
  80. data/icons/list_comments.gif +0 -0
  81. data/icons/list_components.gif +0 -0
  82. data/icons/list_errors.gif +0 -0
  83. data/icons/list_extensions.gif +0 -0
  84. data/icons/list_images.gif +0 -0
  85. data/icons/list_keys.gif +0 -0
  86. data/icons/list_links.gif +0 -0
  87. data/icons/list_packages.gif +0 -0
  88. data/icons/list_security.gif +0 -0
  89. data/icons/list_settings.gif +0 -0
  90. data/icons/list_users.gif +0 -0
  91. data/icons/list_world.gif +0 -0
  92. data/icons/note.gif +0 -0
  93. data/icons/note_delete.gif +0 -0
  94. data/icons/note_new.gif +0 -0
  95. data/icons/page.gif +0 -0
  96. data/icons/page_alert.gif +0 -0
  97. data/icons/page_attachment.gif +0 -0
  98. data/icons/page_bookmark.gif +0 -0
  99. data/icons/page_boy.gif +0 -0
  100. data/icons/page_code.gif +0 -0
  101. data/icons/page_colors.gif +0 -0
  102. data/icons/page_component.gif +0 -0
  103. data/icons/page_cross.gif +0 -0
  104. data/icons/page_delete.gif +0 -0
  105. data/icons/page_deny.gif +0 -0
  106. data/icons/page_down.gif +0 -0
  107. data/icons/page_dynamic.gif +0 -0
  108. data/icons/page_edit.gif +0 -0
  109. data/icons/page_extension.gif +0 -0
  110. data/icons/page_favourites.gif +0 -0
  111. data/icons/page_find.gif +0 -0
  112. data/icons/page_flash.gif +0 -0
  113. data/icons/page_girl.gif +0 -0
  114. data/icons/page_html.gif +0 -0
  115. data/icons/page_java.gif +0 -0
  116. data/icons/page_key.gif +0 -0
  117. data/icons/page_left.gif +0 -0
  118. data/icons/page_link.gif +0 -0
  119. data/icons/page_lock.gif +0 -0
  120. data/icons/page_new.gif +0 -0
  121. data/icons/page_next.gif +0 -0
  122. data/icons/page_package.gif +0 -0
  123. data/icons/page_php.gif +0 -0
  124. data/icons/page_prev.gif +0 -0
  125. data/icons/page_refresh.gif +0 -0
  126. data/icons/page_right.gif +0 -0
  127. data/icons/page_script.gif +0 -0
  128. data/icons/page_security.gif +0 -0
  129. data/icons/page_settings.gif +0 -0
  130. data/icons/page_sound.gif +0 -0
  131. data/icons/page_tag_blue.gif +0 -0
  132. data/icons/page_tag_red.gif +0 -0
  133. data/icons/page_text.gif +0 -0
  134. data/icons/page_text_delete.gif +0 -0
  135. data/icons/page_tick.gif +0 -0
  136. data/icons/page_tree.gif +0 -0
  137. data/icons/page_up.gif +0 -0
  138. data/icons/page_url.gif +0 -0
  139. data/icons/page_user.gif +0 -0
  140. data/icons/page_user_dark.gif +0 -0
  141. data/icons/page_user_light.gif +0 -0
  142. data/icons/page_video.gif +0 -0
  143. data/icons/page_wizard.gif +0 -0
  144. data/icons/readme.txt +2 -0
  145. data/icons/table.gif +0 -0
  146. data/icons/table_delete.gif +0 -0
  147. data/icons/tables.gif +0 -0
  148. data/lib/apps/objecttree.rb +141 -0
  149. data/lib/swt.rb +464 -0
  150. data/lib/test2.class +0 -0
  151. data/tests/ts_swt.rb +54 -0
  152. metadata +196 -0
data/lib/swt.rb ADDED
@@ -0,0 +1,464 @@
1
+ # The contents of this file are subject to the Mozilla Public License
2
+ # Version 1.1 (the "License"); you may not use this file except in
3
+ # compliance with the License. You may obtain a copy of the License at
4
+ # http://www.mozilla.org/MPL/
5
+ #
6
+ # Software distributed under the License is distributed on an "AS IS"
7
+ # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
8
+ # License for the specific language governing rights and limitations
9
+ # under the License.
10
+ #
11
+ # The Initial Developer of the Original Code is Johannes Rudolph.
12
+ # Portions created by the Initial Developer are Copyright (C) 2006
13
+ # the Initial Developer. All Rights Reserved.
14
+ #
15
+ # Contributor(s):
16
+ # Johannes Rudolph <johannes_rudolph@gmail.com>
17
+
18
+ require 'java'
19
+
20
+ module SWT
21
+ def self.object_tree(o)
22
+ require 'apps/objecttree'
23
+ JRubyUtils::RubyObjectBrowser.object_tree o
24
+ end
25
+ class TreeCommand
26
+ def initialize(parent)
27
+ @parent=parent
28
+ end
29
+ def accept(child)
30
+ child
31
+ end
32
+ def stacktrace
33
+ "in #{self.class}\n#{@parent.stacktrace if @parent}"
34
+ end
35
+ end
36
+ class SimpleCommand<TreeCommand
37
+ def initialize(parent,child=nil)
38
+ super(parent)
39
+ @child=child
40
+ end
41
+ def accept(child)
42
+ @child=child
43
+ end
44
+ def invoke(tree)
45
+ @child=@child.call if @child.is_a? Proc
46
+ raise "Link expression must evaluate to command: #{stacktrace}" unless @child
47
+ tree=[tree] unless tree.is_a? Array
48
+ @child.invoke tree
49
+ end
50
+ def to_s
51
+ "#{self.class} (#{@child})"
52
+ end
53
+ end
54
+ class ContainerTreeCommand<TreeCommand
55
+ def initialize(parent)
56
+ super(parent)
57
+ @children=[]
58
+ end
59
+ def accept(child)
60
+ @children << child
61
+ child
62
+ end
63
+ def invoke(stack)
64
+ @children.each { |x| x.invoke stack}
65
+ end
66
+ def to_s
67
+ "#{self.class} ([#{@children.join ','}])"
68
+ end
69
+ end
70
+ class ChildCommand<ContainerTreeCommand
71
+ include_class 'org.eclipse.swt.widgets.TreeItem'
72
+ include_class 'org.eclipse.swt.widgets.Tree'
73
+ include_class 'org.eclipse.swt.events.TreeListener'
74
+ def initialize(parent)
75
+ super(parent)
76
+ end
77
+
78
+ def invoke(origstack)
79
+ stack=origstack.dup
80
+ last=origstack.last
81
+ expand=lambda do
82
+ res=TreeItem.new last,Builder::RealSWT::NONE
83
+ res.setData("object",last.getData("object"))
84
+ #puts "In Child.invoke: res:#{res.hashCode} data: #{last.getData("object").id}"
85
+ stack.push(res)
86
+
87
+ #puts "Stack: #{stack} last:#{stack.last.hashCode} objectid:#{stack.last.getData("object").hashCode}"
88
+ @children.each do |x|
89
+ x.invoke stack
90
+ end
91
+ stack.pop
92
+ res
93
+ end
94
+
95
+ parent=origstack.last
96
+
97
+ unless parent.is_a? TreeItem
98
+ expand.call
99
+ return
100
+ end
101
+
102
+ dummy=parent.getData("dummy")
103
+ unless dummy
104
+ dummy=TreeItem.new parent,Builder::RealSWT::NONE
105
+ dummy.setText "dummy"
106
+ parent.setData("dummy",dummy)
107
+ end
108
+
109
+ li=TreeListener.new
110
+ class <<li
111
+ def treeExpanded(e)
112
+ @block.call e
113
+ end
114
+ def treeCollapsed(e)
115
+ end
116
+ def set_info(&block)
117
+ @block=block
118
+ end
119
+ end
120
+ li.set_info do |e|
121
+ if e.item==parent
122
+ unless dummy.isDisposed
123
+ dummy.dispose
124
+ end
125
+
126
+ res=expand.call
127
+ e.widget.getColumn(0).pack if e.widget.getColumnCount>0
128
+ res.getParent.removeTreeListener li
129
+ end
130
+ end
131
+ parent.getParent.addTreeListener li
132
+ end
133
+ end
134
+ class LabelCommand<TreeCommand
135
+ def initialize(parent,exp,index=0)
136
+ super(parent)
137
+ @exp=exp
138
+ @index=index
139
+ end
140
+ def invoke(stack)
141
+ stack.last.setText(@index,@exp.call(stack.last.getData("object")).to_s)
142
+ end
143
+ def to_s
144
+ "LabelCmd (#{@exp})"
145
+ end
146
+ end
147
+ class ImageCommand<TreeCommand
148
+ include_class 'org.eclipse.swt.graphics.Image'
149
+ def initialize(parent,exp)
150
+ super(parent)
151
+ @exp=exp
152
+ end
153
+ def invoke(stack)
154
+ image=@exp.call stack.last.getData("object")
155
+ image=Image.new stack.last.getDisplay, image if image.is_a? String
156
+ raise "Image expression(#{image},#{@exp}) must be an swt image or a filename: #{stacktrace}" unless image.is_a? Image
157
+ stack.last.setImage(image)
158
+
159
+ end
160
+ end
161
+ class ObjectCommand<TreeCommand
162
+ def initialize(parent,exp)
163
+ super(parent)
164
+ @exp=exp
165
+ end
166
+ def invoke(stack)
167
+ lastobject=stack.last.getData("object")
168
+ #puts "Laststack: #{stack.last} id: #{stack.last.hashCode} object: #{lastobject} id: #{lastobject.hashCode}"
169
+ newobject=@exp.call(lastobject)
170
+ #class <<newobject
171
+ # def last
172
+ # @last
173
+ # end
174
+ # def last=(last)
175
+ # @last=last
176
+ # end
177
+ # alias :old_dup :dup
178
+ # def dup
179
+ # new=old_dup
180
+ # new.last=@last
181
+ # puts "Object gets dupd: #{self} #{self.id}"
182
+ # end
183
+ #end
184
+ #newobject.last=lastobject
185
+ #test=Java.java_to_ruby(newobject)
186
+ stack.last.setData("object",newobject)
187
+ #test2=stack.last.getData("object")
188
+ #puts "Test: #{test}, Test2: #{test2} test1==test2: #{test==test2} test1===test2 #{test===test2} id:#{test.id} lasttree: #{stack.last.hashCode}"
189
+ # puts "ObjectCommand.invoke lastobject: #{lastobject} newobject: #{newobject} newobject.last: #{newobject.last}"
190
+ end
191
+ end
192
+ class ChildrenCommand<ContainerTreeCommand
193
+ def accept(cmd)
194
+ @inner.accept cmd
195
+ end
196
+ def initialize(parent,exp)
197
+ super(parent)
198
+ @exp=exp
199
+ @inner=ContainerTreeCommand.new self
200
+ end
201
+ def invoke(stack)
202
+ last=stack.last.getData("object")
203
+ coll=@exp.call(last)
204
+ coll.each do |x|
205
+ cmd=ChildCommand.new self
206
+ @children << cmd
207
+ cmd.accept(ObjectCommand.new(self,lambda{last}))
208
+ cmd.accept(ObjectCommand.new(self,lambda{x}))
209
+ cmd.accept(@inner)
210
+ cmd.invoke stack
211
+ end
212
+ end
213
+ end
214
+ class ConditionalCommand<ContainerTreeCommand
215
+ def initialize(parent,exp)
216
+ super(parent)
217
+ @exp=exp
218
+ end
219
+ def invoke(stack)
220
+ condition=@exp.call stack.last.getData("object")
221
+ super if condition
222
+ end
223
+ end
224
+ class TreeBuilder
225
+ def initialize(&block)
226
+ @current=ContainerTreeCommand.new nil
227
+ instance_eval(&block)
228
+ end
229
+ def column(text)
230
+ cmd=SimpleCommand.new @current
231
+ @current.accept cmd
232
+ class <<cmd
233
+ include_class 'org.eclipse.swt.widgets.TreeColumn'
234
+ def invoke(stack)
235
+ # puts "column invoke stack:#{stack}, name:#{@name}"
236
+ stack.last.setHeaderVisible true
237
+ tc=TreeColumn.new stack.last,Builder::RealSWT::NONE
238
+ tc.setText @name
239
+ tc.pack
240
+ end
241
+ def name=(name)
242
+ @name=name
243
+ end
244
+ end
245
+ cmd.name=text
246
+ end
247
+ def child(label=nil,&block)
248
+ cmd=ChildCommand.new @current
249
+ @current and @current.accept cmd
250
+ old=@current
251
+ @current=cmd
252
+ label(label) if label
253
+ instance_eval(&block) if block
254
+ @current=old
255
+ cmd
256
+ end
257
+ def cell(i,&block)
258
+ @current.accept(LabelCommand.new(@current,block,i))
259
+ end
260
+ def label(labelExp=nil,&block)
261
+ block=lambda{labelExp} if labelExp
262
+ @current.accept(LabelCommand.new(@current,block))
263
+ end
264
+ def object(&block)
265
+ @current.accept(ObjectCommand.new(@current,block))
266
+ end
267
+ def image(&block)
268
+ @current.accept(ImageCommand.new(@current,block))
269
+ end
270
+ def link(cmd=nil,&block)
271
+ cmd=block unless cmd
272
+ #puts "Creating link with cmd=#{cmd}"
273
+ @current.accept(SimpleCommand.new(@current, cmd))
274
+ end
275
+ def children(exp,&block)
276
+ cmd=ChildrenCommand.new @current,exp
277
+ @current.accept cmd
278
+ old=@current
279
+ @current=cmd
280
+ instance_eval(&block) if block
281
+ @current=old
282
+ cmd
283
+ end
284
+ def leaf(&block)
285
+ child do
286
+ label &block
287
+ end
288
+ end
289
+ def container(&block)
290
+ cmd=ContainerTreeCommand.new @current
291
+ @current and @current.accept cmd
292
+ old=@current
293
+ @current=cmd
294
+ instance_eval(&block)if block
295
+ @current=old
296
+ cmd
297
+ end
298
+ def conditional(exp,&block)
299
+ cmd=ConditionalCommand.new @current,exp
300
+ @current.accept cmd
301
+ old=@current
302
+ @current=cmd
303
+ instance_eval(&block) if block
304
+ @current=old
305
+ cmd
306
+ end
307
+ def run(tree)
308
+ @current.invoke [tree]
309
+ end
310
+ def current
311
+ @current
312
+ end
313
+ end
314
+ class Builder
315
+ #class <<self
316
+ # alias :old_include_class :include_class
317
+ #def include_class (name,&block)
318
+ # cl=old_include_class name,&block
319
+ # JavaUtilities.get_proxy_class(name).compile
320
+ #end
321
+ #end
322
+
323
+ include_class 'org.eclipse.swt.widgets.Shell'
324
+ include_class 'org.eclipse.swt.widgets.Group'
325
+ include_class 'org.eclipse.swt.widgets.Text'
326
+ include_class 'org.eclipse.swt.widgets.Label'
327
+ include_class 'org.eclipse.swt.widgets.Button'
328
+ include_class 'org.eclipse.swt.widgets.Tree'
329
+ include_class 'org.eclipse.swt.widgets.Composite'
330
+ include_class 'org.eclipse.swt.widgets.Display'
331
+ include_class 'org.eclipse.swt.layout.GridLayout'
332
+ include_class 'org.eclipse.swt.layout.FillLayout'
333
+ include_class 'org.eclipse.swt.layout.GridData'
334
+ include_class 'org.eclipse.swt.SWT' do
335
+ 'RealSWT'
336
+ end
337
+
338
+ # def initialize#(&block)
339
+
340
+ # end
341
+
342
+ def self.go(&block)
343
+ shell=Builder.new.instance_eval(&block)
344
+ shell.pack
345
+ shell.layout
346
+ shell.open
347
+ run shell
348
+ end
349
+
350
+ def init_control(c,opts={})
351
+ if c.getParent.getLayout.class==GridLayout
352
+ gd=GridData.new
353
+ opts[:colspan] and gd.horizontalSpan=opts[:colspan]
354
+ if opts[:verticalFill]
355
+ gd.verticalAlignment=RealSWT::FILL
356
+ gd.grabExcessVerticalSpace=true
357
+ end
358
+ if opts[:horizontalFill]
359
+ gd.horizontalAlignment=RealSWT::FILL
360
+ gd.grabExcessHorizontalSpace=true
361
+ end
362
+ c.setLayoutData(gd)
363
+ end
364
+ end
365
+ def init_composite(c,columns,opts={},&block)
366
+ init_control c,opts
367
+ gl=GridLayout.new
368
+ gl.numColumns=columns
369
+ c.setLayout(gl)
370
+
371
+ if block_given?
372
+ oldparent=@parent
373
+ @parent=c
374
+ instance_eval(&block)
375
+ @parent=oldparent
376
+ end
377
+ end
378
+
379
+ def shell(title,columns=1,style=RealSWT::SHELL_TRIM,&block)
380
+ res=Shell.new(Display.getDefault,style)
381
+ res.setText title
382
+ fl=FillLayout.new
383
+ fl.marginHeight=5
384
+ fl.marginWidth=5
385
+ res.setLayout fl
386
+ # oldparent=@parent
387
+ @parent=res
388
+ # instance_eval(&block) if block_given?
389
+ # @parent=oldparent
390
+ container(columns,&block)
391
+ #init_composite res,columns
392
+ return res
393
+ end
394
+
395
+ def container(columns=1,opts={},&block)
396
+ opts[:style] or opts[:style]=RealSWT::NONE
397
+ res=Composite.new(@parent,opts[:style])
398
+ init_composite res,columns,opts,&block
399
+ return res
400
+ end
401
+
402
+ def group(title,columns=1,style=RealSWT::NONE,&block)
403
+ res=Group.new(@parent,style)
404
+ res.setText title
405
+ init_composite res,columns,&block
406
+ return res
407
+ end
408
+
409
+ def text(text=nil,style=RealSWT::BORDER)
410
+ #puts "Text: #{text}"
411
+ res=Text.new(@parent,style)
412
+ text and res.setText text
413
+ init_control res
414
+ return res
415
+ end
416
+
417
+ def label(text,style=RealSWT::NONE)
418
+ res=Label.new(@parent,style)
419
+ res.setText text
420
+ init_control res
421
+ return res
422
+ end
423
+
424
+ def button(text,style=RealSWT::NONE)
425
+ res=Button.new(@parent,style)
426
+ res.setText text
427
+ init_control res
428
+ return res
429
+ end
430
+
431
+ def tree(opts={:style=>RealSWT::BORDER},&block)
432
+ opts[:style] or opts[:style]=RealSWT::BORDER
433
+ res=Tree.new(@parent,opts[:style])
434
+ init_control res,opts
435
+ builder=TreeBuilder.new &block
436
+ #puts builder.current
437
+ builder.run res
438
+ res.pack
439
+ return res
440
+ end
441
+
442
+ unless Builder.methods.include? :method_missing
443
+ alias :old_method_missing method_missing
444
+ end
445
+
446
+ def method_missing(id,*args)
447
+ #puts "ID:#{id.class.inspect}\t\targs:#{args.join ','}\t#{id=~/labeled(\w+)/}"
448
+ if id.to_s=~/labeled(\w+)/
449
+ label args.shift
450
+ method($1.downcase).call *args
451
+ else
452
+ old_method_missing id,args
453
+ end
454
+ end
455
+
456
+ def Builder.run(shell)
457
+ d=shell.getDisplay
458
+ while(!shell.isDisposed&&shell.isVisible) do
459
+ while(d.readAndDispatch) do end
460
+ d.sleep
461
+ end
462
+ end
463
+ end
464
+ end
data/lib/test2.class ADDED
Binary file
data/tests/ts_swt.rb ADDED
@@ -0,0 +1,54 @@
1
+ # The contents of this file are subject to the Mozilla Public License
2
+ # Version 1.1 (the "License"); you may not use this file except in
3
+ # compliance with the License. You may obtain a copy of the License at
4
+ # http://www.mozilla.org/MPL/
5
+ #
6
+ # Software distributed under the License is distributed on an "AS IS"
7
+ # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
8
+ # License for the specific language governing rights and limitations
9
+ # under the License.
10
+ #
11
+ # The Initial Developer of the Original Code is Johannes Rudolph.
12
+ # Portions created by the Initial Developer are Copyright (C) 2006
13
+ # the Initial Developer. All Rights Reserved.
14
+ #
15
+ # Contributor(s):
16
+ # Johannes Rudolph <johannes_rudolph@gmail.com>
17
+
18
+ require 'swt'
19
+ require 'test/unit'
20
+
21
+ module SWT
22
+ class SWTTest < Test::Unit::TestCase
23
+ include_class 'java.lang.Thread' do
24
+ "JavaThread"
25
+ end
26
+ def test_swt_container
27
+ shell=SWT::Builder.go do
28
+ shell "Testprogramm",2 do
29
+ tree(:verticalFill=>true,:horizontalFill=>true) do
30
+ child do
31
+ object{JavaThread.currentThread}
32
+ label{|x| x}
33
+ children(lambda{|x|x.getStackTrace}) do
34
+ label{|x| x}
35
+ leaf {|x|"Datei: #{x.getFileName}"}
36
+ leaf {|x|"Zeilennummer: #{x.getLineNumber}"}
37
+ end
38
+ end
39
+ end
40
+ container 2 do
41
+ group "Wurst",2 do
42
+ labeledText "Katastrophe:"
43
+ labeledText "Butterbrot:"
44
+ end
45
+ group "Buttons",1 do
46
+ button "Hallo"
47
+ button "Gustav das Brot"
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
metadata ADDED
@@ -0,0 +1,196 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: sweetgui
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.3
7
+ date: 2006-09-19 00:00:00 +02:00
8
+ summary: "SWeeTgui: Fast building of SWT GUI screens for JRuby"
9
+ require_paths:
10
+ - lib
11
+ email: johannes.rudolph@gmail.com
12
+ homepage: http://virtual-void.net
13
+ rubyforge_project:
14
+ description:
15
+ autorequire: swt
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ authors:
29
+ - Johannes Rudolph
30
+ files:
31
+ - tests/ts_swt.rb
32
+ - lib/apps
33
+ - lib/swt.rb
34
+ - lib/test2.class
35
+ - lib/apps/objecttree.rb
36
+ - icons/action_back.gif
37
+ - icons/action_forward.gif
38
+ - icons/action_go.gif
39
+ - icons/action_paste.gif
40
+ - icons/action_print.gif
41
+ - icons/action_refresh.gif
42
+ - icons/action_refresh_blue.gif
43
+ - icons/action_save.gif
44
+ - icons/action_stop.gif
45
+ - icons/application_dreamweaver.gif
46
+ - icons/application_firefox.gif
47
+ - icons/application_flash.gif
48
+ - icons/arrow_down.gif
49
+ - icons/arrow_left.gif
50
+ - icons/arrow_right.gif
51
+ - icons/arrow_up.gif
52
+ - icons/box.gif
53
+ - icons/calendar.gif
54
+ - icons/comment.gif
55
+ - icons/comment_blue.gif
56
+ - icons/comment_delete.gif
57
+ - icons/comment_new.gif
58
+ - icons/comment_yellow.gif
59
+ - icons/copy.gif
60
+ - icons/cut.gif
61
+ - icons/date.gif
62
+ - icons/date_delete.gif
63
+ - icons/date_new.gif
64
+ - icons/file_acrobat.gif
65
+ - icons/file_font.gif
66
+ - icons/file_font_truetype.gif
67
+ - icons/flag_blue.gif
68
+ - icons/flag_green.gif
69
+ - icons/flag_orange.gif
70
+ - icons/flag_red.gif
71
+ - icons/flag_white.gif
72
+ - icons/folder.gif
73
+ - icons/folder_delete.gif
74
+ - icons/folder_images.gif
75
+ - icons/folder_lock.gif
76
+ - icons/folder_new.gif
77
+ - icons/folder_page.gif
78
+ - icons/icon_accept.gif
79
+ - icons/icon_airmail.gif
80
+ - icons/icon_alert.gif
81
+ - icons/icon_attachment.gif
82
+ - icons/icon_clock.gif
83
+ - icons/icon_component.gif
84
+ - icons/icon_download.gif
85
+ - icons/icon_email.gif
86
+ - icons/icon_extension.gif
87
+ - icons/icon_favourites.gif
88
+ - icons/icon_get_world.gif
89
+ - icons/icon_history.gif
90
+ - icons/icon_home.gif
91
+ - icons/icon_info.gif
92
+ - icons/icon_key.gif
93
+ - icons/icon_link.gif
94
+ - icons/icon_mail.gif
95
+ - icons/icon_monitor_mac.gif
96
+ - icons/icon_monitor_pc.gif
97
+ - icons/icon_network.gif
98
+ - icons/icon_package.gif
99
+ - icons/icon_package_get.gif
100
+ - icons/icon_package_open.gif
101
+ - icons/icon_padlock.gif
102
+ - icons/icon_security.gif
103
+ - icons/icon_settings.gif
104
+ - icons/icon_user.gif
105
+ - icons/icon_wand.gif
106
+ - icons/icon_world.gif
107
+ - icons/icon_world_dynamic.gif
108
+ - icons/image.gif
109
+ - icons/image_new.gif
110
+ - icons/interface_browser.gif
111
+ - icons/interface_dialog.gif
112
+ - icons/interface_installer.gif
113
+ - icons/list_comments.gif
114
+ - icons/list_components.gif
115
+ - icons/list_errors.gif
116
+ - icons/list_extensions.gif
117
+ - icons/list_images.gif
118
+ - icons/list_keys.gif
119
+ - icons/list_links.gif
120
+ - icons/list_packages.gif
121
+ - icons/list_security.gif
122
+ - icons/list_settings.gif
123
+ - icons/list_users.gif
124
+ - icons/list_world.gif
125
+ - icons/note.gif
126
+ - icons/note_delete.gif
127
+ - icons/note_new.gif
128
+ - icons/page.gif
129
+ - icons/page_alert.gif
130
+ - icons/page_attachment.gif
131
+ - icons/page_bookmark.gif
132
+ - icons/page_boy.gif
133
+ - icons/page_code.gif
134
+ - icons/page_colors.gif
135
+ - icons/page_component.gif
136
+ - icons/page_cross.gif
137
+ - icons/page_delete.gif
138
+ - icons/page_deny.gif
139
+ - icons/page_down.gif
140
+ - icons/page_dynamic.gif
141
+ - icons/page_edit.gif
142
+ - icons/page_extension.gif
143
+ - icons/page_favourites.gif
144
+ - icons/page_find.gif
145
+ - icons/page_flash.gif
146
+ - icons/page_girl.gif
147
+ - icons/page_html.gif
148
+ - icons/page_java.gif
149
+ - icons/page_key.gif
150
+ - icons/page_left.gif
151
+ - icons/page_link.gif
152
+ - icons/page_lock.gif
153
+ - icons/page_new.gif
154
+ - icons/page_next.gif
155
+ - icons/page_package.gif
156
+ - icons/page_php.gif
157
+ - icons/page_prev.gif
158
+ - icons/page_refresh.gif
159
+ - icons/page_right.gif
160
+ - icons/page_script.gif
161
+ - icons/page_security.gif
162
+ - icons/page_settings.gif
163
+ - icons/page_sound.gif
164
+ - icons/page_tag_blue.gif
165
+ - icons/page_tag_red.gif
166
+ - icons/page_text.gif
167
+ - icons/page_text_delete.gif
168
+ - icons/page_tick.gif
169
+ - icons/page_tree.gif
170
+ - icons/page_up.gif
171
+ - icons/page_url.gif
172
+ - icons/page_user.gif
173
+ - icons/page_user_dark.gif
174
+ - icons/page_user_light.gif
175
+ - icons/page_video.gif
176
+ - icons/page_wizard.gif
177
+ - icons/readme.txt
178
+ - icons/table.gif
179
+ - icons/tables.gif
180
+ - icons/table_delete.gif
181
+ - icons/Thumbs.db
182
+ - examples/nodetree.rb
183
+ test_files:
184
+ - tests/ts_swt.rb
185
+ rdoc_options: []
186
+
187
+ extra_rdoc_files: []
188
+
189
+ executables: []
190
+
191
+ extensions: []
192
+
193
+ requirements: []
194
+
195
+ dependencies: []
196
+