glimmer-dsl-swt 4.24.4.1 → 4.24.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +5 -5
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +2 -1
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/data_binding/table_items_binding.rb +2 -0
- data/lib/glimmer/swt/custom/refined_table.rb +114 -61
- data/samples/elaborate/meta_sample/tutorials.yml +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: 3a089b978fce806c9396adb1f971c4ba8f5344f0b927e8781c6a6985d9c234d2
|
4
|
+
data.tar.gz: 82e0a576ebf56dd83bafda03378aec4cee32cfa0de1d2bf61bc247c2c33562a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 620cc756c24723f0e7443055b9f156e71a7312e07093142dc606f16692af7cd7f37eb97294586bbf79239ccd9fc3c34c9fb107efd28eb5713a287dd882ad1b48
|
7
|
+
data.tar.gz: 6c954efcf5550479ab13ef3f21b1f68f3f1ab32823fe638ef13618c5e3c12292f1d1fbb8ed42d2158a480a344ac64c12f2f87d8b96deeadda7373302e01167fb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 4.24.4.2
|
4
|
+
|
5
|
+
- `refined_table` filtering support
|
6
|
+
- Ensure correct `refined_table` enablement of pagination buttons based on whether on first/last page or not
|
7
|
+
- Display vertical scroll bar when setting `refined_table` `per_page` to a height value that results in table exceeding screen height
|
8
|
+
- Support `refined_table` nested elements `first_button {}`, `previous_button {}`, `page_text {}`, `next_button {}`, `last_button {}` to customize every widget within.
|
9
|
+
- Support `refined_table` attributes for accessing nested elements: `table_proxy`, `first_button_proxy`, `previous_button_proxy`, `page_text_proxy`, `next_button_proxy`, `last_button_proxy` to customize every widget within.
|
10
|
+
|
3
11
|
## 4.24.4.1
|
4
12
|
|
5
13
|
- Optimize `table` data-binding performance (improving paging performance in `refined_table`) by making observer registrations run asynchronously in a separate thread
|
@@ -8,6 +16,8 @@
|
|
8
16
|
|
9
17
|
## 4.24.4.0
|
10
18
|
|
19
|
+
- `refined_table` custom widget with pagination support (and future filtering support)
|
20
|
+
- Hello, Refined Table! sample demonstrating `refined_table`
|
11
21
|
- Save `WidgetBinding` instances on `WidgetProxy` objects via `widget_bindings` attribute
|
12
22
|
- Support specifying `@children_owner` in any custom widget for which adding children will not add them under the `body_root` (e.g. a composite wrapping a table will designate the table as the `@children_owner` for adding `table_column`s)
|
13
23
|
- Add explicit `shell_proxy` method to `Glimmer::UI::CustomWidget` that delegates to `body_root` to avoid annoying false negative error every time that method is called
|
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.2
|
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.2 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.2
|
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.2'
|
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.2
|
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.2
|
@@ -4311,13 +4311,14 @@ Here is an explanation of the example above:
|
|
4311
4311
|
|
4312
4312
|
**(ALPHA FEATURE)**
|
4313
4313
|
|
4314
|
-
`refined_table` is a custom widget that can handle very large amounts of data by applying pagination.
|
4314
|
+
`refined_table` is a custom widget that can handle very large amounts of data by applying pagination and filtering.
|
4315
4315
|
|
4316
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
|
+
- `query` (default: `''`): specifies filter query term (empty shows all results)
|
4321
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).
|
4323
4324
|
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -31,12 +31,16 @@ module Glimmer
|
|
31
31
|
option :per_page, default: 10
|
32
32
|
option :page, default: 0
|
33
33
|
option :model_array
|
34
|
+
option :query, default: ''
|
34
35
|
|
36
|
+
attr_accessor :filtered_model_array
|
35
37
|
attr_accessor :refined_model_array
|
36
|
-
attr_reader :table_proxy, :page_text_proxy
|
38
|
+
attr_reader :table_proxy, :page_text_proxy, :first_button_proxy, :previous_button_proxy, :next_button_proxy, :last_button_proxy
|
37
39
|
|
38
40
|
before_body do
|
41
|
+
self.query ||= ''
|
39
42
|
self.model_array ||= []
|
43
|
+
self.filtered_model_array = []
|
40
44
|
self.refined_model_array = []
|
41
45
|
end
|
42
46
|
|
@@ -47,12 +51,12 @@ module Glimmer
|
|
47
51
|
@data_bound = true
|
48
52
|
model_binding = new_widget_binding.model_binding
|
49
53
|
observe(self, :model_array) do
|
50
|
-
|
54
|
+
filter_and_paginate
|
51
55
|
end
|
52
56
|
@table_proxy.content {
|
53
57
|
items(dsl: true) <=> [self, :refined_model_array, model_binding.binding_options.merge(read_only: true)]
|
54
58
|
}
|
55
|
-
|
59
|
+
filter_and_paginate
|
56
60
|
end
|
57
61
|
end
|
58
62
|
end.observe(body_root.widget_bindings)
|
@@ -60,76 +64,112 @@ module Glimmer
|
|
60
64
|
|
61
65
|
body {
|
62
66
|
composite {
|
63
|
-
|
67
|
+
text(:search, :border) {
|
64
68
|
layout_data(:fill, :center, true, false)
|
65
69
|
|
66
|
-
|
70
|
+
text <=> [self, :query, after_write: -> { filter_and_paginate }]
|
71
|
+
}
|
72
|
+
|
73
|
+
pagination
|
74
|
+
|
75
|
+
@children_owner = @table_proxy = table(swt_style) {
|
76
|
+
layout_data(:fill, :fill, true, true)
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
def pagination
|
82
|
+
composite {
|
83
|
+
layout_data(:fill, :center, true, false)
|
84
|
+
|
85
|
+
fill_layout(:horizontal)
|
86
|
+
|
87
|
+
@first_button_proxy = button {
|
88
|
+
text '<<'
|
89
|
+
enabled <= [self, :page, on_read: ->(value) {value > first_page}]
|
67
90
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
91
|
+
on_widget_selected do
|
92
|
+
self.page = first_page
|
93
|
+
filter_and_paginate
|
94
|
+
end
|
95
|
+
}
|
96
|
+
|
97
|
+
@previous_button_proxy = button {
|
98
|
+
text '<'
|
99
|
+
enabled <= [self, :page, on_read: ->(value) {value > first_page}]
|
76
100
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
101
|
+
on_widget_selected do
|
102
|
+
self.page -= 1
|
103
|
+
filter_and_paginate
|
104
|
+
end
|
105
|
+
}
|
106
|
+
|
107
|
+
@page_text_proxy = text(:border, :center) {
|
108
|
+
text <= [self, :page, on_read: ->(value) { "#{value} of #{page_count}" }]
|
85
109
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
on_focus_gained do
|
90
|
-
@page_text_proxy.select_all
|
91
|
-
end
|
92
|
-
|
93
|
-
on_focus_lost do
|
94
|
-
self.page = @page_text_proxy.text.to_i
|
95
|
-
paginate
|
96
|
-
end
|
97
|
-
|
98
|
-
on_key_pressed do |key_event|
|
99
|
-
if key_event.keyCode == swt(:cr)
|
100
|
-
self.page = @page_text_proxy.text.to_i
|
101
|
-
paginate
|
102
|
-
end
|
103
|
-
end
|
104
|
-
}
|
110
|
+
on_focus_gained do
|
111
|
+
@page_text_proxy.select_all
|
112
|
+
end
|
105
113
|
|
106
|
-
|
107
|
-
text
|
108
|
-
|
109
|
-
|
110
|
-
self.page += 1
|
111
|
-
paginate
|
112
|
-
end
|
113
|
-
}
|
114
|
+
on_focus_lost do
|
115
|
+
self.page = @page_text_proxy.text.to_i
|
116
|
+
filter_and_paginate
|
117
|
+
end
|
114
118
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
self.page = last_page
|
120
|
-
paginate
|
119
|
+
on_key_pressed do |key_event|
|
120
|
+
if key_event.keyCode == swt(:cr)
|
121
|
+
self.page = @page_text_proxy.text.to_i
|
122
|
+
filter_and_paginate
|
121
123
|
end
|
122
|
-
|
124
|
+
end
|
123
125
|
}
|
124
126
|
|
125
|
-
@
|
127
|
+
@next_button_proxy = button {
|
128
|
+
text '>'
|
129
|
+
enabled <= [self, :page, on_read: ->(value) {value < last_page}]
|
130
|
+
|
131
|
+
on_widget_selected do
|
132
|
+
self.page += 1
|
133
|
+
filter_and_paginate
|
134
|
+
end
|
135
|
+
}
|
136
|
+
|
137
|
+
@last_button_proxy = button {
|
138
|
+
text '>>'
|
139
|
+
enabled <= [self, :page, on_read: ->(value) {value < last_page}]
|
140
|
+
|
141
|
+
on_widget_selected do
|
142
|
+
self.page = last_page
|
143
|
+
filter_and_paginate
|
144
|
+
end
|
145
|
+
}
|
126
146
|
}
|
127
|
-
|
147
|
+
end
|
128
148
|
|
129
149
|
def table_block=(block)
|
130
150
|
@table_proxy.content(&block)
|
131
151
|
end
|
132
152
|
|
153
|
+
def page_text_block=(block)
|
154
|
+
@page_text_proxy.content(&block)
|
155
|
+
end
|
156
|
+
|
157
|
+
def first_button_block=(block)
|
158
|
+
@first_button_proxy.content(&block)
|
159
|
+
end
|
160
|
+
|
161
|
+
def previous_button_block=(block)
|
162
|
+
@previous_button_proxy.content(&block)
|
163
|
+
end
|
164
|
+
|
165
|
+
def next_button_block=(block)
|
166
|
+
@next_button_proxy.content(&block)
|
167
|
+
end
|
168
|
+
|
169
|
+
def last_button_block=(block)
|
170
|
+
@last_button_proxy.content(&block)
|
171
|
+
end
|
172
|
+
|
133
173
|
def method_missing(method_name, *args, &block)
|
134
174
|
dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
|
135
175
|
if dsl_mode
|
@@ -153,28 +193,41 @@ module Glimmer
|
|
153
193
|
end
|
154
194
|
|
155
195
|
def page_count
|
156
|
-
(
|
196
|
+
(filtered_model_array && (filtered_model_array.count / per_page.to_f).ceil) || 0
|
157
197
|
end
|
158
198
|
|
159
199
|
def corrected_page(initial_page_value = nil)
|
160
200
|
correct_page = initial_page_value || page
|
161
201
|
correct_page = [correct_page, page_count].min
|
162
202
|
correct_page = [correct_page, 1].max
|
163
|
-
correct_page = (
|
203
|
+
correct_page = (filtered_model_array&.count.to_i > 0) ? (correct_page > 0 ? correct_page : 1) : 0
|
164
204
|
correct_page
|
165
205
|
end
|
166
206
|
|
167
207
|
def first_page
|
168
|
-
(
|
208
|
+
(filtered_model_array&.count.to_i > 0) ? 1 : 0
|
169
209
|
end
|
170
210
|
|
171
211
|
def last_page
|
172
212
|
page_count
|
173
213
|
end
|
174
214
|
|
215
|
+
def filter_and_paginate
|
216
|
+
filter
|
217
|
+
paginate
|
218
|
+
end
|
219
|
+
|
220
|
+
def filter
|
221
|
+
self.filtered_model_array = model_array.select do |model|
|
222
|
+
@table_proxy.cells_for(model).any? do |cell_text|
|
223
|
+
cell_text.to_s.downcase.include?(query.to_s.downcase)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
175
228
|
def paginate
|
176
229
|
self.page = corrected_page(page)
|
177
|
-
self.refined_model_array =
|
230
|
+
self.refined_model_array = filtered_model_array[(page - 1) * per_page, per_page]
|
178
231
|
end
|
179
232
|
end
|
180
233
|
end
|
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.2
|
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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|