glimmer-dsl-swt 4.20.1.0 → 4.20.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/README.md +12 -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-dsl-swt.rb +1 -0
  8. data/lib/glimmer/data_binding/table_items_binding.rb +1 -0
  9. data/lib/glimmer/data_binding/tree_items_binding.rb +2 -2
  10. data/lib/glimmer/dsl/swt/bind_expression.rb +5 -25
  11. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
  12. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +1 -1
  13. data/lib/glimmer/dsl/swt/shine_data_binding_expression.rb +2 -4
  14. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +17 -12
  15. data/lib/glimmer/rake_task/scaffold.rb +2 -2
  16. data/lib/glimmer/swt/custom/animation.rb +6 -0
  17. data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
  18. data/lib/glimmer/swt/custom/radio_group.rb +2 -1
  19. data/lib/glimmer/swt/proxy_properties.rb +5 -5
  20. data/lib/glimmer/swt/widget_proxy.rb +3 -0
  21. data/lib/glimmer/ui/custom_shape.rb +1 -1
  22. data/lib/glimmer/ui/custom_widget.rb +1 -1
  23. data/samples/elaborate/calculator.rb +1 -1
  24. data/samples/elaborate/contact_manager.rb +2 -2
  25. data/samples/elaborate/meta_sample.rb +5 -5
  26. data/samples/elaborate/tetris.rb +2 -2
  27. data/samples/elaborate/tetris/view/bevel.rb +11 -11
  28. data/samples/elaborate/tetris/view/block.rb +1 -1
  29. data/samples/elaborate/tetris/view/high_score_dialog.rb +4 -4
  30. data/samples/elaborate/tetris/view/score_lane.rb +3 -3
  31. data/samples/elaborate/tetris/view/tetris_menu_bar.rb +9 -9
  32. data/samples/elaborate/timer.rb +8 -8
  33. data/samples/elaborate/weather.rb +8 -4
  34. data/samples/hello/hello_canvas_animation_data_binding.rb +1 -1
  35. data/samples/hello/hello_checkbox_group.rb +1 -1
  36. data/samples/hello/hello_code_text.rb +3 -3
  37. data/samples/hello/hello_computed.rb +20 -2
  38. data/samples/hello/hello_cool_bar.rb +1 -1
  39. data/samples/hello/hello_cursor.rb +1 -1
  40. data/samples/hello/hello_custom_shell.rb +17 -11
  41. data/samples/hello/hello_directory_dialog.rb +1 -1
  42. data/samples/hello/hello_radio_group.rb +2 -2
  43. data/samples/hello/hello_table.rb +1 -1
  44. data/samples/hello/hello_tool_bar.rb +1 -1
  45. data/samples/hello/hello_tree.rb +11 -11
  46. metadata +44 -26
  47. data/lib/glimmer/data_binding/shine.rb +0 -61
  48. data/samples/hello/hello_computed/contact.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9779424dd8dd9fca77f9252ae072a455d2d74bf628952d02650a462bbc1021e
4
- data.tar.gz: 1894fba96b987a4a6b7b3c6e65f5d8088396863e076deb69d90871aeff233229
3
+ metadata.gz: 477ae45e0e1bc13247941f92ae0b7548c2b6a73646f5f88ff7153491a2ec6c6a
4
+ data.tar.gz: 69cb3de2f04851c2282f952df47db2b9eda03279e44502b04e8f93eb9373178d
5
5
  SHA512:
6
- metadata.gz: 4caa0f594b722c39b0ea2586be80a2b52362fac9c6ad0bcf0c53581525af4b96ded22090c681271795503f7f99094dc1721ef6eebdbe1d314a45ef9c9ff3815c
7
- data.tar.gz: 67472ac71632e32e4ec6dd903a88895b2e73c0c6ce00f7ab40856f4cceda34b1e36c7ac326ba5dc6a5fe81c57645a3270e33676e02cd26f164f520e0a2ade335
6
+ metadata.gz: 2aa235c3ca3ec8155e60af29ffca40232d38e8d5e87317e14244afe49da93ca2cd0fe103b688a78f7d22587a16e89ebaafa1f1a60abd92fe16b82a1f1e3e42f1
7
+ data.tar.gz: 2f2d84b284317afd09bfed98ce5ebcf95d4707fd87d5e53b8d36b4da485a5685ef95339ba48d16c0f5800e753635c28823a8f56735cee237a982e51a3ff5aea7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.20.4.1
4
+
5
+ - Ensure a `table` with `:editable` style loses it if `items <= ...` one-way data-binding (having read_only: true option) was setup.
6
+ - Tweak/refactor/improve samples
7
+
8
+ ### 4.20.4.0
9
+
10
+ - Extracted Shine data-binding syntax and `BindExpression` to Glimmer 2
11
+
12
+ ### 4.20.3.0
13
+
14
+ - Shine data-binding support for `custom widgets`, `custom shells`, and `custom shapes`
15
+ - Update remaining samples with `bind` keyword to switch to Shine data-binding syntax
16
+ - Switch scaffolded classes' data-binding to Shine
17
+ - Fix `table` Shine syntax support for unidirectional (one-way) data-binding
18
+
19
+ ### 4.20.2.1
20
+
21
+ - Shine data-binding support for `animation` (also supporting `#content {}` method in `Animation`)
22
+ - Update Hello, Custom Shell! to use Shine data-binding syntax
23
+ - Fix `table` automatic sorting support when using one-way Shine data-binding syntax (which was disabling reads)
24
+
25
+ ### 4.20.2.0
26
+
27
+ - Shine data-binding syntax support for `tree` widget
28
+ - Use Shine syntax in Hello, Tree! sample
29
+
3
30
  ### 4.20.1.0
4
31
 
5
32
  - Shine data-binding syntax support for `table` widget
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.1.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.4.1
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.1.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.4.1 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 a beta, 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
 
@@ -290,6 +290,12 @@ SWT supports Canvas graphics drawing, and Glimmer takes that further by provding
290
290
 
291
291
  Audio is supported via the Java Sound library in a cross-platform approach and video is supported via a Glimmer custom widget, so any Glimmer app can be enhanced with audio and video where needed.
292
292
 
293
+ ### Remaining Challenges
294
+
295
+ Startup time is long. Thankfully, [there are work-arounds](https://andymaleh.blogspot.com/2021/03/glimmer-dsl-for-swt-41900-halved.html) that could make apps start as fast as instantly.
296
+
297
+ Contributors who appreciate Glimmer's ultra-high productivity, maintainability, and extensibility might want to help report and resolve remaining challenges in its software architecture.
298
+
293
299
  ## Platform Support
294
300
 
295
301
  Glimmer runs on the following platforms:
@@ -341,7 +347,7 @@ jgem install glimmer-dsl-swt
341
347
 
342
348
  Or this command if you want a specific version:
343
349
  ```
344
- jgem install glimmer-dsl-swt -v 4.20.1.0
350
+ jgem install glimmer-dsl-swt -v 4.20.4.1
345
351
  ```
346
352
 
347
353
  `jgem` is JRuby's version of `gem` command.
@@ -369,7 +375,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
369
375
 
370
376
  Add the following to `Gemfile`:
371
377
  ```
372
- gem 'glimmer-dsl-swt', '~> 4.20.1.0'
378
+ gem 'glimmer-dsl-swt', '~> 4.20.4.1'
373
379
  ```
374
380
 
375
381
  And, then run:
@@ -390,7 +396,7 @@ glimmer
390
396
  ```
391
397
 
392
398
  ```
393
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.1.0
399
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.4.1
394
400
 
395
401
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
396
402
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.20.1.0
1
+ 4.20.4.1
@@ -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
+ **(BETA 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
+ Given that Shine is new, if you encounter any issues, you can use `bind` instead.
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
@@ -30,6 +30,7 @@ if !['', 'false'].include?(ENV['GLIMMER_BUNDLER_SETUP'].to_s.strip.downcase)
30
30
  end
31
31
  require 'java'
32
32
  require 'puts_debuggerer' if ("#{ENV['pd']}#{ENV['PD']}").to_s.downcase.include?('true')
33
+ require 'concurrent-ruby' # ensures glimmer relies on Concurrent data-structure classes (e.g. Concurrent::Array)
33
34
  require 'glimmer'
34
35
  require 'logging'
35
36
  require 'nested_inherited_jruby_include_package'
@@ -39,6 +39,7 @@ module Glimmer
39
39
  @model_binding = model_binding
40
40
  @read_only_sort = @model_binding.binding_options[:read_only_sort]
41
41
  @column_properties = @model_binding.binding_options[:column_properties] || @model_binding.binding_options[:column_attributes] || column_properties
42
+ @table.editable = false if @model_binding.binding_options[:read_only]
42
43
  if @table.respond_to?(:column_properties=)
43
44
  @table.column_properties = @column_properties
44
45
  else # assume custom widget
@@ -34,10 +34,10 @@ module Glimmer
34
34
  include_package 'org.eclipse.swt'
35
35
  include_package 'org.eclipse.swt.widgets'
36
36
 
37
- def initialize(parent, model_binding, tree_properties)
37
+ def initialize(parent, model_binding, tree_properties = nil)
38
38
  @tree = parent
39
39
  @model_binding = model_binding
40
- @tree_properties = [tree_properties].flatten.first.to_h
40
+ @tree_properties = @model_binding.binding_options[:tree_properties] || @model_binding.binding_options[:tree_attributes] || [tree_properties].compact.flatten.first.to_h
41
41
  if @tree.respond_to?(:tree_properties=)
42
42
  @tree.tree_properties = @tree_properties
43
43
  else # assume custom widget
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2021 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
@@ -20,6 +20,7 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  require 'glimmer/dsl/static_expression'
23
+ require 'glimmer/dsl/bind_expression'
23
24
  require 'glimmer/data_binding/model_binding'
24
25
 
25
26
  module Glimmer
@@ -30,28 +31,7 @@ module Glimmer
30
31
  # DataBindingCommandHandler for text and selection properties on Text and Spinner
31
32
  # or TableItemsDataBindingCommandHandler for items in a Table
32
33
  class BindExpression < StaticExpression
33
- def can_interpret?(parent, keyword, *args, &block)
34
- (
35
- keyword == 'bind' and
36
- (
37
- (
38
- (args.size == 2) and
39
- textual?(args[1])
40
- ) ||
41
- (
42
- (args.size == 3) and
43
- textual?(args[1]) and
44
- (args[2].is_a?(Hash))
45
- )
46
- )
47
- )
48
- end
49
-
50
- def interpret(parent, keyword, *args, &block)
51
- binding_options = args[2] || {}
52
- binding_options[:on_read] = binding_options.delete(:on_read) || binding_options.delete('on_read') || block
53
- DataBinding::ModelBinding.new(args[0], args[1].to_s, binding_options)
54
- end
34
+ include Glimmer::DSL::BindExpression
55
35
  end
56
36
  end
57
37
  end
@@ -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)
@@ -35,11 +35,9 @@ module Glimmer
35
35
  args.size == 0 and
36
36
  block.nil? and
37
37
  (
38
- (parent.respond_to?(:set_attribute) and parent.respond_to?(:has_attribute?) and parent.has_attribute?(keyword)) or
39
- (parent.respond_to?(:swt_widget) and parent.swt_widget.is_a?(Table))
38
+ (parent.respond_to?(:has_attribute?) and parent.has_attribute?(keyword)) or
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
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2021 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
@@ -30,15 +30,20 @@ module Glimmer
30
30
  include_package 'org.eclipse.swt.widgets'
31
31
 
32
32
  def can_interpret?(parent, keyword, *args, &block)
33
- initial_condition = ((keyword == "items") and block.nil? and parent.respond_to?(:swt_widget) and parent.swt_widget.is_a?(Tree))
34
- return false unless initial_condition
35
- raise Glimmer::Error, 'Tree items args must be 2' unless args.size == 2
36
- raise Glimmer::Error, 'Tree items first arg must be a bind expression' unless args[0].is_a?(DataBinding::ModelBinding)
37
- raise Glimmer::Error, 'Tree items data-binding initial value must not be an array yet a single item representing tree root' unless !args[0].evaluate_property.is_a?(Array)
38
- raise Glimmer::Error, 'Tree items second arg must be an array' unless args[1].is_a?(Array)
39
- raise Glimmer::Error, 'Tree items second arg must not be empty' unless !args[1].empty?
40
- raise Glimmer::Error, 'Tree items second arg array elements must be of type hash' unless args[1].first.is_a?(Hash)
41
- true
33
+ keyword == 'items' and
34
+ block.nil? and
35
+ parent.respond_to?(:swt_widget) and
36
+ parent.swt_widget.is_a?(Tree) and
37
+ args.size.between?(1, 2)
38
+ # TODO delete these checks if they are too granular
39
+ # return false unless initial_condition
40
+ # raise Glimmer::Error, 'Tree items args must be 1 or 2' unless args.size.between?(1, 2)
41
+ # raise Glimmer::Error, 'Tree items first arg must be a bind expression' unless args[0].is_a?(DataBinding::ModelBinding)
42
+ # raise Glimmer::Error, 'Tree items data-binding initial value must not be an array yet a single item representing tree root' unless !args[0].evaluate_property.is_a?(Array)
43
+ # raise Glimmer::Error, 'Tree items second arg must be an array' unless args[1].is_a?(Array)
44
+ # raise Glimmer::Error, 'Tree items second arg must not be empty' unless !args[1].empty?
45
+ # raise Glimmer::Error, 'Tree items second arg array elements must be of type hash' unless args[1].first.is_a?(Hash)
46
+ # true
42
47
  end
43
48
 
44
49
  def interpret(parent, keyword, *args, &block)
@@ -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
  }
@@ -99,6 +99,12 @@ module Glimmer
99
99
  end
100
100
  end
101
101
 
102
+ def content(&block)
103
+ Glimmer::SWT::DisplayProxy.instance.auto_exec do
104
+ Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::SWT::AnimationExpression.new, 'animation', &block)
105
+ end
106
+ end
107
+
102
108
  # Starts an animation that is indefinite or has never been started before (i.e. having `started: false` option).
103
109
  # Otherwise, resumes a stopped animation that has not been completed.
104
110
  def start
@@ -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
@@ -132,7 +132,7 @@ class ContactManager
132
132
  width 200
133
133
  }
134
134
 
135
- items bind(@contact_manager_presenter, :results), column_properties(:first_name, :last_name, :email)
135
+ items <=> [@contact_manager_presenter, :results, column_properties: [:first_name, :last_name, :email]]
136
136
 
137
137
  on_mouse_up { |event|
138
138
  table_proxy.edit_table_item(event.table_item, event.column_index)