glimmer-dsl-swt 4.24.4.4 → 4.24.4.5

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: e66b329b7d9bf09db34b1b4b9d98a42b52793a6822512ecb1cd95b55a9a8e664
4
- data.tar.gz: 2840c2f1c4cb5064afd54e8723668de648541568cdc9d23626fd07c791bfe1bd
3
+ metadata.gz: 529a6e52ee5f12439588d4e74d7cb71cf571dc5708c0f30d4a8212fc93bbcd94
4
+ data.tar.gz: beee81b79e38eb8c4f06efae74cbcf449284dcfdc012662529b304272cd2c959
5
5
  SHA512:
6
- metadata.gz: 5072ef09d0a73a58f4e8957c1e69efb69843fb31eeb658513368287754357833f69ab263acc36395242c12f9089a48e48541d68abc4dbf1bb1acc06ef4dfd0d5
7
- data.tar.gz: 9ea20dfe409781ec75beed5f5f68afee7e91e09d4a0c14bb43b002525497dcd3948257eccabd8c9513597b108b4e5d051f38faa0c2459c5e44a7a398ee4601f9
6
+ metadata.gz: 955e339c7ee47be0f1d2a400a83689b71a7a3c1737a0738ef58cd779f6ac2c805609bf81f462bb3b1dfcf6bfe421e31f18037b2a7139c5bf0877d7ae776d4377
7
+ data.tar.gz: ce4943970d11b34972bafe1138a0878431d5e5f5b6c5943edfa8b51f5591540f781c86eef1150e7ee4306d8ba3a38f4e3ca75e6dfa57b424dc13d37b1845921b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.24.4.5
4
+
5
+ - Support `refined_table` `:editable` SWT style and `model_array` bidirectional data-binding
6
+ - Update Hello, Refined Table! to allow editing the table
7
+ - Support `Glimmer::UI::CustomWidget`/`Glimmer::UI::CustomShell` support for `swt_style_symbols` read-only attribute to access array of SWT style symbols (works better than `swt_style` because some widgets support custom Glimmer-only SWT style symbols not originally supported by SWT)
8
+
3
9
  ## 4.24.4.4
4
10
 
5
11
  - Support `refined_table` `selection` data-binding
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.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.5
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.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.
24
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.4.5 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.4
341
+ jgem install glimmer-dsl-swt -v 4.24.4.5
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.4'
369
+ gem 'glimmer-dsl-swt', '~> 4.24.4.5'
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.4
392
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.4.5
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.4
1
+ 4.24.4.5
@@ -4320,37 +4320,53 @@ Options:
4320
4320
  - `page` (default: `1` if table is filled and `0` otherwise): specifies initial page
4321
4321
  - `query` (default: `''`): specifies filter query term (empty shows all results)
4322
4322
 
4323
- Note that currently `refined_table` only supports displaying a **read-only** table (meaning it can read updates from the model, but it cannot write back to the model through `TableEditor` cells). Also, it does not support selection or sorting by clicking columns yet.
4323
+ Note that currently `refined_table` does not support sorting by clicking columns yet.
4324
4324
 
4325
4325
  Example taken from [Hello, Refined Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-refined-table):
4326
4326
 
4327
4327
  ![hello refined table](/images/glimmer-hello-refined-table.png)
4328
4328
 
4329
4329
  ```ruby
4330
- #... more code precedes
4331
-
4332
- refined_table(per_page: 20) {
4330
+ #...
4331
+ refined_table(:editable, :border, per_page: 20) { # also `page: 1` by default
4333
4332
  table_column {
4334
4333
  width 100
4335
4334
  text 'Date'
4335
+ editor :date_drop_down
4336
4336
  }
4337
4337
  table_column {
4338
4338
  width 200
4339
4339
  text 'Ballpark'
4340
+ editor :none
4340
4341
  }
4341
4342
  table_column {
4342
4343
  width 150
4343
4344
  text 'Home Team'
4345
+ editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
4344
4346
  }
4345
4347
  table_column {
4346
4348
  width 150
4347
4349
  text 'Away Team'
4350
+ editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
4351
+ }
4352
+
4353
+ menu {
4354
+ menu_item {
4355
+ text 'Book'
4356
+
4357
+ on_widget_selected do
4358
+ message_box {
4359
+ text 'Game Booked!'
4360
+ message "The game \"#{@baseball_season.selected_game}\" has been booked!"
4361
+ }.open
4362
+ end
4363
+ }
4348
4364
  }
4349
4365
 
4350
- model_array <= [@baseball_season, :games, column_attributes: {'Home Team' => :home_team_name, 'Away Team' => :away_team_name}]
4366
+ model_array <=> [@baseball_season, :games, column_attributes: {'Home Team' => :home_team_name, 'Away Team' => :away_team_name}]
4367
+ selection <=> [@baseball_season, :selected_game]
4351
4368
  }
4352
-
4353
- #...more code follows
4369
+ #...
4354
4370
  ```
4355
4371
 
4356
4372
  #### Tree
Binary file
@@ -149,7 +149,7 @@ module Glimmer
149
149
  @composite = composite {
150
150
  grid_layout(2, false)
151
151
 
152
- @line_numbers_styled_text_proxy = styled_text(swt(swt(swt_style), :h_scroll!, :v_scroll!)) {
152
+ @line_numbers_styled_text_proxy = styled_text(swt(swt(@swt_style), :h_scroll!, :v_scroll!)) {
153
153
  layout_data(:right, :fill, false, true)
154
154
 
155
155
  text <= [self, :styled_text_proxy_text,
@@ -186,7 +186,7 @@ module Glimmer
186
186
  }
187
187
 
188
188
  def code_text_widget
189
- @styled_text_proxy = styled_text(swt_style) {
189
+ @styled_text_proxy = styled_text(@swt_style) {
190
190
  # custom_widget_property_owner # TODO implement to route properties here without declaring method_missing
191
191
  layout_data :fill, :fill, true, true if lines
192
192
 
@@ -54,7 +54,7 @@ module Glimmer
54
54
  filter_and_paginate
55
55
  end
56
56
  @table_proxy.content {
57
- items <=> [self, :refined_model_array, model_binding.binding_options.merge(read_only: true)]
57
+ items <=> [self, :refined_model_array, model_binding.binding_options]
58
58
  }
59
59
  filter_and_paginate
60
60
  end
@@ -72,7 +72,7 @@ module Glimmer
72
72
 
73
73
  pagination
74
74
 
75
- @children_owner = @table_proxy = table(swt_style) {
75
+ @children_owner = @table_proxy = table(*swt_style_symbols) {
76
76
  layout_data(:fill, :fill, true, true)
77
77
  }
78
78
  }
@@ -161,13 +161,13 @@ module Glimmer
161
161
  end
162
162
  end
163
163
 
164
- attr_reader :body_root, :parent, :parent_proxy, :swt_style, :options
164
+ attr_reader :body_root, :parent, :parent_proxy, :swt_style_symbols, :options
165
165
 
166
- def initialize(parent, *swt_constants, options, &content)
166
+ def initialize(parent, *swt_style_symbols, 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] # TODO support non-standard styles like :editable, perhaps by packing in an array instead of interpreting right away
170
+ @swt_style_symbols = swt_style_symbols
171
171
  options ||= {}
172
172
  @options = self.class.options.merge(options)
173
173
  @content = Util::ProcTracker.new(content) if content
@@ -191,9 +191,10 @@ module Glimmer
191
191
  post_add_content if content.nil?
192
192
  end
193
193
 
194
+ # Calls post_initialize_child on children_owner by default
194
195
  # Subclasses may override to perform post initialization work on an added child
195
196
  def post_initialize_child(child)
196
- # No Op by default
197
+ children_owner.post_initialize_child(child)
197
198
  end
198
199
 
199
200
  def post_add_content
@@ -210,6 +211,14 @@ module Glimmer
210
211
  @swt_widget
211
212
  end
212
213
 
214
+ # returns calculated SWT style integer value from swt_style_symbols
215
+ # keep in mind that it would not work when using glimmer-only
216
+ # custom swt_style_symbols like :editable for table
217
+ # In that case, just reference swt_style_symbols array instead
218
+ def swt_style
219
+ @swt_style ||= SWT::SWTProxy[*@swt_style_symbols]
220
+ end
221
+
213
222
  def observer_registrations
214
223
  @observer_registrations ||= []
215
224
  end
@@ -36,12 +36,13 @@ class EmailShell
36
36
  option :to, default: '"John Irwin" <john.irwin@example.com>'
37
37
 
38
38
  before_body do
39
- @swt_style |= swt(:shell_trim, :modeless)
39
+ # build a custom swt_style based on passed in swt style symbols (built-in CustomShell attribute)
40
+ @swt_style = swt(:shell_trim, :modeless, *swt_style_symbols)
40
41
  end
41
42
 
42
43
  body {
43
- # pass received swt_style through to shell to customize it (e.g. :dialog_trim for a blocking shell)
44
- shell(parent_shell, swt_style) {
44
+ # pass received @swt_style through to shell to customize it (e.g. :dialog_trim for a blocking shell)
45
+ shell(parent_shell, @swt_style) {
45
46
  grid_layout(2, false)
46
47
 
47
48
  text subject
@@ -65,8 +65,8 @@ class GreetingLabel
65
65
  end
66
66
 
67
67
  body {
68
- # pass received swt_style through to label to customize (e.g. :center to center text)
69
- label(swt_style) {
68
+ # pass received swt style symbols through to label to customize (e.g. :center to center text)
69
+ label(*swt_style_symbols) {
70
70
  text "#{greeting}, #{name}!"
71
71
  font @font
72
72
  foreground <=> [self, :label_color]
@@ -59,6 +59,10 @@ class HelloRefinedTable
59
59
  {town: 'San Francisco', name: 'Giants', ballpark: 'Oracle Park'},
60
60
  ].map {|team_kwargs| new(team_kwargs)}
61
61
  end
62
+
63
+ def all_team_names
64
+ @all_team_names ||= BaseballTeam.all.map {|t| t[:name]}
65
+ end
62
66
  end
63
67
 
64
68
  def complete_name
@@ -71,14 +75,36 @@ class HelloRefinedTable
71
75
  home_team.complete_name
72
76
  end
73
77
 
78
+ def home_team_name=(new_name)
79
+ new_home_team = BaseballTeam.all.find {|t| t[:name] == new_name}
80
+ self.home_team = new_home_team if new_home_team
81
+ end
82
+
83
+ def home_team_name_options
84
+ BaseballTeam.all_team_names
85
+ end
86
+
74
87
  def away_team_name
75
88
  away_team.complete_name
76
89
  end
77
90
 
91
+ def away_team_name=(new_name)
92
+ new_away_team = BaseballTeam.all.find {|t| t[:name] == new_name}
93
+ self.away_team = new_away_team if new_away_team
94
+ end
95
+
96
+ def away_team_name_options
97
+ BaseballTeam.all_team_names
98
+ end
99
+
78
100
  def ballpark
79
101
  home_team.ballpark
80
102
  end
81
103
 
104
+ def date=(new_date)
105
+ self['date'] = new_date.respond_to?(:to_date) ? new_date.to_date : new_date
106
+ end
107
+
82
108
  def to_s
83
109
  "#{home_team_name} vs #{away_team_name} at #{ballpark}"
84
110
  end
@@ -137,22 +163,26 @@ class HelloRefinedTable
137
163
  shell {
138
164
  text 'Hello, Refined Table!'
139
165
 
140
- refined_table(per_page: 20) { # also `page: 1` by default
166
+ refined_table(:editable, :border, per_page: 20) { # also `page: 1` by default
141
167
  table_column {
142
168
  width 100
143
169
  text 'Date'
170
+ editor :date_drop_down
144
171
  }
145
172
  table_column {
146
173
  width 200
147
174
  text 'Ballpark'
175
+ editor :none
148
176
  }
149
177
  table_column {
150
178
  width 150
151
179
  text 'Home Team'
180
+ editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
152
181
  }
153
182
  table_column {
154
183
  width 150
155
184
  text 'Away Team'
185
+ editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
156
186
  }
157
187
 
158
188
  menu {
@@ -168,7 +198,7 @@ class HelloRefinedTable
168
198
  }
169
199
  }
170
200
 
171
- model_array <= [@baseball_season, :games, column_attributes: {'Home Team' => :home_team_name, 'Away Team' => :away_team_name}]
201
+ model_array <=> [@baseball_season, :games, column_attributes: {'Home Team' => :home_team_name, 'Away Team' => :away_team_name}]
172
202
  selection <=> [@baseball_season, :selected_game]
173
203
  }
174
204
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.24.4.4
4
+ version: 4.24.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh