glimmer-dsl-swt 4.18.4.10 → 4.18.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +71 -0
  3. data/README.md +14 -5
  4. data/VERSION +1 -1
  5. data/bin/glimmer +3 -3
  6. data/docs/reference/GLIMMER_CONFIGURATION.md +7 -3
  7. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +451 -112
  8. data/docs/reference/GLIMMER_SAMPLES.md +76 -3
  9. data/glimmer-dsl-swt.gemspec +23 -13
  10. data/lib/ext/glimmer/config.rb +3 -7
  11. data/lib/glimmer/data_binding/list_selection_binding.rb +13 -7
  12. data/lib/glimmer/data_binding/table_items_binding.rb +22 -17
  13. data/lib/glimmer/data_binding/tree_items_binding.rb +19 -15
  14. data/lib/glimmer/data_binding/widget_binding.rb +12 -27
  15. data/lib/glimmer/dsl/swt/{file_dialog_expression.rb → auto_exec_expression.rb} +6 -18
  16. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +9 -6
  17. data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
  18. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +16 -14
  19. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +4 -1
  20. data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -2
  21. data/lib/glimmer/dsl/swt/dialog_expression.rb +18 -9
  22. data/lib/glimmer/dsl/swt/dsl.rb +1 -0
  23. data/lib/glimmer/dsl/swt/exec_expression.rb +1 -1
  24. data/lib/glimmer/dsl/swt/font_expression.rb +1 -1
  25. data/lib/glimmer/dsl/swt/image_expression.rb +16 -2
  26. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +11 -8
  27. data/lib/glimmer/dsl/swt/pixel_expression.rb +1 -1
  28. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +8 -5
  29. data/lib/glimmer/dsl/swt/shape_expression.rb +2 -2
  30. data/lib/glimmer/dsl/swt/shell_expression.rb +1 -1
  31. data/lib/glimmer/dsl/swt/widget_expression.rb +8 -4
  32. data/lib/glimmer/launcher.rb +3 -0
  33. data/lib/glimmer/rake_task/scaffold.rb +3 -0
  34. data/lib/glimmer/swt/color_proxy.rb +1 -1
  35. data/lib/glimmer/swt/custom/code_text.rb +33 -11
  36. data/lib/glimmer/swt/custom/drawable.rb +57 -1
  37. data/lib/glimmer/swt/custom/shape.rb +332 -48
  38. data/lib/glimmer/swt/custom/shape/arc.rb +60 -0
  39. data/lib/glimmer/{dsl/swt/directory_dialog_expression.rb → swt/custom/shape/focus.rb} +15 -20
  40. data/lib/glimmer/swt/custom/shape/image.rb +112 -0
  41. data/lib/glimmer/swt/custom/shape/line.rb +111 -0
  42. data/lib/glimmer/swt/custom/shape/oval.rb +61 -0
  43. data/lib/glimmer/swt/custom/shape/point.rb +49 -0
  44. data/lib/glimmer/swt/custom/shape/polygon.rb +114 -0
  45. data/lib/glimmer/swt/custom/shape/polyline.rb +115 -0
  46. data/lib/glimmer/swt/custom/shape/rectangle.rb +105 -0
  47. data/lib/glimmer/swt/custom/shape/text.rb +85 -0
  48. data/lib/glimmer/swt/date_time_proxy.rb +9 -3
  49. data/lib/glimmer/swt/dialog_proxy.rb +92 -0
  50. data/lib/glimmer/swt/display_proxy.rb +62 -2
  51. data/lib/glimmer/swt/expand_item_proxy.rb +18 -12
  52. data/lib/glimmer/swt/font_proxy.rb +13 -7
  53. data/lib/glimmer/swt/image_proxy.rb +15 -4
  54. data/lib/glimmer/swt/layout_data_proxy.rb +21 -15
  55. data/lib/glimmer/swt/layout_proxy.rb +19 -15
  56. data/lib/glimmer/swt/menu_proxy.rb +2 -2
  57. data/lib/glimmer/swt/message_box_proxy.rb +21 -7
  58. data/lib/glimmer/swt/properties.rb +3 -0
  59. data/lib/glimmer/swt/proxy_properties.rb +145 -0
  60. data/lib/glimmer/swt/scrolled_composite_proxy.rb +6 -2
  61. data/lib/glimmer/swt/shell_proxy.rb +94 -80
  62. data/lib/glimmer/swt/swt_proxy.rb +16 -0
  63. data/lib/glimmer/swt/tab_item_proxy.rb +5 -3
  64. data/lib/glimmer/swt/table_proxy.rb +32 -11
  65. data/lib/glimmer/swt/transform_proxy.rb +39 -35
  66. data/lib/glimmer/swt/tree_proxy.rb +11 -16
  67. data/lib/glimmer/swt/widget_listener_proxy.rb +6 -2
  68. data/lib/glimmer/swt/widget_proxy.rb +193 -138
  69. data/lib/glimmer/ui.rb +5 -0
  70. data/lib/glimmer/ui/custom_shell.rb +11 -5
  71. data/lib/glimmer/ui/custom_widget.rb +4 -5
  72. data/samples/elaborate/contact_manager.rb +9 -7
  73. data/samples/elaborate/login.rb +27 -21
  74. data/samples/elaborate/mandelbrot_fractal.rb +20 -25
  75. data/samples/elaborate/meta_sample.rb +2 -1
  76. data/samples/elaborate/tetris.rb +3 -1
  77. data/samples/elaborate/tic_tac_toe.rb +18 -14
  78. data/samples/elaborate/tic_tac_toe/board.rb +5 -5
  79. data/samples/elaborate/tic_tac_toe/cell.rb +5 -5
  80. data/samples/elaborate/user_profile.rb +10 -8
  81. data/samples/hello/hello_browser.rb +2 -0
  82. data/samples/hello/hello_button.rb +9 -7
  83. data/samples/hello/hello_canvas.rb +144 -40
  84. data/samples/hello/hello_canvas_animation.rb +2 -0
  85. data/samples/hello/hello_canvas_transform.rb +2 -0
  86. data/samples/hello/hello_checkbox.rb +18 -14
  87. data/samples/hello/hello_checkbox_group.rb +13 -9
  88. data/samples/hello/hello_code_text.rb +2 -0
  89. data/samples/hello/hello_color_dialog.rb +68 -0
  90. data/samples/hello/hello_combo.rb +16 -12
  91. data/samples/hello/hello_computed.rb +9 -7
  92. data/samples/hello/hello_cursor.rb +4 -1
  93. data/samples/hello/hello_custom_shell.rb +18 -21
  94. data/samples/hello/hello_custom_widget.rb +6 -6
  95. data/samples/hello/hello_date_time.rb +16 -12
  96. data/samples/hello/hello_dialog.rb +2 -0
  97. data/samples/hello/hello_directory_dialog.rb +9 -7
  98. data/samples/hello/hello_drag_and_drop.rb +5 -3
  99. data/samples/hello/hello_expand_bar.rb +10 -8
  100. data/samples/hello/hello_file_dialog.rb +9 -7
  101. data/samples/hello/hello_font_dialog.rb +84 -0
  102. data/samples/hello/hello_group.rb +20 -16
  103. data/samples/hello/hello_link.rb +2 -0
  104. data/samples/hello/hello_list_multi_selection.rb +15 -11
  105. data/samples/hello/hello_list_single_selection.rb +15 -11
  106. data/samples/hello/hello_menu_bar.rb +2 -0
  107. data/samples/hello/hello_message_box.rb +2 -0
  108. data/samples/hello/hello_pop_up_context_menu.rb +2 -0
  109. data/samples/hello/hello_progress_bar.rb +5 -5
  110. data/samples/hello/hello_radio.rb +20 -16
  111. data/samples/hello/hello_radio_group.rb +16 -12
  112. data/samples/hello/hello_sash_form.rb +2 -0
  113. data/samples/hello/hello_spinner.rb +9 -7
  114. data/samples/hello/hello_styled_text.rb +19 -17
  115. data/samples/hello/hello_tab.rb +7 -5
  116. data/samples/hello/hello_table.rb +12 -5
  117. data/samples/hello/hello_tree.rb +485 -0
  118. data/samples/hello/hello_world.rb +2 -0
  119. metadata +21 -22
  120. data/lib/glimmer/swt/directory_dialog_proxy.rb +0 -65
  121. data/lib/glimmer/swt/file_dialog_proxy.rb +0 -66
@@ -26,7 +26,9 @@ module Glimmer
26
26
  module SWT
27
27
  class ScrolledCompositeProxy < Glimmer::SWT::WidgetProxy
28
28
  def post_initialize_child(child)
29
- swt_widget.content = child.swt_widget
29
+ auto_exec do
30
+ swt_widget.content = child.swt_widget
31
+ end
30
32
  # TODO consider triggering this method in the future upon resizing of content with a listener (on_control_resized)
31
33
  # child.on_control_resized do
32
34
  # swt_widget.set_min_size(swt_widget.computeSize(child.bounds.width, child.bounds.height))
@@ -38,7 +40,9 @@ module Glimmer
38
40
  end
39
41
 
40
42
  def calculate_min_size
41
- swt_widget.set_min_size(swt_widget.computeSize(SWTProxy[:default], SWTProxy[:default]))
43
+ auto_exec do
44
+ swt_widget.set_min_size(swt_widget.computeSize(SWTProxy[:default], SWTProxy[:default]))
45
+ end
42
46
  end
43
47
  alias recalculate_min_size calculate_min_size
44
48
  end
@@ -42,60 +42,64 @@ module Glimmer
42
42
  # if swt_widget keyword arg was passed, then it is assumed the shell has already been instantiated
43
43
  # and the proxy wraps it instead of creating a new one.
44
44
  def initialize(*args, swt_widget: nil)
45
- if swt_widget
46
- @swt_widget = swt_widget
47
- else
48
- if args.first.respond_to?(:swt_widget) && args.first.swt_widget.is_a?(Shell)
49
- @parent_proxy = args[0]
50
- args[0] = args[0].swt_widget
51
- end
52
- style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}.map(&:to_sym)
53
- fill_screen = nil
54
- if style_args.include?(:fill_screen)
55
- args.delete(:fill_screen)
56
- style_args.delete(:fill_screen)
57
- fill_screen = true
58
- end
59
- if style_args.any?
60
- style_arg_start_index = args.index(style_args.first)
61
- style_arg_last_index = args.index(style_args.last)
62
- args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args]
63
- end
64
- if args.first.nil? || (!args.first.is_a?(Display) && !args.first.is_a?(Shell))
65
- @display = DisplayProxy.instance.swt_display
66
- args = [@display] + args
67
- end
68
- args = args.compact
69
- @swt_widget = Shell.new(*args)
70
- @swt_widget.set_data('proxy', self)
71
- @swt_widget.setLayout(FillLayout.new)
72
- @swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
73
- # TODO make this an option not the default
74
- shell_swt_display = Glimmer::SWT::DisplayProxy.instance.swt_display
75
- on_swt_show do
76
- @swt_widget.set_size(@display.bounds.width, @display.bounds.height) if fill_screen
77
- Thread.new do
78
- sleep(0.25)
79
- shell_swt_display.async_exec do
80
- @swt_widget.setActive unless @swt_widget.isDisposed
45
+ auto_exec do
46
+ if swt_widget
47
+ @swt_widget = swt_widget
48
+ else
49
+ if args.first.respond_to?(:swt_widget) && args.first.swt_widget.is_a?(Shell)
50
+ @parent_proxy = args[0]
51
+ args[0] = args[0].swt_widget
52
+ end
53
+ style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}.map(&:to_sym)
54
+ fill_screen = nil
55
+ if style_args.include?(:fill_screen)
56
+ args.delete(:fill_screen)
57
+ style_args.delete(:fill_screen)
58
+ fill_screen = true
59
+ end
60
+ if style_args.any?
61
+ style_arg_start_index = args.index(style_args.first)
62
+ style_arg_last_index = args.index(style_args.last)
63
+ args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args]
64
+ end
65
+ if args.first.nil? || (!args.first.is_a?(Display) && !args.first.is_a?(Shell))
66
+ @display = DisplayProxy.instance.swt_display
67
+ args = [@display] + args
68
+ end
69
+ args = args.compact
70
+ @swt_widget = Shell.new(*args)
71
+ @swt_widget.set_data('proxy', self)
72
+ @swt_widget.setLayout(FillLayout.new)
73
+ @swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
74
+ # TODO make this an option not the default
75
+ shell_swt_display = Glimmer::SWT::DisplayProxy.instance.swt_display
76
+ on_swt_show do
77
+ @swt_widget.set_size(@display.bounds.width, @display.bounds.height) if fill_screen
78
+ Thread.new do
79
+ sleep(0.25)
80
+ shell_swt_display.async_exec do
81
+ @swt_widget.setActive unless @swt_widget.isDisposed
82
+ end
81
83
  end
82
84
  end
83
85
  end
86
+ on_widget_disposed {
87
+ clear_shapes
88
+ }
89
+ @display ||= @swt_widget.getDisplay
84
90
  end
85
- on_widget_disposed {
86
- clear_shapes
87
- }
88
- @display ||= @swt_widget.getDisplay
89
91
  end
90
92
 
91
93
  # Centers shell within monitor it is in
92
94
  def center_within_display
93
- primary_monitor = @display.getPrimaryMonitor()
94
- monitor_bounds = primary_monitor.getBounds()
95
- shell_bounds = @swt_widget.getBounds()
96
- location_x = monitor_bounds.x + (monitor_bounds.width - shell_bounds.width) / 2
97
- location_y = monitor_bounds.y + (monitor_bounds.height - shell_bounds.height) / 2
98
- @swt_widget.setLocation(location_x, location_y)
95
+ auto_exec do
96
+ primary_monitor = @display.getPrimaryMonitor()
97
+ monitor_bounds = primary_monitor.getBounds()
98
+ shell_bounds = @swt_widget.getBounds()
99
+ location_x = monitor_bounds.x + (monitor_bounds.width - shell_bounds.width) / 2
100
+ location_y = monitor_bounds.y + (monitor_bounds.height - shell_bounds.height) / 2
101
+ @swt_widget.setLocation(location_x, location_y)
102
+ end
99
103
  end
100
104
 
101
105
  # Opens shell and starts SWT's UI thread event loop
@@ -107,18 +111,22 @@ module Glimmer
107
111
 
108
112
  # Opens without starting the event loop.
109
113
  def open_only
110
- if @opened_before
111
- @swt_widget.setVisible(true)
112
- else
113
- @opened_before = true
114
- @swt_widget.pack
115
- center_within_display
116
- @swt_widget.open
114
+ auto_exec do
115
+ if @opened_before
116
+ @swt_widget.setVisible(true)
117
+ else
118
+ @opened_before = true
119
+ @swt_widget.pack
120
+ center_within_display
121
+ @swt_widget.open
122
+ end
117
123
  end
118
124
  end
119
125
 
120
126
  def nested?
121
- !swt_widget&.parent.nil?
127
+ auto_exec do
128
+ !swt_widget&.parent.nil?
129
+ end
122
130
  end
123
131
  alias nested nested?
124
132
 
@@ -129,16 +137,22 @@ module Glimmer
129
137
 
130
138
  # Hides shell. Automatically checks if widget is disposed to avoid crashing.
131
139
  def hide
132
- @swt_widget.setVisible(false) unless @swt_widget.isDisposed
140
+ auto_exec do
141
+ @swt_widget.setVisible(false) unless @swt_widget.isDisposed
142
+ end
133
143
  end
134
144
 
135
145
  # Closes shell. Automatically checks if widget is disposed to avoid crashing.
136
146
  def close
137
- @swt_widget.close unless @swt_widget.isDisposed
147
+ auto_exec do
148
+ @swt_widget.close unless @swt_widget.isDisposed
149
+ end
138
150
  end
139
151
 
140
152
  def visible?
141
- @swt_widget.isDisposed ? false : @swt_widget.isVisible
153
+ auto_exec do
154
+ @swt_widget.isDisposed ? false : @swt_widget.isVisible
155
+ end
142
156
  end
143
157
  alias visible visible?
144
158
 
@@ -151,25 +165,23 @@ module Glimmer
151
165
  DisplayProxy.instance.focus_control&.shell == swt_widget
152
166
  end
153
167
 
154
- def pack
155
- @swt_widget.pack
156
- end
157
-
158
168
  def pack_same_size
159
- bounds = @swt_widget.getBounds
160
- if OS.mac?
161
- @swt_widget.pack
162
- @swt_widget.setBounds(bounds)
163
- elsif OS.windows? || OS::Underlying.windows?
164
- minimum_size = @swt_widget.getMinimumSize
165
- @swt_widget.setMinimumSize(bounds.width, bounds.height)
166
- listener = on_control_resized { @swt_widget.setBounds(bounds) }
167
- @swt_widget.layout(true, true)
168
- @swt_widget.removeControlListener(listener.swt_listener)
169
- @swt_widget.setMinimumSize(minimum_size)
170
- elsif OS.linux?
171
- @swt_widget.layout(true, true)
172
- @swt_widget.setBounds(bounds)
169
+ auto_exec do
170
+ bounds = @swt_widget.getBounds
171
+ if OS.mac?
172
+ @swt_widget.pack
173
+ @swt_widget.setBounds(bounds)
174
+ elsif OS.windows? || OS::Underlying.windows?
175
+ minimum_size = @swt_widget.getMinimumSize
176
+ @swt_widget.setMinimumSize(bounds.width, bounds.height)
177
+ listener = on_control_resized { @swt_widget.setBounds(bounds) }
178
+ @swt_widget.layout(true, true)
179
+ @swt_widget.removeControlListener(listener.swt_listener)
180
+ @swt_widget.setMinimumSize(minimum_size)
181
+ elsif OS.linux?
182
+ @swt_widget.layout(true, true)
183
+ @swt_widget.setBounds(bounds)
184
+ end
173
185
  end
174
186
  end
175
187
 
@@ -184,11 +196,13 @@ module Glimmer
184
196
  # https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html
185
197
  # This method is not needed except in rare circumstances where there is a need to start the SWT Event Loop before opening the shell.
186
198
  def start_event_loop
187
- until @swt_widget.isDisposed
188
- begin
189
- @display.sleep unless @display.readAndDispatch
190
- rescue => e
191
- Glimmer::Config.logger.info {e.full_message}
199
+ auto_exec do
200
+ until @swt_widget.isDisposed
201
+ begin
202
+ @display.sleep unless @display.readAndDispatch
203
+ rescue => e
204
+ Glimmer::Config.logger.info {e.full_message}
205
+ end
192
206
  end
193
207
  end
194
208
  end
@@ -49,6 +49,22 @@ module Glimmer
49
49
  def extra_styles
50
50
  EXTRA_STYLES
51
51
  end
52
+
53
+ def cursor_styles
54
+ SWT.constants.select {|c| c.to_s.start_with?('CURSOR_')}
55
+ end
56
+
57
+ def color_styles
58
+ SWT.constants.select {|c| c.to_s.start_with?('COLOR_')}
59
+ end
60
+
61
+ def cursor_options
62
+ cursor_styles.map {|c| c.to_s.sub('CURSOR_', '').downcase}.map(&:to_sym)
63
+ end
64
+
65
+ def color_options
66
+ color_styles.map {|c| c.to_s.sub('COLOR_', '').downcase}.map(&:to_sym)
67
+ end
52
68
  end
53
69
 
54
70
  EXTRA_STYLES = {
@@ -83,9 +83,11 @@ module Glimmer
83
83
  end
84
84
 
85
85
  def dispose
86
- swt_tab_item.setControl(nil)
87
- swt_widget.dispose
88
- swt_tab_item.dispose
86
+ auto_exec do
87
+ swt_tab_item.setControl(nil)
88
+ swt_widget.dispose
89
+ swt_tab_item.dispose
90
+ end
89
91
  end
90
92
  end
91
93
  end
@@ -266,15 +266,21 @@ module Glimmer
266
266
  end
267
267
 
268
268
  def items
269
- swt_widget.get_items
269
+ auto_exec do
270
+ swt_widget.get_items
271
+ end
270
272
  end
271
273
 
272
274
  def model_binding
273
- swt_widget.data
275
+ auto_exec do
276
+ swt_widget.data
277
+ end
274
278
  end
275
279
 
276
280
  def table_items_binding
277
- swt_widget.get_data('table_items_binding')
281
+ auto_exec do
282
+ swt_widget.get_data('table_items_binding')
283
+ end
278
284
  end
279
285
 
280
286
  def sort_block=(comparator)
@@ -313,7 +319,10 @@ module Glimmer
313
319
 
314
320
  # Sorts by specified TableColumnProxy object. If nil, it uses the table default sort instead.
315
321
  def sort_by_column!(table_column_proxy=nil)
316
- index = swt_widget.columns.to_a.index(table_column_proxy.swt_widget) unless table_column_proxy.nil?
322
+ index = nil
323
+ auto_exec do
324
+ index = swt_widget.columns.to_a.index(table_column_proxy.swt_widget) unless table_column_proxy.nil?
325
+ end
317
326
  new_sort_property = table_column_proxy.nil? ? @sort_property : table_column_proxy.sort_property || [column_properties[index]]
318
327
  return if table_column_proxy.nil? && new_sort_property.nil? && @sort_block.nil? && @sort_by_block.nil?
319
328
  if new_sort_property && table_column_proxy.nil? && new_sort_property.size == 1 && (index = column_sort_properties.index(new_sort_property))
@@ -330,12 +339,16 @@ module Glimmer
330
339
  end
331
340
 
332
341
  @sort_direction = @sort_direction.nil? || @sort_property.first != new_sort_property.first || @sort_direction == :descending ? :ascending : :descending
333
- swt_widget.sort_direction = @sort_direction == :ascending ? SWTProxy[:up] : SWTProxy[:down]
342
+ auto_exec do
343
+ swt_widget.sort_direction = @sort_direction == :ascending ? SWTProxy[:up] : SWTProxy[:down]
344
+ end
334
345
 
335
346
  @sort_property = [new_sort_property].flatten.compact
336
347
  table_column_index = column_properties.index(new_sort_property.to_s.to_sym)
337
348
  table_column_proxy ||= table_column_proxies[table_column_index] if table_column_index
338
- swt_widget.sort_column = table_column_proxy.swt_widget if table_column_proxy
349
+ auto_exec do
350
+ swt_widget.sort_column = table_column_proxy.swt_widget if table_column_proxy
351
+ end
339
352
 
340
353
  if table_column_proxy
341
354
  @sort_by_block = nil
@@ -405,14 +418,18 @@ module Glimmer
405
418
 
406
419
  def cells
407
420
  column_count = @table.column_properties.size
408
- swt_widget.items.map {|item| column_count.times.map {|i| item.get_text(i)} }
421
+ auto_exec do
422
+ swt_widget.items.map {|item| column_count.times.map {|i| item.get_text(i)} }
423
+ end
409
424
  end
410
425
 
411
426
  # Performs a search for table items matching block condition
412
427
  # If no condition block is passed, returns all table items
413
428
  # Returns a Java TableItem array to easily set as selection on org.eclipse.swt.Table if needed
414
429
  def search(&condition)
415
- swt_widget.getItems.select {|item| condition.nil? || condition.call(item)}.to_java(TableItem)
430
+ auto_exec do
431
+ swt_widget.getItems.select {|item| condition.nil? || condition.call(item)}.to_java(TableItem)
432
+ end
416
433
  end
417
434
 
418
435
  # Returns all table items including descendants
@@ -454,7 +471,9 @@ module Glimmer
454
471
  end
455
472
 
456
473
  def edit_selected_table_item(column_index, before_write: nil, after_write: nil, after_cancel: nil)
457
- edit_table_item(swt_widget.getSelection.first, column_index, before_write: before_write, after_write: after_write, after_cancel: after_cancel)
474
+ auto_exec do
475
+ edit_table_item(swt_widget.getSelection.first, column_index, before_write: before_write, after_write: after_write, after_cancel: after_cancel)
476
+ end
458
477
  end
459
478
 
460
479
  def edit_table_item(table_item, column_index, before_write: nil, after_write: nil, after_cancel: nil, write_on_cancel: false)
@@ -512,7 +531,9 @@ module Glimmer
512
531
  model.send("#{model_editing_property}=", new_value) # makes table update itself, so must search for selected table item again
513
532
  # Table refresh happens here because of model update triggering observers, so must retrieve table item again
514
533
  edited_table_item = search { |ti| ti.getData == model }.first
515
- swt_widget.showItem(edited_table_item)
534
+ auto_exec do
535
+ swt_widget.showItem(edited_table_item)
536
+ end
516
537
  @table_editor_widget_proxy&.swt_widget&.dispose
517
538
  @table_editor_widget_proxy = nil
518
539
  if after_write&.arity == 0
@@ -524,7 +545,7 @@ module Glimmer
524
545
  end
525
546
  end
526
547
  end
527
-
548
+
528
549
  content {
529
550
  @table_editor_widget_proxy = TableProxy::editors.symbolize_keys[editor_widget][:editor_gui].call(editor_widget_args, model, model_editing_property, self)
530
551
  }
@@ -20,7 +20,7 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  require 'glimmer/swt/display_proxy'
23
- require 'glimmer/swt/properties'
23
+ require 'glimmer/swt/proxy_properties'
24
24
  require 'glimmer/swt/custom/shape'
25
25
 
26
26
  module Glimmer
@@ -29,7 +29,7 @@ module Glimmer
29
29
  #
30
30
  # Follows the Proxy Design Pattern
31
31
  class TransformProxy
32
- include Properties
32
+ include ProxyProperties
33
33
 
34
34
  include_package 'org.eclipse.swt.graphics'
35
35
  include_package 'org.eclipse.swt.widgets'
@@ -37,32 +37,36 @@ module Glimmer
37
37
  attr_reader :swt_transform, :parent
38
38
 
39
39
  def initialize(parent, *args, swt_transform: nil, multiply: false)
40
- @parent = parent
41
- @multiply = multiply
42
- if swt_transform.nil?
43
- if !args.first.is_a?(Display) && !args.first.is_a?(DisplayProxy)
44
- args.prepend DisplayProxy.instance.swt_display
45
- end
46
- if args.first.is_a?(DisplayProxy)
47
- args[0] = args[0].swt_display
48
- end
49
- if args.last.is_a?(TransformProxy)
50
- args[-1] = args[-1].swt_transform
51
- end
52
- if args.last.nil? || args.last.is_a?(Transform)
53
- @swt_transform = args.last
54
- @parent&.set_attribute('transform', self)
40
+ Glimmer::SWT::DisplayProxy.instance.auto_exec do
41
+ @parent = parent
42
+ @multiply = multiply
43
+ if swt_transform.nil?
44
+ if !args.first.is_a?(Display) && !args.first.is_a?(DisplayProxy)
45
+ args.prepend DisplayProxy.instance.swt_display
46
+ end
47
+ if args.first.is_a?(DisplayProxy)
48
+ args[0] = args[0].swt_display
49
+ end
50
+ if args.last.is_a?(TransformProxy)
51
+ args[-1] = args[-1].swt_transform
52
+ end
53
+ if args.last.nil? || args.last.is_a?(Transform)
54
+ @swt_transform = args.last
55
+ @parent&.set_attribute('transform', self)
56
+ else
57
+ @swt_transform = Transform.new(*args)
58
+ end
55
59
  else
56
- @swt_transform = Transform.new(*args)
60
+ @swt_transform = swt_transform
57
61
  end
58
- else
59
- @swt_transform = swt_transform
60
62
  end
61
63
  end
62
64
 
63
65
  def post_add_content
64
66
  if @multiply
65
- @parent.multiply(@swt_transform)
67
+ Glimmer::SWT::DisplayProxy.instance.auto_exec {
68
+ @parent.multiply(@swt_transform)
69
+ }
66
70
  else
67
71
  @parent&.set_attribute('transform', self)
68
72
  end
@@ -72,32 +76,32 @@ module Glimmer
72
76
  Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::SWT::TransformExpression.new, &block)
73
77
  end
74
78
 
79
+ def proxy_source_object
80
+ @swt_transform
81
+ end
82
+
75
83
  def has_attribute?(attribute_name, *args)
76
- @swt_transform.respond_to?(attribute_name) || @swt_transform.respond_to?(attribute_setter(attribute_name))
84
+ Glimmer::SWT::DisplayProxy.instance.auto_exec { @swt_transform.respond_to?(attribute_name) } || super
77
85
  end
78
86
 
79
87
  def set_attribute(attribute_name, *args)
80
88
  if @swt_transform.respond_to?(attribute_name)
81
- @swt_transform.send(attribute_name, *args)
82
- elsif @swt_transform.respond_to?(attribute_setter(attribute_name))
83
- @swt_transform.send(attribute_setter(attribute_name), *args)
84
- end
85
- end
86
-
87
- def get_attribute(attribute_name)
88
- if @swt_transform.respond_to?(attribute_getter(attribute_name))
89
- @swt_transform.send(attribute_getter(attribute_name))
89
+ Glimmer::SWT::DisplayProxy.instance.auto_exec { @swt_transform.send(attribute_name, *args) }
90
90
  else
91
- @swt_transform.send(attribute_name)
91
+ super
92
92
  end
93
93
  end
94
94
 
95
95
  def method_missing(method_name, *args, &block)
96
- result = @swt_transform.send(method_name, *args, &block)
96
+ result = Glimmer::SWT::DisplayProxy.instance.auto_exec { @swt_transform.send(method_name, *args, &block) }
97
97
  result.nil? ? self : result
98
98
  rescue => e
99
- Glimmer::Config.logger.debug {"Neither MessageBoxProxy nor #{@swt_transform.class.name} can handle the method ##{method}"}
100
- super
99
+ begin
100
+ super
101
+ rescue Exception => inner_e
102
+ Glimmer::Config.logger.error {"Neither TransformProxy nor #{@swt_transform.class.name} can handle the method ##{method}"}
103
+ Glimmer::Config.logger.error {e.full_message}
104
+ end
101
105
  end
102
106
 
103
107
  def respond_to?(method, *args, &block)