glimmer-dsl-swt 4.20.2.1 → 4.20.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +6 -6
  4. data/VERSION +1 -1
  5. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +5 -2
  6. data/glimmer-dsl-swt.gemspec +0 -0
  7. data/lib/glimmer/data_binding/shine.rb +0 -3
  8. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
  9. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +1 -1
  10. data/lib/glimmer/dsl/swt/shine_data_binding_expression.rb +0 -2
  11. data/lib/glimmer/rake_task/scaffold.rb +2 -2
  12. data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
  13. data/lib/glimmer/swt/custom/radio_group.rb +2 -1
  14. data/lib/glimmer/swt/proxy_properties.rb +5 -5
  15. data/lib/glimmer/swt/widget_proxy.rb +3 -0
  16. data/lib/glimmer/ui/custom_shape.rb +1 -1
  17. data/lib/glimmer/ui/custom_widget.rb +1 -1
  18. data/samples/elaborate/calculator.rb +1 -1
  19. data/samples/elaborate/contact_manager.rb +1 -1
  20. data/samples/elaborate/meta_sample.rb +5 -5
  21. data/samples/elaborate/tetris/view/bevel.rb +11 -11
  22. data/samples/elaborate/tetris/view/block.rb +1 -1
  23. data/samples/elaborate/tetris/view/high_score_dialog.rb +3 -3
  24. data/samples/elaborate/tetris/view/score_lane.rb +3 -3
  25. data/samples/elaborate/tetris/view/tetris_menu_bar.rb +9 -9
  26. data/samples/elaborate/timer.rb +8 -8
  27. data/samples/hello/hello_checkbox_group.rb +1 -1
  28. data/samples/hello/hello_code_text.rb +3 -3
  29. data/samples/hello/hello_cool_bar.rb +1 -1
  30. data/samples/hello/hello_cursor.rb +1 -1
  31. data/samples/hello/hello_custom_shell.rb +1 -1
  32. data/samples/hello/hello_directory_dialog.rb +1 -1
  33. data/samples/hello/hello_radio_group.rb +2 -2
  34. data/samples/hello/hello_table.rb +1 -1
  35. data/samples/hello/hello_tool_bar.rb +1 -1
  36. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba041a49dabbc3bbe0b3ac98cb5ba113b386087149563a331290fba998a45887
4
- data.tar.gz: 042ea65040e8b874f8477fa87266ae48c88affd922b824f64e1ab891b28f85ff
3
+ metadata.gz: 581c69384ecd98621e42b9c109b26606bd02f971645d560b6a327a2afef193cd
4
+ data.tar.gz: ff868723057cdcc85357713f63f1bcc449505bb79e28714e1ce95eada387c0e5
5
5
  SHA512:
6
- metadata.gz: 755a71479d44c7bcb3efd6a4f4ae1e0c6d378f25374584bca4f1fe7ede096d683b6770016eb4566bbacb2c40bf2b64300846e57408cf0ca5745910bba68801ac
7
- data.tar.gz: 75617372b2e04e5064cfa0a408504e43a4defd25194f1b16f27a91ca8275865dd3337ac76397087ac74e9878f51d194d7626c227509b9ac93a823a14faba0a4f
6
+ metadata.gz: fa48a538274e9a199d9f332d1fec5e3c99d235509673fcf2de5b3c646aa38306a093368adefe5161b81dcc8530b411b5bb1b304700cca4762d655185e5550916
7
+ data.tar.gz: 1d04d38dcda31ef8c02c015cd558e62dc29ff54ad2e295d548f91633b8b6b6ec5e98dc9ef514c2250e4d90cce1a1764feb3be626af8a843bfb95a07722f2dbc6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.20.3.0
4
+
5
+ - Shine data-binding support for `custom widgets`, `custom shells`, and `custom shapes`
6
+ - Update remaining samples with `bind` keyword to switch to Shine data-binding syntax
7
+ - Switch scaffolded classes' data-binding to Shine
8
+ - Fix `table` Shine syntax support for unidirectional (one-way) data-binding
9
+
3
10
  ### 4.20.2.1
4
11
 
5
12
  - Shine data-binding support for `animation` (also supporting `#content {}` method in `Animation`)
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.20.2.0
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.20.3.0
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)
@@ -15,9 +15,9 @@
15
15
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
16
16
  Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
17
17
 
18
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.2.0 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. 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. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
18
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.3.0 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. 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. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
19
19
 
20
- **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 (keep in mind that it is still an early alpha, so default back to `bind` whenever needed).
20
+ **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 (keep in mind that it is still an alpha, so default back to `bind` whenever needed).
21
21
 
22
22
  Please help make [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) better by providing feedback and [contributing](#contributing) whenever possible. Any feature suggestions that are accepted could be implemented within weeks if not days.
23
23
 
@@ -347,7 +347,7 @@ jgem install glimmer-dsl-swt
347
347
 
348
348
  Or this command if you want a specific version:
349
349
  ```
350
- jgem install glimmer-dsl-swt -v 4.20.2.0
350
+ jgem install glimmer-dsl-swt -v 4.20.3.0
351
351
  ```
352
352
 
353
353
  `jgem` is JRuby's version of `gem` command.
@@ -375,7 +375,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
375
375
 
376
376
  Add the following to `Gemfile`:
377
377
  ```
378
- gem 'glimmer-dsl-swt', '~> 4.20.2.0'
378
+ gem 'glimmer-dsl-swt', '~> 4.20.3.0'
379
379
  ```
380
380
 
381
381
  And, then run:
@@ -396,7 +396,7 @@ glimmer
396
396
  ```
397
397
 
398
398
  ```
399
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.2.0
399
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.3.0
400
400
 
401
401
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
402
402
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.20.2.1
1
+ 4.20.3.0
@@ -2278,13 +2278,16 @@ Example from [samples/hello/hello_combo.rb](samples/hello_combo.rb) sample (you
2278
2278
 
2279
2279
  #### Shine
2280
2280
 
2281
- **(EARLY ALPHA FEATURE)**
2281
+ **(ALPHA FEATURE)**
2282
2282
 
2283
2283
  The new Shine syntax for View/Model Attribute Mapping allows data-binding visually with simple arrow operators in Ruby.
2284
2284
 
2285
2285
  Use `<=> [model, attribute, options]` for bidirectional (two-way) data-binding instead of `bind(model, attribute, options)`.
2286
2286
  Use `<= [model, attribute, options]` for unidirectional (one-way) data-binding instead of `bind(model, attribute, read_only: true, more_options)`
2287
2287
 
2288
+ One thing special with the `table` widget is that `<=`, which makes data-binding unidirectional, stops the `table` from supporting automatic sorting by default since that involves modifying the model collection ordering (albeit not the content).
2289
+ To enable automatic sorting in a `table`, but still not permit edit actions to the data itself, you simply use `<=>` for bidirectional data-binding, but without passing the `:editable` style to the `table`.
2290
+
2288
2291
  Examples:
2289
2292
 
2290
2293
  ```ruby
@@ -2299,7 +2302,7 @@ text <=> [@contact, :last_name]
2299
2302
  text <= [@contact, :name, computed_by: [:first_name, :last_name]]
2300
2303
  ```
2301
2304
 
2302
- Note that `table`, `tree`, custom widgets, custom shapes, and animations are not supported by Shine syntax for data-binding yet, so continue to use `bind` with them for the time being.
2305
+ Note that custom widgets and custom shapes are not supported by Shine syntax for data-binding yet, so continue to use `bind` with them for the time being.
2303
2306
 
2304
2307
  Check out [sample code](/samples) for more examples of Shine syntax in action, such as [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed).
2305
2308
 
Binary file
@@ -34,7 +34,6 @@ module Glimmer
34
34
  def <=>(other)
35
35
  if other.is_a?(Array)
36
36
  args_clone = other.clone
37
- @parent.editable = true if @parent.is_a?(Glimmer::SWT::TableProxy) # TODO consider a polymorphic way to perform this
38
37
  @parent.content {
39
38
  send(@parent_attribute, bind(*args_clone))
40
39
  }
@@ -51,8 +50,6 @@ module Glimmer
51
50
  else # || other.is_a?(Hash) # TODO support hash e.g. {model: model_obj, attribute: :some_attribute, more-options...}
52
51
  args_clone << {read_only: true}
53
52
  end
54
- # remove read_only from table to allow automatic sorting (but it remains non-editable)
55
- args_clone.last[:read_only] = false if @parent.is_a?(Glimmer::SWT::TableProxy) # TODO consider a polymorphic way to perform this
56
53
  @parent.content {
57
54
  send(@parent_attribute, bind(*args_clone))
58
55
  }
@@ -54,7 +54,7 @@ module Glimmer
54
54
  def add_content(parent, keyword, *args, &block)
55
55
  # TODO consider avoiding source_location
56
56
  return if block&.parameters&.count == 2
57
- if block.source_location == parent.content&.__getobj__.source_location
57
+ if block.source_location == parent.content&.__getobj__&.source_location
58
58
  parent.content.call(parent) unless parent.content.called?
59
59
  else
60
60
  super
@@ -52,7 +52,7 @@ module Glimmer
52
52
  widget_binding.call(model_binding.evaluate_property)
53
53
  widget_binding.observe(model_binding)
54
54
 
55
- raise(Glimmer::Error, "No radios found! Make sure radio selection is data-bound to a property having property_options as non-empty array!") if parent.items.empty?
55
+ raise(Glimmer::Error, "No radios found! Make sure radio selection is data-bound to a property having property_options as non-empty array!") if parent.get_items.empty?
56
56
  Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: model_binding.binding_options[:sync_exec], override_async_exec: model_binding.binding_options[:async_exec]) do
57
57
  parent.on_widget_selected do
58
58
  model_binding.call(widget_binding.evaluate_property)
@@ -38,8 +38,6 @@ module Glimmer
38
38
  (parent.respond_to?(:has_attribute?) and parent.has_attribute?(keyword)) or
39
39
  (parent.respond_to?(:swt_widget) and (parent.swt_widget.is_a?(Table) or parent.swt_widget.is_a?(Tree)))
40
40
  ) and
41
- !parent.is_a?(Glimmer::UI::CustomWidget) and
42
- !parent.is_a?(Glimmer::UI::CustomShape) and
43
41
  !(parent.respond_to?(:swt_widget) && parent.swt_widget.class == org.eclipse.swt.widgets.Canvas && keyword == 'image')
44
42
  end
45
43
 
@@ -642,7 +642,7 @@ module Glimmer
642
642
  custom_shell_file_content += <<-MULTI_LINE_STRING
643
643
  grid_layout
644
644
  label(:center) {
645
- text bind(self, :greeting)
645
+ text <= [self, :greeting]
646
646
  font height: 40
647
647
  layout_data :fill, :center, true, true
648
648
  }
@@ -712,7 +712,7 @@ module Glimmer
712
712
  ].each do |greeting_text|
713
713
  button(:radio) {
714
714
  text greeting_text
715
- selection bind(self, :greeting) { |g| g == greeting_text }
715
+ selection <= [self, :greeting, on_read: ->(g) { g == greeting_text }]
716
716
  layout_data {
717
717
  width 160
718
718
  }
@@ -29,7 +29,7 @@ module Glimmer
29
29
  include Glimmer::UI::CustomWidget
30
30
 
31
31
  body {
32
- composite # just an empty composite to hold checkboxs upon data-binding `selection`
32
+ composite {} # just an empty composite to hold checkboxs upon data-binding `selection`
33
33
  }
34
34
 
35
35
  def items=(text_array)
@@ -29,7 +29,7 @@ module Glimmer
29
29
  include Glimmer::UI::CustomWidget
30
30
 
31
31
  body {
32
- composite # just an empty composite to hold radios upon data-binding `selection`
32
+ composite {} # just an empty composite to hold radios upon data-binding `selection`
33
33
  }
34
34
 
35
35
  def items=(text_array)
@@ -41,6 +41,7 @@ module Glimmer
41
41
  def items
42
42
  @items || []
43
43
  end
44
+ alias get_items items
44
45
 
45
46
  def selection=(text)
46
47
  radios.count.times do |index|
@@ -81,7 +81,7 @@ module Glimmer
81
81
  end
82
82
  end
83
83
  unless swt_widget_operation
84
- result = send(ruby_attribute_setter(attribute_name), args)
84
+ result = send(ruby_attribute_setter(attribute_name), args) if respond_to?(ruby_attribute_setter(attribute_name), args)
85
85
  end
86
86
  result
87
87
  end
@@ -102,10 +102,10 @@ module Glimmer
102
102
  end
103
103
  end
104
104
  unless swt_widget_operation
105
- result = if respond_to?(ruby_attribute_getter(attribute_name))
106
- send(ruby_attribute_getter(attribute_name))
107
- else
108
- send(attribute_name)
105
+ if respond_to?(ruby_attribute_getter(attribute_name))
106
+ result = send(ruby_attribute_getter(attribute_name))
107
+ elsif respond_to?(attribute_name)
108
+ result = send(attribute_name)
109
109
  end
110
110
  end
111
111
  result
@@ -232,9 +232,12 @@ module Glimmer
232
232
  def has_attribute?(attribute_name, *args)
233
233
  # TODO test that attribute getter responds too
234
234
  widget_custom_attribute = widget_custom_attribute_mapping[attribute_name.to_s]
235
+ property_type_converter = property_type_converters[attribute_name.to_s.to_sym]
235
236
  auto_exec do
236
237
  if widget_custom_attribute
237
238
  @swt_widget.respond_to?(widget_custom_attribute[:setter][:name])
239
+ elsif property_type_converter
240
+ true
238
241
  else
239
242
  super
240
243
  end
@@ -248,7 +248,7 @@ module Glimmer
248
248
  # Otherwise, if a block is passed, it adds it as content to this custom shape
249
249
  def content(&block)
250
250
  if block_given?
251
- body_root.content(&block)
251
+ Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::SWT::CustomShapeExpression.new, self.class.keyword, &block)
252
252
  else
253
253
  @content
254
254
  end
@@ -296,7 +296,7 @@ module Glimmer
296
296
  # Otherwise, if a block is passed, it adds it as content to this custom widget
297
297
  def content(&block)
298
298
  if block_given?
299
- body_root.content(&block)
299
+ Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::SWT::CustomWidgetExpression.new, self.class.keyword, &block)
300
300
  else
301
301
  @content
302
302
  end
@@ -45,7 +45,7 @@ class Calculator
45
45
 
46
46
  # Setting styled_text to multi in order for alignment options to activate
47
47
  styled_text(:multi, :wrap, :border) {
48
- text bind(@presenter, :result)
48
+ text <= [@presenter, :result]
49
49
  alignment swt(:right)
50
50
  right_margin 5
51
51
  font height: 40
@@ -110,7 +110,7 @@ class ContactManager
110
110
  }
111
111
  }
112
112
 
113
- table(:multi) { |table_proxy|
113
+ table(:editable, :multi) { |table_proxy|
114
114
  layout_data {
115
115
  horizontal_alignment :fill
116
116
  vertical_alignment :fill
@@ -226,7 +226,7 @@ class MetaSampleApplication
226
226
  row_layout(:vertical) {
227
227
  fill true
228
228
  }
229
- selection bind(sample_directory, :selected_sample_name)
229
+ selection <=> [sample_directory, :selected_sample_name]
230
230
  font height: 20
231
231
  }
232
232
  }
@@ -242,7 +242,7 @@ class MetaSampleApplication
242
242
  button {
243
243
  text 'Launch'
244
244
  font height: 25
245
- enabled bind(SampleDirectory, 'selected_sample.launchable')
245
+ enabled <= [SampleDirectory, 'selected_sample.launchable']
246
246
 
247
247
  on_widget_selected {
248
248
  begin
@@ -255,7 +255,7 @@ class MetaSampleApplication
255
255
  button {
256
256
  text 'Reset'
257
257
  font height: 25
258
- enabled bind(SampleDirectory, 'selected_sample.editable')
258
+ enabled <= [SampleDirectory, 'selected_sample.editable']
259
259
 
260
260
  on_widget_selected {
261
261
  SampleDirectory.selected_sample.reset_code!
@@ -277,8 +277,8 @@ class MetaSampleApplication
277
277
  line_numbers {
278
278
  background :white
279
279
  }
280
- text bind(SampleDirectory, 'selected_sample.code', read_only: true)
281
- editable bind(SampleDirectory, 'selected_sample.editable')
280
+ text <=> [SampleDirectory, 'selected_sample.code']
281
+ editable <= [SampleDirectory, 'selected_sample.editable']
282
282
  left_margin 7
283
283
  right_margin 7
284
284
  }
@@ -35,44 +35,44 @@ class Tetris
35
35
 
36
36
  body {
37
37
  rectangle(x, y, size, size) {
38
- background bind(self, :base_color)
38
+ background <= [self, :base_color]
39
39
  polygon(0, 0, size, 0, size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size, bevel_pixel_size) {
40
- background bind(self, :base_color) { |color_value|
40
+ background <= [self, :base_color, on_read: ->(color_value) {
41
41
  unless color_value.nil?
42
42
  color = color(color_value)
43
43
  rgb(color.red + 4*BEVEL_CONSTANT, color.green + 4*BEVEL_CONSTANT, color.blue + 4*BEVEL_CONSTANT)
44
44
  end
45
- }
45
+ }]
46
46
  }
47
47
  polygon(size, 0, size - bevel_pixel_size, bevel_pixel_size, size - bevel_pixel_size, size - bevel_pixel_size, size, size) {
48
- background bind(self, :base_color) { |color_value|
48
+ background <= [self, :base_color, on_read: ->(color_value) {
49
49
  unless color_value.nil?
50
50
  color = color(color_value)
51
51
  rgb(color.red - BEVEL_CONSTANT, color.green - BEVEL_CONSTANT, color.blue - BEVEL_CONSTANT)
52
52
  end
53
- }
53
+ }]
54
54
  }
55
55
  polygon(size, size, 0, size, bevel_pixel_size, size - bevel_pixel_size, size - bevel_pixel_size, size - bevel_pixel_size) {
56
- background bind(self, :base_color) { |color_value|
56
+ background <= [self, :base_color, on_read: ->(color_value) {
57
57
  unless color_value.nil?
58
58
  color = color(color_value)
59
59
  rgb(color.red - 2*BEVEL_CONSTANT, color.green - 2*BEVEL_CONSTANT, color.blue - 2*BEVEL_CONSTANT)
60
60
  end
61
- }
61
+ }]
62
62
  }
63
63
  polygon(0, 0, 0, size, bevel_pixel_size, size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size) {
64
- background bind(self, :base_color) { |color_value|
64
+ background <= [self, :base_color, on_read: ->(color_value) {
65
65
  unless color_value.nil?
66
66
  color = color(color_value)
67
67
  rgb(color.red - BEVEL_CONSTANT, color.green - BEVEL_CONSTANT, color.blue - BEVEL_CONSTANT)
68
68
  end
69
- }
69
+ }]
70
70
  }
71
71
  rectangle(0, 0, size, size) {
72
- foreground bind(self, :base_color) { |color_value|
72
+ foreground <= [self, :base_color, on_read: ->(color_value) {
73
73
  # use gray instead of white for the border
74
74
  color_value == Model::Block::COLOR_CLEAR ? :gray : color_value
75
- }
75
+ }]
76
76
  }
77
77
  }
78
78
  }
@@ -31,7 +31,7 @@ class Tetris
31
31
  body {
32
32
  canvas { |canvas_proxy|
33
33
  bevel(size: block_size) {
34
- base_color bind(game_playfield[row][column], :color)
34
+ base_color <= [game_playfield[row][column], :color]
35
35
  }
36
36
  }
37
37
  }
@@ -45,7 +45,7 @@ class Tetris
45
45
  tetris_menu_bar(game: game)
46
46
 
47
47
  label(:center) {
48
- text bind(game, :game_over) {|game_over| game_over ? 'Game Over!' : 'High Scores'}
48
+ text <= [game, :game_over, on_read: ->(game_over) { game_over ? 'Game Over!' : 'High Scores' }]
49
49
  font name: FONT_NAME, height: FONT_TITLE_HEIGHT, style: FONT_TITLE_STYLE
50
50
  }
51
51
  @high_score_table = table {
@@ -66,13 +66,13 @@ class Tetris
66
66
  text 'Level'
67
67
  }
68
68
 
69
- items bind(game, :high_scores, read_only_sort: true), column_properties(:name, :score, :lines, :level)
69
+ items <=> [game, :high_scores, read_only_sort: true, column_properties: [:name, :score, :lines, :level]]
70
70
  }
71
71
  composite {
72
72
  row_layout :horizontal
73
73
 
74
74
  @play_close_button = button {
75
- text bind(game, :game_over) {|game_over| game_over ? 'Play Again?' : 'Close'}
75
+ text <= [game, :game_over, on_read: ->(game_over) { game_over ? 'Play Again?' : 'Close'}]
76
76
  focus true # initial focus
77
77
 
78
78
  on_widget_selected {
@@ -55,7 +55,7 @@ class Tetris
55
55
  font name: @font_name, height: @font_height, style: FONT_TITLE_STYLE
56
56
  }
57
57
  label(:center) {
58
- text bind(game, :score)
58
+ text <= [game, :score]
59
59
  font height: @font_height
60
60
  }
61
61
 
@@ -66,7 +66,7 @@ class Tetris
66
66
  font name: @font_name, height: @font_height, style: FONT_TITLE_STYLE
67
67
  }
68
68
  label(:center) {
69
- text bind(game, :lines)
69
+ text <= [game, :lines]
70
70
  font height: @font_height
71
71
  }
72
72
 
@@ -77,7 +77,7 @@ class Tetris
77
77
  font name: @font_name, height: @font_height, style: FONT_TITLE_STYLE
78
78
  }
79
79
  label(:center) {
80
- text bind(game, :level)
80
+ text <= [game, :level]
81
81
  font height: @font_height
82
82
  }
83
83
  }
@@ -35,7 +35,7 @@ class Tetris
35
35
 
36
36
  menu_item {
37
37
  text '&Start'
38
- enabled bind(game, :game_over)
38
+ enabled <= [game, :game_over]
39
39
  accelerator COMMAND_KEY, :s
40
40
 
41
41
  on_widget_selected {
@@ -45,9 +45,9 @@ class Tetris
45
45
  menu_item(:check) {
46
46
  text '&Pause'
47
47
  accelerator COMMAND_KEY, :p
48
- enabled bind(game, :game_over, on_read: :!) {|value| value && !game.show_high_scores}
49
- enabled bind(game, :show_high_scores, on_read: :!) {|value| value && !game.game_over}
50
- selection bind(game, :paused)
48
+ enabled <= [game, :game_over, on_read: ->(value) { value && !game.show_high_scores }]
49
+ enabled <= [game, :show_high_scores, on_read: ->(value) { value && !game.game_over }]
50
+ selection <=> [game, :paused]
51
51
  }
52
52
  menu_item {
53
53
  text '&Restart'
@@ -76,7 +76,7 @@ class Tetris
76
76
  menu_item(:check) {
77
77
  text '&Show'
78
78
  accelerator COMMAND_KEY, :shift, :h
79
- selection bind(game, :show_high_scores)
79
+ selection <=> [game, :show_high_scores]
80
80
  }
81
81
  menu_item {
82
82
  text '&Clear'
@@ -94,24 +94,24 @@ class Tetris
94
94
  menu_item(:check) {
95
95
  text '&Beeping'
96
96
  accelerator COMMAND_KEY, :b
97
- selection bind(game, :beeping)
97
+ selection <=> [game, :beeping]
98
98
  }
99
99
  menu {
100
100
  text 'Up Arrow'
101
101
  menu_item(:radio) {
102
102
  text '&Instant Down'
103
103
  accelerator COMMAND_KEY, :shift, :i
104
- selection bind(game, :instant_down_on_up, computed_by: :up_arrow_action)
104
+ selection <=> [game, :instant_down_on_up, computed_by: :up_arrow_action]
105
105
  }
106
106
  menu_item(:radio) {
107
107
  text 'Rotate &Right'
108
108
  accelerator COMMAND_KEY, :shift, :r
109
- selection bind(game, :rotate_right_on_up, computed_by: :up_arrow_action)
109
+ selection <=> [game, :rotate_right_on_up, computed_by: :up_arrow_action]
110
110
  }
111
111
  menu_item(:radio) {
112
112
  text 'Rotate &Left'
113
113
  accelerator COMMAND_KEY, :shift, :l
114
- selection bind(game, :rotate_left_on_up, computed_by: :up_arrow_action)
114
+ selection <=> [game, :rotate_left_on_up, computed_by: :up_arrow_action]
115
115
  }
116
116
  }
117
117
  } # end of menu
@@ -84,7 +84,7 @@ class Timer
84
84
  menu_item {
85
85
  text '&Start'
86
86
  accelerator COMMAND_KEY, 's'
87
- enabled bind(self, :countdown, on_read: :!)
87
+ enabled <= [self, :countdown, on_read: :!]
88
88
 
89
89
  on_widget_selected {
90
90
  start_countdown
@@ -92,7 +92,7 @@ class Timer
92
92
  }
93
93
  menu_item {
94
94
  text 'St&op'
95
- enabled bind(self, :countdown)
95
+ enabled <= [self, :countdown]
96
96
  accelerator COMMAND_KEY, 'o'
97
97
 
98
98
  on_widget_selected {
@@ -148,8 +148,8 @@ class Timer
148
148
  text_limit 2
149
149
  digits 0
150
150
  maximum 59
151
- selection bind(self, :min)
152
- enabled bind(self, :countdown, on_read: :!)
151
+ selection <=> [self, :min]
152
+ enabled <= [self, :countdown, on_read: :!]
153
153
  on_widget_default_selected {
154
154
  start_countdown
155
155
  }
@@ -162,8 +162,8 @@ class Timer
162
162
  text_limit 2
163
163
  digits 0
164
164
  maximum 59
165
- selection bind(self, :sec)
166
- enabled bind(self, :countdown, on_read: :!)
165
+ selection <=> [self, :sec]
166
+ enabled <= [self, :countdown, on_read: :!]
167
167
  on_widget_default_selected {
168
168
  start_countdown
169
169
  }
@@ -179,7 +179,7 @@ class Timer
179
179
  }
180
180
  @start_button = button {
181
181
  text '&Start'
182
- enabled bind(self, :countdown, on_read: :!)
182
+ enabled <= [self, :countdown, on_read: :!]
183
183
  on_widget_selected {
184
184
  start_countdown
185
185
  }
@@ -189,7 +189,7 @@ class Timer
189
189
  }
190
190
  @stop_button = button {
191
191
  text 'St&op'
192
- enabled bind(self, :countdown)
192
+ enabled <= [self, :countdown]
193
193
  on_widget_selected {
194
194
  stop_countdown
195
195
  }
@@ -58,7 +58,7 @@ class HelloCheckboxGroup
58
58
  }
59
59
 
60
60
  checkbox_group {
61
- selection bind(@person, :activities)
61
+ selection <=> [@person, :activities]
62
62
  }
63
63
 
64
64
  button {
@@ -85,7 +85,7 @@ class HelloCodeText
85
85
  fill_layout
86
86
  text 'Ruby (glimmer theme)'
87
87
  code_text(language: 'ruby', theme: 'glimmer', lines: true) {
88
- text bind(self, :ruby_code)
88
+ text <=> [self, :ruby_code]
89
89
  }
90
90
  }
91
91
  tab_item {
@@ -101,14 +101,14 @@ class HelloCodeText
101
101
  line_numbers {
102
102
  background :white
103
103
  }
104
- text bind(self, :js_code)
104
+ text <=> [self, :js_code]
105
105
  }
106
106
  }
107
107
  tab_item {
108
108
  fill_layout
109
109
  text 'HTML (github theme)'
110
110
  code_text(language: 'html', theme: 'github') { # default is lines: false
111
- text bind(self, :html_code)
111
+ text <=> [self, :html_code]
112
112
  }
113
113
  }
114
114
  }
@@ -73,7 +73,7 @@ class HelloCoolBar
73
73
  }
74
74
  # a combo can be nested in a tool_bar (it auto-generates a tool_item for itself behind the scenes)
75
75
  combo {
76
- selection bind(self, :font_size)
76
+ selection <=> [self, :font_size]
77
77
  }
78
78
  }
79
79
  }
@@ -51,7 +51,7 @@ class HelloCursor
51
51
  }
52
52
  radio_group {
53
53
  grid_layout 5, true
54
- selection bind(self, :selected_cursor)
54
+ selection <=> [self, :selected_cursor]
55
55
  }
56
56
  }
57
57
  }
@@ -138,7 +138,7 @@ class HelloCustomShell
138
138
  width 360
139
139
  }
140
140
 
141
- items <= [@email_system, :emails, column_properties: [:date, :subject, :from]]
141
+ items <=> [@email_system, :emails, column_properties: [:date, :subject, :from]]
142
142
 
143
143
  on_mouse_up { |event|
144
144
  email = event.table_item.get_data
@@ -44,7 +44,7 @@ class HelloDirectoryDialog
44
44
 
45
45
  label {
46
46
  layout_data :fill, :center, true, false
47
- text bind(self, :selected_directory)
47
+ text <= [self, :selected_directory]
48
48
  font height: 14
49
49
  }
50
50
 
@@ -64,7 +64,7 @@ class HelloRadioGroup
64
64
 
65
65
  radio_group {
66
66
  row_layout :horizontal
67
- selection bind(@person, :gender)
67
+ selection <=> [@person, :gender]
68
68
  }
69
69
 
70
70
  label {
@@ -74,7 +74,7 @@ class HelloRadioGroup
74
74
 
75
75
  radio_group {
76
76
  row_layout :horizontal
77
- selection bind(@person, :age_group)
77
+ selection <=> [@person, :age_group]
78
78
  }
79
79
 
80
80
  button {
@@ -210,7 +210,7 @@ class HelloTable
210
210
  font height: 14
211
211
  }
212
212
 
213
- table { |table_proxy|
213
+ table(:editable) { |table_proxy|
214
214
  layout_data :fill, :fill, true, true
215
215
 
216
216
  table_column {
@@ -71,7 +71,7 @@ class HelloToolBar
71
71
  }
72
72
  # a combo can be nested in a tool_bar (it auto-generates a tool_item for itself behind the scenes)
73
73
  combo {
74
- selection bind(self, :font_size)
74
+ selection <=> [self, :font_size]
75
75
  }
76
76
  }
77
77
 
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.20.2.1
4
+ version: 4.20.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-07 00:00:00.000000000 Z
11
+ date: 2021-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement