glimmer-dsl-swt 4.24.4.3 → 4.24.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b47f7d900d7e9e17d688b2a87f6996e2a4e23f2aec2139b7d5efc03fc1837d7
4
- data.tar.gz: 0dd67034463fa4193ebbb4c064f6d2dccfd26dde29d326fef69b8a12b80a04a6
3
+ metadata.gz: e66b329b7d9bf09db34b1b4b9d98a42b52793a6822512ecb1cd95b55a9a8e664
4
+ data.tar.gz: 2840c2f1c4cb5064afd54e8723668de648541568cdc9d23626fd07c791bfe1bd
5
5
  SHA512:
6
- metadata.gz: 5737d7b9ad280998dfe94b4e4df7879ee48ff805c2abb0bb1626a3d688684371c2aca03c0da8eb27e2011a4ab26e58f3e4c3a44154056d7197a66acfb89ef4c1
7
- data.tar.gz: 05e8484a449adcbd19a4f1b4ba8644614032a272ec957770bbbc1c11cdbea8299fdeaed0ebcbf42df493280782d6b425ec4d967dca8f967a6fc1a1a95dbaeff2
6
+ metadata.gz: 5072ef09d0a73a58f4e8957c1e69efb69843fb31eeb658513368287754357833f69ab263acc36395242c12f9089a48e48541d68abc4dbf1bb1acc06ef4dfd0d5
7
+ data.tar.gz: 9ea20dfe409781ec75beed5f5f68afee7e91e09d4a0c14bb43b002525497dcd3948257eccabd8c9513597b108b4e5d051f38faa0c2459c5e44a7a398ee4601f9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.24.4.4
4
+
5
+ - Support `refined_table` `selection` data-binding
6
+ - Remove extra horizontal/vertical margins in `refined_table` pagination area
7
+ - Update Hello, Refined Table! to support booking a game with right-click pop up context menu
8
+ - Have `Glimmer::UI::CustomWidget` better delegate listners and data-binding observers to `@children_owner` when set
9
+
3
10
  ## 4.24.4.3
4
11
 
5
12
  - Fix issue with failed `table` extra property data-binding (e.g. foreground color, background color) due to asynchronous multi-threading optimization (now it works).
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.24.4.3
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.24.4.4
2
2
  ## JRuby Desktop Development GUI Framework
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -21,7 +21,7 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
21
21
 
22
22
  ![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
23
23
 
24
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.4.3 includes [SWT 4.24](https://download.eclipse.org/eclipse/downloads/drops4/R-4.24-202206070700/), which was released on June 7, 2022. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
24
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.4.4 includes [SWT 4.24](https://download.eclipse.org/eclipse/downloads/drops4/R-4.24-202206070700/), which was released on June 7, 2022. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
25
25
 
26
26
  **Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword. That was [originally conceived back in 2007](https://andymaleh.blogspot.com/2007/12/data-shining-in-glimmer.html).
27
27
 
@@ -338,7 +338,7 @@ jgem install glimmer-dsl-swt
338
338
 
339
339
  Or this command if you want a specific version:
340
340
  ```
341
- jgem install glimmer-dsl-swt -v 4.24.4.3
341
+ jgem install glimmer-dsl-swt -v 4.24.4.4
342
342
  ```
343
343
 
344
344
  `jgem` is JRuby's version of `gem` command.
@@ -366,7 +366,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
366
366
 
367
367
  Add the following to `Gemfile`:
368
368
  ```
369
- gem 'glimmer-dsl-swt', '~> 4.24.4.3'
369
+ gem 'glimmer-dsl-swt', '~> 4.24.4.4'
370
370
  ```
371
371
 
372
372
  And, then run:
@@ -389,7 +389,7 @@ glimmer
389
389
  ```
390
390
 
391
391
  ```
392
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.4.3
392
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.4.4
393
393
 
394
394
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
395
395
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.24.4.3
1
+ 4.24.4.4
@@ -3732,7 +3732,7 @@ shell {
3732
3732
 
3733
3733
  Screenshot:
3734
3734
 
3735
- ![Canvas Animation Example](/images/glimmer-example-canvas-animation.png)
3735
+ ![Canvas Animation Example](/images/glimmer-example-canvas-animation.gif)
3736
3736
 
3737
3737
  Keywords:
3738
3738
  - `animation` declares an animation under a canvas, which renders frames using a frame block indefinitely or finitely depending on (cycle_count/frame_count) properties
@@ -793,6 +793,14 @@ Hello, Refined Table!
793
793
 
794
794
  ![Hello Refined Table](/images/glimmer-hello-refined-table.png)
795
795
 
796
+ Hello, Refined Table! Booking Menu
797
+
798
+ ![Hello Refined Table](/images/glimmer-hello-refined-table-booking-menu.png)
799
+
800
+ Hello, Refined Table! Game Booked
801
+
802
+ ![Hello Refined Table](/images/glimmer-hello-refined-table-game-booked.png)
803
+
796
804
  #### Hello, Link!
797
805
 
798
806
  This sample demonstrates the use of the `link` widget in Glimmer, including identifying which link was clicked and performing an action (displaying help) based on its location.
Binary file
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2022 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -54,7 +54,7 @@ module Glimmer
54
54
  filter_and_paginate
55
55
  end
56
56
  @table_proxy.content {
57
- items(dsl: true) <=> [self, :refined_model_array, model_binding.binding_options.merge(read_only: true)]
57
+ items <=> [self, :refined_model_array, model_binding.binding_options.merge(read_only: true)]
58
58
  }
59
59
  filter_and_paginate
60
60
  end
@@ -82,7 +82,10 @@ module Glimmer
82
82
  composite {
83
83
  layout_data(:fill, :center, true, false)
84
84
 
85
- fill_layout(:horizontal)
85
+ fill_layout(:horizontal) {
86
+ margin_width 0
87
+ margin_height 0
88
+ }
86
89
 
87
90
  @first_button_proxy = button {
88
91
  text '<<'
@@ -169,29 +172,7 @@ module Glimmer
169
172
  def last_button_block=(block)
170
173
  @last_button_proxy.content(&block)
171
174
  end
172
-
173
- def method_missing(method_name, *args, &block)
174
- dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
175
- if dsl_mode
176
- args.pop if args.last.is_a?(Hash) && args.last[:dsl]
177
- super(method_name, *args, &block)
178
- elsif @table_proxy&.respond_to?(method_name, *args, &block)
179
- @table_proxy&.send(method_name, *args, &block)
180
- else
181
- super
182
- end
183
- end
184
-
185
- def respond_to?(method_name, *args, &block)
186
- dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
187
- if dsl_mode
188
- args = args[0...-1] if args.last.is_a?(Hash) && args.last[:dsl]
189
- super(method_name, *args, &block)
190
- else
191
- super || @table_proxy&.respond_to?(method_name, *args, &block)
192
- end
193
- end
194
-
175
+
195
176
  def page_count
196
177
  (filtered_model_array && (filtered_model_array.count / per_page.to_f).ceil) || 0
197
178
  end
@@ -57,6 +57,7 @@ module Glimmer
57
57
 
58
58
  swt_widget_class = self.class.swt_widget_class_for('menu')
59
59
  if parent.swt_widget.is_a?(Menu)
60
+ # TODO support CustomWidget children_owner
60
61
  @menu_item_proxy = SWT::WidgetProxy.new('menu_item', parent, [:cascade] + [index].compact)
61
62
  @swt_menu_item = @menu_item_proxy.swt_widget
62
63
  @swt_widget = swt_widget_class.new(@menu_item_proxy.swt_widget)
@@ -64,6 +65,7 @@ module Glimmer
64
65
  elsif parent.swt_widget.is_a?(Shell)
65
66
  @swt_widget = swt_widget_class.new(parent.swt_widget, style('menu', styles))
66
67
  elsif parent.swt_widget.is_a?(TrayItem)
68
+ # TODO support CustomWidget children_owner
67
69
  @swt_widget = swt_widget_class.new(parent.shell_proxy.swt_widget, style('menu', styles))
68
70
  parent.menu_proxy = self
69
71
  else
@@ -159,8 +159,7 @@ module Glimmer
159
159
  @parent_proxy = parent
160
160
  styles, extra_options = extract_args(underscored_widget_name, args)
161
161
  swt_widget_class = self.class.swt_widget_class_for(underscored_widget_name)
162
- swt_widget_producer = @parent_proxy.respond_to?(:children_owner) ? @parent_proxy.children_owner : @parent_proxy
163
- @swt_widget = swt_widget_class.new(swt_widget_producer.swt_widget, style(underscored_widget_name, styles), *extra_options)
162
+ @swt_widget = swt_widget_class.new(@parent_proxy.swt_widget, style(underscored_widget_name, styles), *extra_options)
164
163
  else
165
164
  @swt_widget = swt_widget
166
165
  underscored_widget_name = self.class.underscored_widget_name(@swt_widget)
@@ -40,13 +40,21 @@ module Glimmer
40
40
 
41
41
  def initialize(parent, *swt_constants, options, &content)
42
42
  super
43
- auto_exec do
44
- @swt_widget.set_data('custom_shell', self)
45
- @swt_widget.set_data('custom_window', self)
46
- end
47
43
  raise Error, 'Invalid custom shell (window) body root! Must be a shell (window) or another custom shell (window).' unless body_root.swt_widget.is_a?(org.eclipse.swt.widgets.Shell)
48
44
  end
49
45
 
46
+ def swt_widget
47
+ if @swt_widget.nil? && children_owner
48
+ @swt_widget = children_owner.swt_widget
49
+ auto_exec do
50
+ @swt_widget.set_data('custom_widget', self)
51
+ @swt_widget.set_data('custom_shell', self)
52
+ @swt_widget.set_data('custom_window', self)
53
+ end
54
+ end
55
+ @swt_widget
56
+ end
57
+
50
58
  # Classes may override
51
59
  def open
52
60
  body_root.open
@@ -161,13 +161,13 @@ module Glimmer
161
161
  end
162
162
  end
163
163
 
164
- attr_reader :body_root, :swt_widget, :parent, :parent_proxy, :swt_style, :options
164
+ attr_reader :body_root, :parent, :parent_proxy, :swt_style, :options
165
165
 
166
166
  def initialize(parent, *swt_constants, options, &content)
167
167
  SWT::DisplayProxy.current_custom_widgets_and_shapes << self
168
168
  @parent_proxy = @parent = parent
169
169
  @parent_proxy = @parent&.get_data('proxy') if @parent.respond_to?(:get_data) && @parent.get_data('proxy')
170
- @swt_style = SWT::SWTProxy[*swt_constants]
170
+ @swt_style = SWT::SWTProxy[*swt_constants] # TODO support non-standard styles like :editable, perhaps by packing in an array instead of interpreting right away
171
171
  options ||= {}
172
172
  @options = self.class.options.merge(options)
173
173
  @content = Util::ProcTracker.new(content) if content
@@ -176,9 +176,8 @@ module Glimmer
176
176
  raise Glimmer::Error, 'Invalid custom widget for having no body! Please define body block!' if body_block.nil?
177
177
  @body_root = auto_exec { instance_exec(&body_block) }
178
178
  raise Glimmer::Error, 'Invalid custom widget for having an empty body! Please fill body block!' if @body_root.nil?
179
- @swt_widget = @body_root.swt_widget
180
179
  auto_exec do
181
- @swt_widget.set_data('custom_widget', self)
180
+ @body_root.set_data('custom_widget', self)
182
181
  end
183
182
  auto_exec { execute_hook('after_body') }
184
183
  auto_exec do
@@ -201,6 +200,16 @@ module Glimmer
201
200
  SWT::DisplayProxy.current_custom_widgets_and_shapes.delete(self)
202
201
  end
203
202
 
203
+ def swt_widget
204
+ if @swt_widget.nil? && children_owner
205
+ @swt_widget = children_owner.swt_widget
206
+ auto_exec do
207
+ @swt_widget.set_data('custom_widget', self)
208
+ end
209
+ end
210
+ @swt_widget
211
+ end
212
+
204
213
  def observer_registrations
205
214
  @observer_registrations ||= []
206
215
  end
@@ -212,7 +221,9 @@ module Glimmer
212
221
  property = observation_request.sub(/^on_updated_/, '')
213
222
  result = can_add_observer?(property)
214
223
  end
215
- result || body_root&.can_handle_observation_request?(observation_request)
224
+ result ||
225
+ (children_owner != body_root && children_owner&.can_handle_observation_request?(observation_request)) ||
226
+ body_root&.can_handle_observation_request?(observation_request)
216
227
  end
217
228
 
218
229
  def handle_observation_request(observation_request, &block)
@@ -220,18 +231,25 @@ module Glimmer
220
231
  if observation_request.start_with?('on_updated_')
221
232
  property = observation_request.sub(/^on_updated_/, '') # TODO look into eliminating duplication from above
222
233
  add_observer(DataBinding::Observer.proc(&block), property) if can_add_observer?(property)
234
+ elsif children_owner != body_root && children_owner&.can_handle_observation_request?(observation_request)
235
+ children_owner.handle_observation_request(observation_request, &block)
223
236
  else
224
237
  body_root.handle_observation_request(observation_request, &block)
225
238
  end
226
239
  end
227
240
 
228
241
  def can_add_observer?(attribute_name)
229
- has_instance_method?(attribute_name) || has_instance_method?("#{attribute_name}?") || @body_root.can_add_observer?(attribute_name)
242
+ has_instance_method?(attribute_name) ||
243
+ has_instance_method?("#{attribute_name}?") ||
244
+ (children_owner != @body_root && children_owner.can_add_observer?(attribute_name)) ||
245
+ @body_root.can_add_observer?(attribute_name)
230
246
  end
231
247
 
232
248
  def add_observer(observer, attribute_name)
233
249
  if has_instance_method?(attribute_name)
234
250
  super
251
+ elsif children_owner != @body_root && children_owner.can_add_observer?(attribute_name)
252
+ children_owner.add_observer(observer, attribute_name)
235
253
  else
236
254
  @body_root.add_observer(observer, attribute_name)
237
255
  end
@@ -239,12 +257,15 @@ module Glimmer
239
257
 
240
258
  def has_attribute?(attribute_name, *args)
241
259
  has_instance_method?(attribute_setter(attribute_name)) ||
260
+ (children_owner != @body_root && children_owner.has_attribute?(attribute_name, *args)) ||
242
261
  @body_root.has_attribute?(attribute_name, *args)
243
262
  end
244
263
 
245
264
  def set_attribute(attribute_name, *args)
246
265
  if has_instance_method?(attribute_setter(attribute_name))
247
266
  send(attribute_setter(attribute_name), *args)
267
+ elsif (children_owner != @body_root && children_owner.has_attribute?(attribute_name, *args))
268
+ children_owner.set_attribute(attribute_name, *args)
248
269
  else
249
270
  @body_root.set_attribute(attribute_name, *args)
250
271
  end
@@ -262,6 +283,8 @@ module Glimmer
262
283
  def get_attribute(attribute_name)
263
284
  if has_instance_method?(attribute_name)
264
285
  send(attribute_name)
286
+ elsif children_owner != @body_root && children_owner.has_attribute?(attribute_name)
287
+ children_owner.get_attribute(attribute_name)
265
288
  else
266
289
  @body_root.get_attribute(attribute_name)
267
290
  end
@@ -317,6 +340,8 @@ module Glimmer
317
340
  # but fail the glimmer DSL for the right reason to avoid seeing noise in the log output
318
341
  if block && can_handle_observation_request?(method)
319
342
  handle_observation_request(method, &block)
343
+ elsif children_owner != @body_root && children_owner.respond_to?(method, *args, &block)
344
+ children_owner.send(method, *args, &block)
320
345
  else
321
346
  body_root.send(method, *args, &block)
322
347
  end
@@ -326,6 +351,7 @@ module Glimmer
326
351
  def respond_to?(method, *args, &block)
327
352
  super or
328
353
  can_handle_observation_request?(method) or
354
+ children_owner.respond_to?(method, *args, &block) or
329
355
  body_root.respond_to?(method, *args, &block)
330
356
  end
331
357
 
@@ -78,9 +78,15 @@ class HelloRefinedTable
78
78
  def ballpark
79
79
  home_team.ballpark
80
80
  end
81
+
82
+ def to_s
83
+ "#{home_team_name} vs #{away_team_name} at #{ballpark}"
84
+ end
81
85
  end
82
86
 
83
87
  BaseballSeason = Struct.new(:year) do
88
+ attr_accessor :selected_game
89
+
84
90
  def games
85
91
  if @games.nil?
86
92
  @games = []
@@ -149,7 +155,21 @@ class HelloRefinedTable
149
155
  text 'Away Team'
150
156
  }
151
157
 
158
+ menu {
159
+ menu_item {
160
+ text 'Book'
161
+
162
+ on_widget_selected do
163
+ message_box {
164
+ text 'Game Booked!'
165
+ message "The game \"#{@baseball_season.selected_game}\" has been booked!"
166
+ }.open
167
+ end
168
+ }
169
+ }
170
+
152
171
  model_array <= [@baseball_season, :games, column_attributes: {'Home Team' => :home_team_name, 'Away Team' => :away_team_name}]
172
+ selection <=> [@baseball_season, :selected_game]
153
173
  }
154
174
  }
155
175
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.24.4.3
4
+ version: 4.24.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-13 00:00:00.000000000 Z
11
+ date: 2022-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement