glimmer-dsl-swt 4.24.4.0 → 4.24.4.1
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/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +7 -7
- data/docs/reference/GLIMMER_SAMPLES.md +1 -1
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/ext/glimmer.rb +5 -0
- data/lib/glimmer/data_binding/table_items_binding.rb +45 -21
- data/lib/glimmer/swt/table_proxy.rb +1 -0
- data/samples/elaborate/contact_manager.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0501a99ee5c020f5af90de5bef4b2de5649b71ecc72ef18c07cf7624e202cd2
|
4
|
+
data.tar.gz: 17f1582e1692df7535ff337c9994f4db60ebf85c1ebc2a1e34057f29218e6dfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6653469f0356e6f8b26176cf1ed780b77a04288855c532c7f33cc0a6363e2674b79fb836cf9482cb7668d06002d8cfc097f73df7b9c1777b835ec231db37d76
|
7
|
+
data.tar.gz: 87f7266996c85bb845495032c41f84132a86c935a516f6a38a96a3b57904855096c00e522c6065124b881f6fbaff865066f7978fe64e392a168d91e4a4aa7abc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 4.24.4.1
|
4
|
+
|
5
|
+
- Optimize `table` data-binding performance (improving paging performance in `refined_table`) by making observer registrations run asynchronously in a separate thread
|
6
|
+
- Fix cleaning of old `table` data-binding observers (it was retaining some old observers after table updates)
|
7
|
+
- Fix issue with ActiveSupport overriding Facets String `underscore`/`snakecase`/`titlecase`/`camelcase` methods with different incompatible implementations when loaded by a project (now, that is repaired automatically)
|
8
|
+
|
3
9
|
## 4.24.4.0
|
4
10
|
|
5
11
|
- Save `WidgetBinding` instances on `WidgetProxy` objects via `widget_bindings` attribute
|
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.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)
|
@@ -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.1 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.1
|
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.1'
|
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.1
|
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.1
|
@@ -58,7 +58,7 @@ This guide should help you get started with Glimmer DSL for SWT. For more advanc
|
|
58
58
|
- [Table Selection](#table-selection)
|
59
59
|
- [Table Editing](#table-editing)
|
60
60
|
- [Table Sorting](#table-sorting)
|
61
|
-
- [Refined Table
|
61
|
+
- [Refined Table](#refined-table)
|
62
62
|
- [Tree](#tree)
|
63
63
|
- [DateTime](#datetime)
|
64
64
|
- [Observer](#observer)
|
@@ -4111,8 +4111,8 @@ This automatically leverages the SWT TableEditor custom class behind the scenes,
|
|
4111
4111
|
passed table item text into something else.
|
4112
4112
|
It automatically persists the change to `items` data-bound model on ENTER/FOCUS-OUT or cancels on ESC/NO-CHANGE.
|
4113
4113
|
|
4114
|
-
Note that `table` is
|
4115
|
-
If you need to display a table with more than 100 rows, then you need to employ pagination. That is already supported in the [Refined Table (`refined_table`)](#refined-table
|
4114
|
+
Note that `table` is useful with a maximum of about 100 rows only, not more than that, or otherwise it will not offer a user-friendly experience due to requiring users to scroll through a lot of data.
|
4115
|
+
If you need to display a table with more than 100 rows, then you need to employ pagination. That is already supported in the [Refined Table (`refined_table`)](#refined-table) custom widget documented below.
|
4116
4116
|
|
4117
4117
|
##### Table Item Properties
|
4118
4118
|
|
@@ -4241,7 +4241,7 @@ shell {
|
|
4241
4241
|
|
4242
4242
|
Check out [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) for an actual example including table editors.
|
4243
4243
|
|
4244
|
-
[Are We There Yet?](#are-we-there-yet) is an actual production Glimmer application that takes full advantage of table capabilities, storing model data in a database via ActiveRecord. As such, it's an excellent demonstration of how to use Glimmer DSL for SWT with a database.
|
4244
|
+
[Are We There Yet?](#are-we-there-yet) is an actual production Glimmer application that takes full advantage of table capabilities, storing model data in a database via ActiveRecord and SQLite DB. As such, it's an excellent demonstration of how to use Glimmer DSL for SWT with a database. [Contact Manager](https://github.com/AndyObtiva/contact_manager) is an external sample application that also utilizes a table with ActiveRecord and SQLite DB. It comes with a [blog post](https://andymaleh.blogspot.com/2022/06/using-activerecord-with-sqlite-db-in.html?m=0) that provides a step by step guide on how to build such an application.
|
4245
4245
|
|
4246
4246
|
##### Table Sorting
|
4247
4247
|
|
@@ -4307,19 +4307,19 @@ Here is an explanation of the example above:
|
|
4307
4307
|
|
4308
4308
|
`<= [model, :property, read_only_sort: true]` could be used with items to make sorting not propagate sorting changes to model.
|
4309
4309
|
|
4310
|
-
##### Refined Table
|
4310
|
+
##### Refined Table
|
4311
4311
|
|
4312
4312
|
**(ALPHA FEATURE)**
|
4313
4313
|
|
4314
4314
|
`refined_table` is a custom widget that can handle very large amounts of data by applying pagination.
|
4315
4315
|
|
4316
|
-
Just use like a standard `table`, but data-bind models to
|
4316
|
+
Just use like a standard `table`, but data-bind models to the `model_array` property instead of `items`. `refined_table` will take care of the rest.
|
4317
4317
|
|
4318
4318
|
Options:
|
4319
4319
|
- `per_page` (default: `10`): specifies how many rows to display per page
|
4320
4320
|
- `page` (default: `1` if table is filled and `0` otherwise): specifies initial page
|
4321
4321
|
|
4322
|
-
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
|
4322
|
+
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).
|
4323
4323
|
|
4324
4324
|
Example taken from [Hello, Refined Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-refined-table):
|
4325
4325
|
|
@@ -783,7 +783,7 @@ Hello, Table! Game Booked Rows
|
|
783
783
|
|
784
784
|
#### Hello, Refined Table!
|
785
785
|
|
786
|
-
This sample demonstrates the use of the [`refined_table` widget](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#refined-table
|
786
|
+
This sample demonstrates the use of the [`refined_table` widget](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#refined-table), which provides a paginated `table` that can handle very large amounts of data.
|
787
787
|
|
788
788
|
Code:
|
789
789
|
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
data/lib/ext/glimmer.rb
CHANGED
@@ -27,6 +27,11 @@ module Glimmer
|
|
27
27
|
if Object.const_defined?(:ActiveSupport) && ActiveSupport.const_defined?(:Dependencies)
|
28
28
|
begin
|
29
29
|
ActiveSupport::Dependencies.unhook!
|
30
|
+
# override activesupport string method implementations if already loaded
|
31
|
+
gem 'facets'
|
32
|
+
load 'facets/string/snakecase.rb'
|
33
|
+
load 'facets/string/titlecase.rb'
|
34
|
+
load 'facets/string/camelcase.rb'
|
30
35
|
rescue => e
|
31
36
|
# noop TODO support logging unimportant details below debug level
|
32
37
|
end
|
@@ -37,9 +37,12 @@ module Glimmer
|
|
37
37
|
include_package 'org.eclipse.swt.widgets'
|
38
38
|
|
39
39
|
TABLE_ITEM_PROPERTIES = %w[background foreground font image]
|
40
|
+
|
41
|
+
attr_reader :data_binding_done
|
40
42
|
|
41
43
|
def initialize(parent, model_binding, column_properties = nil)
|
42
44
|
@table = parent.is_a?(Glimmer::SWT::TableProxy) ? parent : parent.body_root # assume custom widget in latter case
|
45
|
+
@table.table_items_binding = self
|
43
46
|
@model_binding = model_binding
|
44
47
|
@read_only_sort = @model_binding.binding_options[:read_only_sort]
|
45
48
|
@table.editable = false if @model_binding.binding_options[:read_only]
|
@@ -81,31 +84,35 @@ module Glimmer
|
|
81
84
|
else
|
82
85
|
if new_model_collection and new_model_collection.is_a?(Array)
|
83
86
|
@model_observer_registrations ||= {}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
if !same_model_collection_with_different_sort?(new_model_collection)
|
97
|
-
new_model_collection.each do |model|
|
98
|
-
TABLE_ITEM_PROPERTIES.each do |table_item_property|
|
87
|
+
@table_item_property_observation_mutex ||= Mutex.new
|
88
|
+
|
89
|
+
Thread.new do
|
90
|
+
@data_binding_done = false
|
91
|
+
@table_item_property_observation_mutex.synchronize do
|
92
|
+
deregister_model_observer_registrations
|
93
|
+
|
94
|
+
new_model_collection.each_with_index do |model, model_index|
|
95
|
+
@model_observer_registrations[model_index] ||= {}
|
99
96
|
@column_properties.each do |column_property|
|
100
|
-
column_property = "#{column_property}_#{table_item_property}"
|
101
|
-
old_model_observer_registration = @model_observer_registrations[model][column_property]
|
102
|
-
remove_dependent(@table_observer_registration => old_model_observer_registration) if old_model_observer_registration
|
103
|
-
old_model_observer_registration&.unobserve
|
104
97
|
model_observer_registration = observe(model, column_property)
|
105
|
-
@model_observer_registrations[
|
98
|
+
@model_observer_registrations[model_index][column_property] = model_observer_registration
|
106
99
|
add_dependent(@table_observer_registration => model_observer_registration)
|
107
100
|
end
|
108
101
|
end
|
102
|
+
|
103
|
+
if !same_model_collection_with_different_sort?(new_model_collection)
|
104
|
+
new_model_collection.each_with_index do |model, model_index|
|
105
|
+
TABLE_ITEM_PROPERTIES.each do |table_item_property|
|
106
|
+
@column_properties.each do |column_property|
|
107
|
+
column_property = "#{column_property}_#{table_item_property}"
|
108
|
+
model_observer_registration = observe(model, column_property)
|
109
|
+
@model_observer_registrations[model_index][column_property] = model_observer_registration
|
110
|
+
add_dependent(@table_observer_registration => model_observer_registration)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
@data_binding_done = true
|
109
116
|
end
|
110
117
|
end
|
111
118
|
|
@@ -211,7 +218,24 @@ module Glimmer
|
|
211
218
|
end
|
212
219
|
|
213
220
|
def table_item_model_collection
|
214
|
-
|
221
|
+
Glimmer::SWT::DisplayProxy.instance.auto_exec do
|
222
|
+
if @table.disposed?
|
223
|
+
[]
|
224
|
+
else
|
225
|
+
@table.swt_widget.items.map(&:get_data)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
def deregister_model_observer_registrations
|
231
|
+
@model_observer_registrations&.dup&.each do |model_index, model_column_properties|
|
232
|
+
model_column_properties.dup.each do |column_property, model_observer_registration|
|
233
|
+
remove_dependent(@table_observer_registration => model_observer_registration) if model_observer_registration
|
234
|
+
model_observer_registration&.unobserve
|
235
|
+
model_column_properties.delete(column_property)
|
236
|
+
end
|
237
|
+
@model_observer_registrations.delete(model_index)
|
238
|
+
end
|
215
239
|
end
|
216
240
|
|
217
241
|
def model_collection_attribute_values(model_collection)
|
@@ -247,6 +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
251
|
alias column_attributes= column_properties=
|
251
252
|
alias editable? editable
|
252
253
|
|
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.1
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -344,17 +344,17 @@ dependencies:
|
|
344
344
|
version: 0.14.1.cr2
|
345
345
|
description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI
|
346
346
|
cross-platform desktop development library written in JRuby, an OS-threaded faster
|
347
|
-
JVM version of Ruby. It includes SWT 4.
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
347
|
+
JVM version of Ruby. It includes SWT 4.24 (released June 7, 2022). Glimmer's main
|
348
|
+
innovation is a declarative Ruby DSL that enables productive and efficient authoring
|
349
|
+
of desktop application user-interfaces by relying on the robust Eclipse SWT library.
|
350
|
+
Glimmer additionally innovates by having built-in data-binding support, which greatly
|
351
|
+
facilitates synchronizing the GUI with domain models, thus achieving true decoupling
|
352
|
+
of object oriented components and enabling developers to solve business problems
|
353
|
+
(test-first) without worrying about GUI concerns, or alternatively drive development
|
354
|
+
GUI-first, and then write clean business models (test-first) afterwards. Not only
|
355
|
+
does Glimmer provide a large set of GUI widgets, but it also supports drawing Canvas
|
356
|
+
Graphics like Shapes and Animations. To get started quickly, Glimmer offers scaffolding
|
357
|
+
options for Apps, Gems, and Custom Widgets. Glimmer also includes native-executable
|
358
358
|
packaging support, sorely lacking in other libraries, thus enabling the delivery
|
359
359
|
of desktop apps written in Ruby as truly native DMG/PKG/APP files on the Mac, MSI/EXE
|
360
360
|
files on Windows, and DEB/RPM files on Linux. Glimmer was the first Ruby gem to
|