glimmer-dsl-swt 4.24.4.5 → 4.24.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +5 -5
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/swt/custom/refined_table.rb +33 -0
- data/lib/glimmer/swt/table_column_proxy.rb +3 -3
- data/lib/glimmer/swt/table_proxy.rb +35 -25
- data/lib/glimmer/swt/widget_proxy.rb +6 -3
- data/samples/elaborate/meta_sample/tutorials.yml +1 -0
- data/samples/elaborate/tetris/view/high_score_dialog.rb +2 -2
- data/samples/hello/hello_refined_table.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e35a647a3770c1d5d57e5f7f8a26ad1f607e1c77719797643238f11e99ba9a55
|
4
|
+
data.tar.gz: dbf9f410d0c1008ad62e590811168ea8b0ec2e119dfc275a2feed6454cf5f1ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a49ad225fa01ee4725a3103766ec7f7a4ecfea439df3d66ca3fc77448345766f4e60072691f903579d27d7a6999172581aadfcea5445c5ea973ef56894b40388
|
7
|
+
data.tar.gz: c4dc1ae979fccb36b594a368c7f49e48722782589fa65b432d2e04d0306cbf8b878b0e98418d49b9f14955dc5266e9bc1bf7eaee510d9b72d9ab63ac9785100a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 4.24.4.6
|
4
|
+
|
5
|
+
- Support `refined_table` sorting (now clicking on headers sorts the entire `model_array` collection, not just the visible rows)
|
6
|
+
- Support `table` `no_sort` attribute to disable sorting in general if needed
|
7
|
+
- Fix issue with Tetris sample upon restart of game (WidgetProxy#shell_proxy method was failing for being disposed, now it retains a reference to parent that stays if disposed)
|
8
|
+
|
3
9
|
## 4.24.4.5
|
4
10
|
|
5
11
|
- Support `refined_table` `:editable` SWT style and `model_array` bidirectional 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.
|
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.6
|
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.
|
24
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.4.6 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.
|
341
|
+
jgem install glimmer-dsl-swt -v 4.24.4.6
|
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.
|
369
|
+
gem 'glimmer-dsl-swt', '~> 4.24.4.6'
|
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.
|
392
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.4.6
|
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.
|
1
|
+
4.24.4.6
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -50,6 +50,7 @@ module Glimmer
|
|
50
50
|
if new_widget_binding.property.to_s == 'model_array' && !@data_bound
|
51
51
|
@data_bound = true
|
52
52
|
model_binding = new_widget_binding.model_binding
|
53
|
+
configure_sorting
|
53
54
|
observe(self, :model_array) do
|
54
55
|
filter_and_paginate
|
55
56
|
end
|
@@ -210,6 +211,38 @@ module Glimmer
|
|
210
211
|
self.page = corrected_page(page)
|
211
212
|
self.refined_model_array = filtered_model_array[(page - 1) * per_page, per_page]
|
212
213
|
end
|
214
|
+
|
215
|
+
private
|
216
|
+
|
217
|
+
def configure_sorting
|
218
|
+
@table_proxy.sort_strategy = lambda do
|
219
|
+
array = model_array.dup
|
220
|
+
array = array.sort_by(&:hash) # this ensures consistent subsequent sorting in case there are equivalent sorts to avoid an infinite loop
|
221
|
+
# Converting value to_s first to handle nil cases. Should work with numeric, boolean, and date fields
|
222
|
+
if @table_proxy.sort_block
|
223
|
+
sorted_array = array.sort(&@table_proxy.sort_block)
|
224
|
+
elsif @table_proxy.sort_by_block
|
225
|
+
sorted_array = array.sort_by(&@table_proxy.sort_by_block)
|
226
|
+
else
|
227
|
+
sorted_array = array.sort_by do |object|
|
228
|
+
@table_proxy.sort_property.each_with_index.map do |a_sort_property, i|
|
229
|
+
value = object.send(a_sort_property)
|
230
|
+
# handle nil and difficult to compare types gracefully
|
231
|
+
if @table_proxy.sort_type[i] == Integer
|
232
|
+
value = value.to_i
|
233
|
+
elsif @table_proxy.sort_type[i] == Float
|
234
|
+
value = value.to_f
|
235
|
+
elsif @table_proxy.sort_type[i] == String
|
236
|
+
value = value.to_s
|
237
|
+
end
|
238
|
+
value
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
sorted_array = sorted_array.reverse if @table_proxy.sort_direction == :descending
|
243
|
+
self.model_array = sorted_array
|
244
|
+
end
|
245
|
+
end
|
213
246
|
end
|
214
247
|
end
|
215
248
|
end
|
@@ -27,15 +27,15 @@ module Glimmer
|
|
27
27
|
# A proxy object representing SWT TableColumn
|
28
28
|
# Accepts a :no_sort custom style to disable sorting on this column
|
29
29
|
class TableColumnProxy < Glimmer::SWT::WidgetProxy
|
30
|
-
attr_reader :
|
30
|
+
attr_reader :sort_property, :editor
|
31
|
+
attr_accessor :no_sort, :sort_block, :sort_by_block
|
31
32
|
alias no_sort? no_sort
|
32
|
-
attr_accessor :sort_block, :sort_by_block
|
33
33
|
|
34
34
|
def initialize(underscored_widget_name, parent, args)
|
35
35
|
@no_sort = args.delete(:no_sort)
|
36
36
|
super
|
37
37
|
on_widget_selected do |event|
|
38
|
-
parent.sort_by_column!(self)
|
38
|
+
parent.sort_by_column!(self) unless no_sort?
|
39
39
|
end unless no_sort?
|
40
40
|
end
|
41
41
|
|
@@ -247,7 +247,7 @@ module Glimmer
|
|
247
247
|
|
248
248
|
attr_reader :table_editor, :table_editor_widget_proxy, :sort_property, :sort_direction, :sort_block, :sort_type, :sort_by_block, :additional_sort_properties, :editor, :editable
|
249
249
|
attr_writer :column_properties
|
250
|
-
attr_accessor :table_items_binding
|
250
|
+
attr_accessor :table_items_binding, :sort_strategy
|
251
251
|
alias column_attributes= column_properties=
|
252
252
|
alias editable? editable
|
253
253
|
|
@@ -398,36 +398,46 @@ module Glimmer
|
|
398
398
|
|
399
399
|
def sort!(internal_sort: false)
|
400
400
|
return unless sort_property && (sort_type || sort_block || sort_by_block)
|
401
|
-
|
402
|
-
|
403
|
-
# Converting value to_s first to handle nil cases. Should work with numeric, boolean, and date fields
|
404
|
-
if sort_block
|
405
|
-
sorted_array = array.sort(&sort_block)
|
406
|
-
elsif sort_by_block
|
407
|
-
sorted_array = array.sort_by(&sort_by_block)
|
401
|
+
if sort_strategy
|
402
|
+
sort_strategy.call
|
408
403
|
else
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
404
|
+
original_array = array = model_binding.evaluate_property
|
405
|
+
array = array.sort_by(&:hash) # this ensures consistent subsequent sorting in case there are equivalent sorts to avoid an infinite loop
|
406
|
+
# Converting value to_s first to handle nil cases. Should work with numeric, boolean, and date fields
|
407
|
+
if sort_block
|
408
|
+
sorted_array = array.sort(&sort_block)
|
409
|
+
elsif sort_by_block
|
410
|
+
sorted_array = array.sort_by(&sort_by_block)
|
411
|
+
else
|
412
|
+
sorted_array = array.sort_by do |object|
|
413
|
+
sort_property.each_with_index.map do |a_sort_property, i|
|
414
|
+
value = object.send(a_sort_property)
|
415
|
+
# handle nil and difficult to compare types gracefully
|
416
|
+
if sort_type[i] == Integer
|
417
|
+
value = value.to_i
|
418
|
+
elsif sort_type[i] == Float
|
419
|
+
value = value.to_f
|
420
|
+
elsif sort_type[i] == String
|
421
|
+
value = value.to_s
|
422
|
+
end
|
423
|
+
value
|
419
424
|
end
|
420
|
-
value
|
421
425
|
end
|
422
426
|
end
|
427
|
+
sorted_array = sorted_array.reverse if sort_direction == :descending
|
428
|
+
if model_binding.binding_options.symbolize_keys[:read_only_sort]
|
429
|
+
table_items_binding.call(sorted_array, internal_sort: true) unless internal_sort
|
430
|
+
else
|
431
|
+
model_binding.call(sorted_array)
|
432
|
+
end
|
433
|
+
sorted_array
|
423
434
|
end
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
435
|
+
end
|
436
|
+
|
437
|
+
def no_sort=(value)
|
438
|
+
table_column_proxies.each do |table_column_proxy|
|
439
|
+
table_column_proxy.no_sort = value
|
429
440
|
end
|
430
|
-
sorted_array
|
431
441
|
end
|
432
442
|
|
433
443
|
def editor=(args)
|
@@ -167,6 +167,7 @@ module Glimmer
|
|
167
167
|
parent = swt_widget.parent
|
168
168
|
@parent_proxy = parent&.get_data('proxy') || parent_proxy_class.new(swt_widget: parent)
|
169
169
|
end
|
170
|
+
shell_proxy # populates @shell_proxy attribute
|
170
171
|
if @swt_widget&.get_data('proxy').nil?
|
171
172
|
@swt_widget.set_data('proxy', self)
|
172
173
|
DEFAULT_INITIALIZERS[underscored_widget_name.to_s.to_sym]&.call(@swt_widget)
|
@@ -201,10 +202,12 @@ module Glimmer
|
|
201
202
|
end
|
202
203
|
|
203
204
|
def shell_proxy
|
204
|
-
if @swt_widget.respond_to?(:shell)
|
205
|
-
@swt_widget.shell.get_data('proxy')
|
205
|
+
if @swt_widget.respond_to?(:shell) && !@swt_widget.is_disposed
|
206
|
+
@shell_proxy = @swt_widget.shell.get_data('proxy')
|
207
|
+
elsif @parent_proxy&.shell_proxy
|
208
|
+
@shell_proxy = @parent_proxy&.shell_proxy
|
206
209
|
else
|
207
|
-
@
|
210
|
+
@shell_proxy
|
208
211
|
end
|
209
212
|
end
|
210
213
|
|
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.
|
4
|
+
version: 4.24.4.6
|
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-
|
11
|
+
date: 2022-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|