glimmer-dsl-swt 4.20.0.5 → 4.20.1.0

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: b539c452b30e337ec632c8e4e034a2ef0585000eb7fdad70afe77ec5851f2d49
4
- data.tar.gz: a562eca963b5d39cbb8c7b56219dae2bc23ad93e2f8b76cb1853c38077e07c93
3
+ metadata.gz: e9779424dd8dd9fca77f9252ae072a455d2d74bf628952d02650a462bbc1021e
4
+ data.tar.gz: 1894fba96b987a4a6b7b3c6e65f5d8088396863e076deb69d90871aeff233229
5
5
  SHA512:
6
- metadata.gz: cea713cd788b554522e83e7e72da27e942f962fb3996a415ed2d06b803f6a95345265a7e81d9fcd3dc7e6567b4951fdee1dbeedb908ecb146cdcfb70f17c6f7f
7
- data.tar.gz: 4a15d50266466f54713a440f563d203137c5ea9a2f290d2f6f2e44f752a70ddcc772d901152aeb6fc31957b7d7d9cf6ef04df82f45db4a3964c14ed467a32c94
6
+ metadata.gz: 4caa0f594b722c39b0ea2586be80a2b52362fac9c6ad0bcf0c53581525af4b96ded22090c681271795503f7f99094dc1721ef6eebdbe1d314a45ef9c9ff3815c
7
+ data.tar.gz: 67472ac71632e32e4ec6dd903a88895b2e73c0c6ce00f7ab40856f4cceda34b1e36c7ac326ba5dc6a5fe81c57645a3270e33676e02cd26f164f520e0a2ade335
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.20.1.0
4
+
5
+ - Shine data-binding syntax support for `table` widget
6
+ - Use Shine syntax in Hello, Table! and Contact Manager samples
7
+
3
8
  ### 4.20.0.5
4
9
 
5
10
  - Hello, Text! sample
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.0.5
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
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,7 +15,7 @@
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.0.5 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.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).
19
19
 
20
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).
21
21
 
@@ -286,7 +286,7 @@ Thanks to Java and JRuby, Glimmer apps can be packaged as cross-platform JAR fil
286
286
 
287
287
  The Java Virtual Machine already supports OS-native threads, so Glimmer apps can have multiple things running in parallel with no problem.
288
288
 
289
- SWT supports Canvas graphics drawing, and Glimmer takes that further by provding a Canvas Shape/Transform/Animation DSL, making it very simple to decorate any existing widgets or add new widgets with a completely custom look and feel if needed for branding or entertainment (gaming) purposes.
289
+ SWT supports Canvas graphics drawing, and Glimmer takes that further by provding a Canvas Shape/Transform/Animation DSL, making it very simple to decorate any existing widgets or add new widgets with a completely custom look and feel if needed for branding purposes.
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
 
@@ -341,7 +341,7 @@ jgem install glimmer-dsl-swt
341
341
 
342
342
  Or this command if you want a specific version:
343
343
  ```
344
- jgem install glimmer-dsl-swt -v 4.20.0.5
344
+ jgem install glimmer-dsl-swt -v 4.20.1.0
345
345
  ```
346
346
 
347
347
  `jgem` is JRuby's version of `gem` command.
@@ -369,7 +369,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
369
369
 
370
370
  Add the following to `Gemfile`:
371
371
  ```
372
- gem 'glimmer-dsl-swt', '~> 4.20.0.5'
372
+ gem 'glimmer-dsl-swt', '~> 4.20.1.0'
373
373
  ```
374
374
 
375
375
  And, then run:
@@ -390,7 +390,7 @@ glimmer
390
390
  ```
391
391
 
392
392
  ```
393
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.0.5
393
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.1.0
394
394
 
395
395
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
396
396
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.20.0.5
1
+ 4.20.1.0
Binary file
@@ -33,8 +33,10 @@ module Glimmer
33
33
 
34
34
  def <=>(other)
35
35
  if other.is_a?(Array)
36
+ args_clone = other.clone
37
+ @parent.editable = true if @parent.is_a?(Glimmer::SWT::TableProxy) # TODO consider a polymorphic way to perform this
36
38
  @parent.content {
37
- send(@parent_attribute, bind(*other))
39
+ send(@parent_attribute, bind(*args_clone))
38
40
  }
39
41
  else # || other.is_a?(Hash) # TODO support hash e.g. {model: model_obj, attribute: :some_attribute, more-options...}
40
42
  original_compare(other)
@@ -34,11 +34,11 @@ 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, column_properties)
37
+ def initialize(parent, model_binding, column_properties = nil)
38
38
  @table = parent
39
39
  @model_binding = model_binding
40
40
  @read_only_sort = @model_binding.binding_options[:read_only_sort]
41
- @column_properties = column_properties
41
+ @column_properties = @model_binding.binding_options[:column_properties] || @model_binding.binding_options[:column_attributes] || column_properties
42
42
  if @table.respond_to?(:column_properties=)
43
43
  @table.column_properties = @column_properties
44
44
  else # assume custom widget
@@ -29,12 +29,15 @@ module Glimmer
29
29
  module DSL
30
30
  module SWT
31
31
  class ShineDataBindingExpression < Expression
32
+ include_package 'org.eclipse.swt.widgets'
33
+
32
34
  def can_interpret?(parent, keyword, *args, &block)
33
35
  args.size == 0 and
34
36
  block.nil? and
35
- parent.respond_to?(:set_attribute) and
36
- parent.respond_to?(:has_attribute?) and
37
- parent.has_attribute?(keyword, *args) and
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))
40
+ ) and
38
41
  !parent.is_a?(Glimmer::UI::CustomWidget) and
39
42
  !parent.is_a?(Glimmer::UI::CustomShape) and
40
43
  !(parent.respond_to?(:swt_widget) && parent.swt_widget.class == org.eclipse.swt.widgets.Canvas && keyword == 'image')
@@ -35,10 +35,10 @@ module Glimmer
35
35
  block.nil? and
36
36
  parent.respond_to?(:swt_widget) and
37
37
  parent.swt_widget.is_a?(Table) and
38
- args.size == 2 and
38
+ args.size.between?(1, 2) and
39
39
  args[0].is_a?(DataBinding::ModelBinding) and
40
40
  args[0].evaluate_property.is_a?(Array) and
41
- args[1].is_a?(Array)
41
+ (args[1].nil? or args[1].is_a?(Array))
42
42
  end
43
43
 
44
44
  def interpret(parent, keyword, *args, &block)
@@ -33,6 +33,7 @@ module Glimmer
33
33
  # default implementation of attribute setters/getters
34
34
  # It tries swt_widget, swt_display, swt_image, and swt_dialog by default.
35
35
  def proxy_source_object
36
+ # TODO the logic here should not be needed if derived with polymorphism. Consider removing.
36
37
  if respond_to?(:swt_widget)
37
38
  swt_widget
38
39
  elsif respond_to?(:swt_display)
@@ -62,7 +63,7 @@ module Glimmer
62
63
 
63
64
  def has_attribute?(attribute_name, *args)
64
65
  Glimmer::SWT::DisplayProxy.instance.auto_exec do
65
- proxy_source_object&.respond_to?(attribute_setter(attribute_name), args) ||
66
+ proxy_source_object&.respond_to?(attribute_setter(attribute_name), args) or
66
67
  respond_to?(ruby_attribute_setter(attribute_name), args)
67
68
  end
68
69
  end
@@ -250,19 +250,13 @@ module Glimmer
250
250
  alias editable? editable
251
251
 
252
252
  def initialize(underscored_widget_name, parent, args)
253
- @editable = args.delete(:editable)
253
+ editable_style = args.delete(:editable)
254
254
  super
255
255
  @table_editor = TableEditor.new(swt_widget)
256
256
  @table_editor.horizontalAlignment = SWTProxy[:left]
257
257
  @table_editor.grabHorizontal = true
258
258
  @table_editor.minimumHeight = 20
259
- if editable?
260
- content {
261
- on_mouse_up { |event|
262
- edit_table_item(event.table_item, event.column_index)
263
- }
264
- }
265
- end
259
+ self.editable = editable_style
266
260
  end
267
261
 
268
262
  def items
@@ -283,6 +277,19 @@ module Glimmer
283
277
  end
284
278
  end
285
279
 
280
+ def editable=(value)
281
+ @editable = value
282
+ if @editable
283
+ content {
284
+ @editable_on_mouse_up = on_mouse_up { |event|
285
+ edit_table_item(event.table_item, event.column_index)
286
+ }
287
+ }
288
+ else
289
+ @editable_on_mouse_up.deregister if @editable_on_mouse_up
290
+ end
291
+ end
292
+
286
293
  def sort_block=(comparator)
287
294
  @sort_block = comparator
288
295
  end
@@ -765,7 +765,7 @@ module Glimmer
765
765
 
766
766
  def can_add_listener?(underscored_listener_name)
767
767
  auto_exec do
768
- !self.class.find_listener(@swt_widget.getClass, underscored_listener_name).empty?
768
+ @swt_widget && !self.class.find_listener(@swt_widget.getClass, underscored_listener_name).empty?
769
769
  end
770
770
  end
771
771
 
@@ -206,11 +206,11 @@ class HelloTable
206
206
 
207
207
  combo(:read_only) {
208
208
  layout_data :center, :center, true, false
209
- selection bind(BaseballGame, :playoff_type)
209
+ selection <=> [BaseballGame, :playoff_type]
210
210
  font height: 14
211
211
  }
212
212
 
213
- table(:editable) { |table_proxy|
213
+ table { |table_proxy|
214
214
  layout_data :fill, :fill, true, true
215
215
 
216
216
  table_column {
@@ -247,10 +247,10 @@ class HelloTable
247
247
  }
248
248
 
249
249
  # Data-bind table items (rows) to a model collection property, specifying column properties ordering per nested model
250
- items bind(BaseballGame, :schedule), column_properties(:game_date, :game_time, :ballpark, :home_team, :away_team, :promotion)
250
+ items <=> [BaseballGame, :schedule, column_properties: [:game_date, :game_time, :ballpark, :home_team, :away_team, :promotion]]
251
251
 
252
252
  # Data-bind table selection
253
- selection bind(BaseballGame, :selected_game)
253
+ selection <=> [BaseballGame, :selected_game]
254
254
 
255
255
  # Default initial sort property
256
256
  sort_property :date
@@ -273,7 +273,7 @@ class HelloTable
273
273
  text 'Book Selected Game'
274
274
  layout_data :center, :center, true, false
275
275
  font height: 14
276
- enabled bind(BaseballGame, :selected_game)
276
+ enabled <= [BaseballGame, :selected_game]
277
277
 
278
278
  on_widget_selected {
279
279
  book_selected_game
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.0.5
4
+ version: 4.20.1.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-05 00:00:00.000000000 Z
11
+ date: 2021-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement