glimmer-dsl-swt 4.20.0.2 → 4.20.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/README.md +6 -6
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_SAMPLES.md +128 -49
- data/docs/reference/GLIMMER_STYLE_GUIDE.md +4 -3
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/data_binding/shine.rb +3 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +2 -2
- data/lib/glimmer/data_binding/tree_items_binding.rb +2 -2
- data/lib/glimmer/dsl/swt/shine_data_binding_expression.rb +6 -3
- data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +2 -2
- data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +17 -12
- data/lib/glimmer/dsl/swt/widget_listener_expression.rb +3 -3
- data/lib/glimmer/swt/display_proxy.rb +11 -8
- data/lib/glimmer/swt/proxy_properties.rb +2 -1
- data/lib/glimmer/swt/table_proxy.rb +15 -8
- data/lib/glimmer/swt/widget_proxy.rb +2 -2
- data/lib/glimmer/ui/custom_shell.rb +3 -3
- data/lib/glimmer/ui/custom_widget.rb +5 -2
- data/samples/elaborate/calculator.rb +116 -0
- data/samples/elaborate/calculator/model/command.rb +105 -0
- data/samples/elaborate/calculator/model/command/all_clear.rb +17 -0
- data/samples/elaborate/calculator/model/command/command_history.rb +0 -0
- data/samples/elaborate/calculator/model/command/equals.rb +18 -0
- data/samples/elaborate/calculator/model/command/number.rb +20 -0
- data/samples/elaborate/calculator/model/command/operation.rb +27 -0
- data/samples/elaborate/calculator/model/command/operation/add.rb +15 -0
- data/samples/elaborate/calculator/model/command/operation/divide.rb +15 -0
- data/samples/elaborate/calculator/model/command/operation/multiply.rb +15 -0
- data/samples/elaborate/calculator/model/command/operation/subtract.rb +15 -0
- data/samples/elaborate/calculator/model/command/point.rb +20 -0
- data/samples/elaborate/calculator/model/presenter.rb +30 -0
- data/samples/elaborate/login.rb +15 -13
- data/samples/elaborate/tetris.rb +6 -6
- data/samples/elaborate/tetris/view/high_score_dialog.rb +1 -1
- data/samples/elaborate/timer.rb +233 -0
- data/samples/elaborate/timer/alarm1.wav +0 -0
- data/samples/elaborate/timer/sounds/alarm1.wav +0 -0
- data/samples/elaborate/user_profile.rb +4 -2
- data/samples/elaborate/weather.rb +164 -0
- data/samples/hello/hello_cool_bar.rb +4 -4
- data/samples/hello/hello_layout.rb +6 -2
- data/samples/hello/hello_shell.rb +205 -0
- data/samples/hello/hello_table.rb +5 -5
- data/samples/hello/hello_text.rb +120 -0
- data/samples/hello/hello_tool_bar.rb +4 -4
- data/samples/hello/hello_tree.rb +11 -11
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 833c707b308578391e1ce4676ed517d6297250cb9272f6f3c7539c2b538403c6
|
4
|
+
data.tar.gz: 9f9bc412c837ba8389333587638638b95534634464f5084e9471de028747dc9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f46c2d58b167cd75c807fce955eae9a1abc6895414311b93fdf6950d54c8fc14f15384dd8a19bfef0f2503e2f732c73e79e342e9d03d7f9a69990844dacc9c81
|
7
|
+
data.tar.gz: 9e41adb252a09d397cb1b81cf91c9a37e89c95fdbf00b74134d38baaaac920ed74396df92b926e593b5ba4ae9005a7b43b3d64f4aec5576ef0ae237c0de35db2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.20.2.0
|
4
|
+
|
5
|
+
- Shine data-binding syntax support for `tree` widget
|
6
|
+
- Use Shine syntax in Hello, Tree! sample
|
7
|
+
|
8
|
+
### 4.20.1.0
|
9
|
+
|
10
|
+
- Shine data-binding syntax support for `table` widget
|
11
|
+
- Use Shine syntax in Hello, Table! and Contact Manager samples
|
12
|
+
|
13
|
+
### 4.20.0.5
|
14
|
+
|
15
|
+
- Hello, Text! sample
|
16
|
+
- Timer elaborate sample (copied and simplified from external sample)
|
17
|
+
- Calculator elaborate sample (copied and simplified from external sample)
|
18
|
+
- Fixed issue relating to cleaning up display listeners
|
19
|
+
|
20
|
+
### 4.20.0.4
|
21
|
+
|
22
|
+
- Weather elaborate sample
|
23
|
+
|
24
|
+
### 4.20.0.3
|
25
|
+
|
26
|
+
- Hello, Shell! sample
|
27
|
+
|
28
|
+
### 4.20.0.2
|
29
|
+
|
30
|
+
- Hello, Tool Bar! sample
|
31
|
+
- Hello, Cool Bar! sample
|
32
|
+
|
3
33
|
### 4.20.0.1
|
4
34
|
|
5
35
|
- Hello, Composite! 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
|
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.2.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
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.2.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
|
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
|
344
|
+
jgem install glimmer-dsl-swt -v 4.20.2.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
|
372
|
+
gem 'glimmer-dsl-swt', '~> 4.20.2.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
|
393
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.2.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
|
1
|
+
4.20.2.0
|
@@ -1,12 +1,15 @@
|
|
1
1
|
- [Samples](#samples)
|
2
2
|
- [Hello Samples](#hello-samples)
|
3
3
|
- [Hello, World!](#hello-world)
|
4
|
+
- [Hello, Button!](#hello-button)
|
5
|
+
- [Hello, Text!](#hello-text)
|
6
|
+
- [Hello, Composite!](#hello-composite)
|
7
|
+
- [Hello, Layout!](#hello-layout)
|
8
|
+
- [Hello, Shell!](#hello-shell)
|
4
9
|
- [Hello, Tab!](#hello-tab)
|
5
10
|
- [Hello, C Tab!](#hello-c-tab)
|
6
11
|
- [Hello, Combo!](#hello-combo)
|
7
12
|
- [Hello, C Combo!](#hello-c-combo)
|
8
|
-
- [Hello, Composite!](#hello-composite)
|
9
|
-
- [Hello, Layout!](#hello-layout)
|
10
13
|
- [Hello, List Single Selection!](#hello-list-single-selection)
|
11
14
|
- [Hello, List Multi Selection!](#hello-list-multi-selection)
|
12
15
|
- [Hello, Computed!](#hello-computed)
|
@@ -30,7 +33,6 @@
|
|
30
33
|
- [Hello, Date Time!](#hello-date-time)
|
31
34
|
- [Hello, Spinner!](#hello-spinner)
|
32
35
|
- [Hello, Table!](#hello-table)
|
33
|
-
- [Hello, Button!](#hello-button)
|
34
36
|
- [Hello, Link!](#hello-link)
|
35
37
|
- [Hello, Dialog!](#hello-dialog)
|
36
38
|
- [Hello, Code Text!](#hello-code-text)
|
@@ -58,6 +60,7 @@
|
|
58
60
|
- [Mandelbrot Fractal](#mandelbrot-fractal)
|
59
61
|
- [Stock Ticker](#stock-ticker)
|
60
62
|
- [Metronome](#metronome)
|
63
|
+
- [Weather](#weather)
|
61
64
|
- [External Samples](#external-samples)
|
62
65
|
- [Glimmer Calculator](#glimmer-calculator)
|
63
66
|
- [Gladiator](#gladiator)
|
@@ -98,50 +101,33 @@ Code:
|
|
98
101
|
|
99
102
|
![Hello World](/images/glimmer-hello-world.png)
|
100
103
|
|
101
|
-
#### Hello,
|
102
|
-
|
103
|
-
Code:
|
104
|
-
|
105
|
-
[samples/hello/hello_tab.rb](/samples/hello/hello_tab.rb)
|
106
|
-
|
107
|
-
![Hello Tab English](/images/glimmer-hello-tab-english.png)
|
108
|
-
![Hello Tab French](/images/glimmer-hello-tab-french.png)
|
109
|
-
|
110
|
-
#### Hello, C Tab!
|
104
|
+
#### Hello, Button!
|
111
105
|
|
112
|
-
This sample demonstrates
|
106
|
+
This sample demonstrates the use of the `button` widget in Glimmer, including data-binding and click event triggering via `on_widget_selected`.
|
113
107
|
|
114
108
|
Code:
|
115
109
|
|
116
|
-
[samples/hello/
|
117
|
-
|
118
|
-
![Hello C Tab](/images/glimmer-hello-c-tab.png)
|
119
|
-
![Hello C Tab Extra Tabs](/images/glimmer-hello-c-tab-extra-tabs.png)
|
120
|
-
![Hello C Tab Other Tab](/images/glimmer-hello-c-tab-other-tab.png)
|
121
|
-
|
122
|
-
Country flag images were made by [Freepik](https://www.flaticon.com/authors/freepik) from [www.flaticon.com](http://www.flaticon.com)
|
123
|
-
|
124
|
-
#### Hello, Combo!
|
110
|
+
[samples/hello/hello_button.rb](/samples/hello/hello_button.rb)
|
125
111
|
|
126
|
-
|
112
|
+
Hello, Button!
|
127
113
|
|
128
|
-
|
114
|
+
![Hello Button](/images/glimmer-hello-button.png)
|
129
115
|
|
130
|
-
|
116
|
+
Hello, Button! Incremented 7 times!
|
131
117
|
|
132
|
-
![Hello
|
133
|
-
![Hello Combo Expanded](/images/glimmer-hello-combo-expanded.png)
|
118
|
+
![Hello Button Incremented](/images/glimmer-hello-button-incremented.png)
|
134
119
|
|
135
|
-
#### Hello,
|
120
|
+
#### Hello, Text!
|
136
121
|
|
137
|
-
This sample demonstrates the
|
122
|
+
This sample demonstrates the use of the `text` widget in Glimmer, including data-binding (e.g. via the `<=>` operator) and event handling.
|
138
123
|
|
139
124
|
Code:
|
140
125
|
|
141
|
-
[samples/hello/
|
126
|
+
[samples/hello/hello_text.rb](/samples/hello/hello_text.rb)
|
142
127
|
|
143
|
-
|
144
|
-
|
128
|
+
Hello, Text!
|
129
|
+
|
130
|
+
![Hello Text](/images/glimmer-hello-text.png)
|
145
131
|
|
146
132
|
#### Hello, Composite!
|
147
133
|
|
@@ -175,6 +161,95 @@ Code:
|
|
175
161
|
|
176
162
|
![Hello Layout Tab7](/images/glimmer-hello-layout-tab7.png)
|
177
163
|
|
164
|
+
#### Hello, Shell!
|
165
|
+
|
166
|
+
This sample demonstrates the various shells (windows) available in SWT.
|
167
|
+
|
168
|
+
Code:
|
169
|
+
|
170
|
+
[samples/hello/hello_shell.rb](/samples/hello/hello_shell.rb)
|
171
|
+
|
172
|
+
Hello, Shell!
|
173
|
+
|
174
|
+
![Hello, Shell!](/images/glimmer-hello-shell.png)
|
175
|
+
|
176
|
+
Nested Shell
|
177
|
+
|
178
|
+
![Nested Shell](/images/glimmer-hello-shell-nested-shell.png)
|
179
|
+
|
180
|
+
Independent Shell
|
181
|
+
|
182
|
+
![Independent Shell](/images/glimmer-hello-shell-independent-shell.png)
|
183
|
+
|
184
|
+
Close-Button Shell
|
185
|
+
|
186
|
+
![Close-Button Shell](/images/glimmer-hello-shell-close-button-shell.png)
|
187
|
+
|
188
|
+
Minimize-Button Shell
|
189
|
+
|
190
|
+
![Minimize-Button Shell](/images/glimmer-hello-shell-minimize-button-shell.png)
|
191
|
+
|
192
|
+
Maximize-Button Shell
|
193
|
+
|
194
|
+
![Maximize-Button Shell](/images/glimmer-hello-shell-maximize-button-shell.png)
|
195
|
+
|
196
|
+
Buttonless Shell
|
197
|
+
|
198
|
+
![Buttonless Shell](/images/glimmer-hello-shell-buttonless-shell.png)
|
199
|
+
|
200
|
+
No Trim Shell
|
201
|
+
|
202
|
+
![No Trim Shell](/images/glimmer-hello-shell-no-trim-shell.png)
|
203
|
+
|
204
|
+
Always On Top Shell
|
205
|
+
|
206
|
+
![Always On Top Shell](/images/glimmer-hello-shell-always-on-top-shell.png)
|
207
|
+
|
208
|
+
#### Hello, Tab!
|
209
|
+
|
210
|
+
Code:
|
211
|
+
|
212
|
+
[samples/hello/hello_tab.rb](/samples/hello/hello_tab.rb)
|
213
|
+
|
214
|
+
![Hello Tab English](/images/glimmer-hello-tab-english.png)
|
215
|
+
![Hello Tab French](/images/glimmer-hello-tab-french.png)
|
216
|
+
|
217
|
+
#### Hello, C Tab!
|
218
|
+
|
219
|
+
This sample demonstrates custom tab widget usage via the `c_tab_folder` and `c_tab_item` variations of `tab_folder` and `tab_item`, which can customize fonts/background/foreground colors for tabs and display additional tabs that do not fit in the window via a drop down.
|
220
|
+
|
221
|
+
Code:
|
222
|
+
|
223
|
+
[samples/hello/hello_c_tab.rb](/samples/hello/hello_c_tab.rb)
|
224
|
+
|
225
|
+
![Hello C Tab](/images/glimmer-hello-c-tab.png)
|
226
|
+
![Hello C Tab Extra Tabs](/images/glimmer-hello-c-tab-extra-tabs.png)
|
227
|
+
![Hello C Tab Other Tab](/images/glimmer-hello-c-tab-other-tab.png)
|
228
|
+
|
229
|
+
Country flag images were made by [Freepik](https://www.flaticon.com/authors/freepik) from [www.flaticon.com](http://www.flaticon.com)
|
230
|
+
|
231
|
+
#### Hello, Combo!
|
232
|
+
|
233
|
+
This sample demonstrates combo data-binding.
|
234
|
+
|
235
|
+
Code:
|
236
|
+
|
237
|
+
[samples/hello/hello_combo.rb](/samples/hello/hello_combo.rb)
|
238
|
+
|
239
|
+
![Hello Combo](/images/glimmer-hello-combo.png)
|
240
|
+
![Hello Combo Expanded](/images/glimmer-hello-combo-expanded.png)
|
241
|
+
|
242
|
+
#### Hello, C Combo!
|
243
|
+
|
244
|
+
This sample demonstrates the custom combo variation on combo, which allows the adjustment of the combo height based on font height or layout data.
|
245
|
+
|
246
|
+
Code:
|
247
|
+
|
248
|
+
[samples/hello/hello_c_combo.rb](/samples/hello/hello_c_combo.rb)
|
249
|
+
|
250
|
+
![Hello Combo](/images/glimmer-hello-c-combo.png)
|
251
|
+
![Hello Combo Expanded](/images/glimmer-hello-c-combo-expanded.png)
|
252
|
+
|
178
253
|
#### Hello, List Single Selection!
|
179
254
|
|
180
255
|
This sample demonstrates list single-selection data-binding.
|
@@ -554,22 +629,6 @@ Hello, Table! Context Menu
|
|
554
629
|
|
555
630
|
![Hello Table](/images/glimmer-hello-table-context-menu.png)
|
556
631
|
|
557
|
-
#### Hello, Button!
|
558
|
-
|
559
|
-
This sample demonstrates the use of the `button` widget in Glimmer, including data-binding and click event triggering via `on_widget_selected`.
|
560
|
-
|
561
|
-
Code:
|
562
|
-
|
563
|
-
[samples/hello/hello_button.rb](/samples/hello/hello_button.rb)
|
564
|
-
|
565
|
-
Hello, Button!
|
566
|
-
|
567
|
-
![Hello Button](/images/glimmer-hello-button.png)
|
568
|
-
|
569
|
-
Hello, Button! Incremented 7 times!
|
570
|
-
|
571
|
-
![Hello Button Incremented](/images/glimmer-hello-button-incremented.png)
|
572
|
-
|
573
632
|
#### Hello, Link!
|
574
633
|
|
575
634
|
This sample demonstrates the use of the `link` widget in Glimmer, including identifying which link was clicked and performing an action (displaying help) based on its location.
|
@@ -1008,6 +1067,26 @@ Code:
|
|
1008
1067
|
|
1009
1068
|
[Download video with sound](/videos/glimmer-metronome.mp4?raw=true).
|
1010
1069
|
|
1070
|
+
#### Weather
|
1071
|
+
|
1072
|
+
This sample demonstrates a Weather app that leverages the Ruby built-in `'net/http'` library, courtesy of openweathermap.org. It provides a good example of tackling JSON hierarchical hash/array data and converting into data-bindable model object attributes for Glimmer GUI synchronization.
|
1073
|
+
|
1074
|
+
Code:
|
1075
|
+
|
1076
|
+
[samples/elaborate/weather.rb](/samples/elaborate/weather.rb)
|
1077
|
+
|
1078
|
+
Montreal - Celsius
|
1079
|
+
|
1080
|
+
![Montreal C](/images/glimmer-weather-montreal-celsius.png)
|
1081
|
+
|
1082
|
+
Montreal - Fahrenheit
|
1083
|
+
|
1084
|
+
![Montreal F](/images/glimmer-weather-montreal-fahrenheit.png)
|
1085
|
+
|
1086
|
+
Atlanta - Fahrenheit
|
1087
|
+
|
1088
|
+
![Atlanta F](/images/glimmer-weather-atlanta-fahrenheit.png)
|
1089
|
+
|
1011
1090
|
### External Samples
|
1012
1091
|
|
1013
1092
|
#### Glimmer Calculator
|
@@ -7,8 +7,9 @@
|
|
7
7
|
- Widget properties are declared with underscored lowercase versions of the SWT properties
|
8
8
|
- Widget property declarations always have arguments and never take a block
|
9
9
|
- Widget property arguments are never wrapped inside parentheses
|
10
|
-
- Widget listeners are always declared starting with `on_` prefix and affixing listener event method name afterwards in underscored lowercase form
|
10
|
+
- Widget listeners are always declared starting with `on_` prefix and affixing listener event method name afterwards in underscored lowercase form. Their multi-line blocks rely on the `do; end` style.
|
11
11
|
- Widget listeners are always followed by a block using curly braces (Only when declared in DSL. When invoked on widget object directly outside of GUI declarations, standard Ruby conventions apply)
|
12
12
|
- Data-binding is done via `bind` keyword, which always takes arguments wrapped in parentheses
|
13
|
-
- Custom widget body
|
14
|
-
- Custom widgets receive additional arguments
|
13
|
+
- Custom widget `body`, `before_body`, and `after_body` blocks open their blocks and close them with curly braces.
|
14
|
+
- Custom widgets receive additional keyword arguments called options, which come after the SWT styles.
|
15
|
+
- Pure logic multi-line blocks that do not constitute GUI DSL view elements (such as `Thread.new`, `loop`, `each` and `observe` blocks) rely on the `do; end` style to clearly separate logic code from view code.
|
data/glimmer-dsl-swt.gemspec
CHANGED
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(*
|
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
|
@@ -34,10 +34,10 @@ 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, tree_properties)
|
37
|
+
def initialize(parent, model_binding, tree_properties = nil)
|
38
38
|
@tree = parent
|
39
39
|
@model_binding = model_binding
|
40
|
-
@tree_properties = [tree_properties].flatten.first.to_h
|
40
|
+
@tree_properties = @model_binding.binding_options[:tree_properties] || @model_binding.binding_options[:tree_attributes] || [tree_properties].compact.flatten.first.to_h
|
41
41
|
if @tree.respond_to?(:tree_properties=)
|
42
42
|
@tree.tree_properties = @tree_properties
|
43
43
|
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
|
-
|
36
|
-
|
37
|
-
|
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) or parent.swt_widget.is_a?(Tree)))
|
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
|
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)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -30,15 +30,20 @@ module Glimmer
|
|
30
30
|
include_package 'org.eclipse.swt.widgets'
|
31
31
|
|
32
32
|
def can_interpret?(parent, keyword, *args, &block)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
33
|
+
keyword == 'items' and
|
34
|
+
block.nil? and
|
35
|
+
parent.respond_to?(:swt_widget) and
|
36
|
+
parent.swt_widget.is_a?(Tree) and
|
37
|
+
args.size.between?(1, 2)
|
38
|
+
# TODO delete these checks if they are too granular
|
39
|
+
# return false unless initial_condition
|
40
|
+
# raise Glimmer::Error, 'Tree items args must be 1 or 2' unless args.size.between?(1, 2)
|
41
|
+
# raise Glimmer::Error, 'Tree items first arg must be a bind expression' unless args[0].is_a?(DataBinding::ModelBinding)
|
42
|
+
# raise Glimmer::Error, 'Tree items data-binding initial value must not be an array yet a single item representing tree root' unless !args[0].evaluate_property.is_a?(Array)
|
43
|
+
# raise Glimmer::Error, 'Tree items second arg must be an array' unless args[1].is_a?(Array)
|
44
|
+
# raise Glimmer::Error, 'Tree items second arg must not be empty' unless !args[1].empty?
|
45
|
+
# raise Glimmer::Error, 'Tree items second arg array elements must be of type hash' unless args[1].first.is_a?(Hash)
|
46
|
+
# true
|
42
47
|
end
|
43
48
|
|
44
49
|
def interpret(parent, keyword, *args, &block)
|