glimmer-dsl-swt 4.24.1.1 → 4.24.1.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 +5 -0
- data/README.md +7 -7
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/swt/tab_item_proxy.rb +17 -0
- data/samples/elaborate/parking.rb +42 -30
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4958a72683334de9b8f0ca8a213eabce1dbf93031ea249dd760abea934d704d6
|
4
|
+
data.tar.gz: ec7566aee8c9a16a757fc639cb64a3a3b96ba83b7abb92d92a83bc64221631a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fcf51949b0e6231e92b1d0603c530f69272ccd5a3a18631d3a386a140bffb5e41bca9eda858ff6f5481aeb60351e8fcef04f0ce30ec835cdd50898e149cadf8
|
7
|
+
data.tar.gz: 75a92e8793f5c7782dd9d18359a1693d80dc35de3ad7eea51268a316f382ed1c88bf5e451865975ffe881134ff041fc343697e1c4f933fb77e3fd6fac22ba70e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 4.24.1.2
|
4
|
+
|
5
|
+
- Fix issue where you cannot call `tab_item_proxy.text` or `tab_item_proxy.text = 'new text'` because its `swt_widget` is the contained `composite`
|
6
|
+
- Refactor Parking sample to clarify rotation details
|
7
|
+
|
3
8
|
## 4.24.1.1
|
4
9
|
|
5
10
|
- Fix `jar-dependencies` gem version to v0.4.1 in scaffolded applications to avoid issue encountered in newly released v0.4.2
|
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.1.
|
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.1.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)
|
@@ -19,7 +19,7 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
|
|
19
19
|
|
20
20
|
![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
|
21
21
|
|
22
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.1.
|
22
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.1.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.
|
23
23
|
|
24
24
|
**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).
|
25
25
|
|
@@ -304,9 +304,9 @@ https://www.eclipse.org/swt/faq.php
|
|
304
304
|
|
305
305
|
## Pre-requisites
|
306
306
|
|
307
|
-
- JDK 18 is
|
307
|
+
- JDK 18 is required on Mac/Linux / JDK 16 is required on Windows (find at https://www.oracle.com/java/technologies/downloads / Ensure `PATH` env var includes Java bin directory for `jpackage` command to work when packaging Glimmer applications / Preferably setup `JAVA_HOME` env var too to point to JDK home directory before installing JRuby)
|
308
308
|
- [RVM](http://rvm.io) on Mac & Linux (not needed on Windows)
|
309
|
-
- JRuby 9.3.6.0 (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.6.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download))
|
309
|
+
- JRuby 9.3.6.0 is required on Mac/Linux / JRuby 9.3.4.0 is required on Windows (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.6.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download))
|
310
310
|
- SWT 4.24 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem). Note that SWT supports ARM64/AARCH64 on Mac and Linux since version 4.20
|
311
311
|
- Git (comes with Mac and Linux. Install on Windows: https://git-scm.com/download/win )
|
312
312
|
|
@@ -336,7 +336,7 @@ jgem install glimmer-dsl-swt
|
|
336
336
|
|
337
337
|
Or this command if you want a specific version:
|
338
338
|
```
|
339
|
-
jgem install glimmer-dsl-swt -v 4.24.1.
|
339
|
+
jgem install glimmer-dsl-swt -v 4.24.1.2
|
340
340
|
```
|
341
341
|
|
342
342
|
`jgem` is JRuby's version of `gem` command.
|
@@ -364,7 +364,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
364
364
|
|
365
365
|
Add the following to `Gemfile`:
|
366
366
|
```
|
367
|
-
gem 'glimmer-dsl-swt', '~> 4.24.1.
|
367
|
+
gem 'glimmer-dsl-swt', '~> 4.24.1.2'
|
368
368
|
```
|
369
369
|
|
370
370
|
And, then run:
|
@@ -387,7 +387,7 @@ glimmer
|
|
387
387
|
```
|
388
388
|
|
389
389
|
```
|
390
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.1.
|
390
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.1.2
|
391
391
|
|
392
392
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
393
393
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.24.1.
|
1
|
+
4.24.1.2
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -78,6 +78,23 @@ module Glimmer
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
ATTRIBUTES.each do |attribute|
|
82
|
+
define_method(attribute) do
|
83
|
+
auto_exec do
|
84
|
+
widget_proxy.send(attribute)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
define_method("#{attribute}=") do |value|
|
89
|
+
value.tap do
|
90
|
+
auto_exec do
|
91
|
+
widget_proxy.send("#{attribute}=", value)
|
92
|
+
shell_proxy.pack_same_size
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
81
98
|
def dispose
|
82
99
|
auto_exec do
|
83
100
|
swt_tab_item.setControl(nil)
|
@@ -26,10 +26,10 @@ require_relative 'parking/model/parking_presenter'
|
|
26
26
|
class Parking
|
27
27
|
include Glimmer::UI::CustomShell
|
28
28
|
|
29
|
+
CANVAS_LENGTH = 600
|
29
30
|
FLOOR_COUNT = 4
|
30
31
|
|
31
32
|
before_body do
|
32
|
-
@parking_spots = Model::ParkingSpot::LETTERS.clone
|
33
33
|
@parking_presenter = Model::ParkingPresenter.new(FLOOR_COUNT)
|
34
34
|
end
|
35
35
|
|
@@ -56,7 +56,6 @@ class Parking
|
|
56
56
|
selection <=> [@parking_presenter, :selected_floor]
|
57
57
|
|
58
58
|
on_widget_selected do
|
59
|
-
@parking_spots = Model::ParkingSpot::LETTERS.clone
|
60
59
|
@canvas.dispose_shapes
|
61
60
|
@canvas.content {
|
62
61
|
parking_floor
|
@@ -65,8 +64,8 @@ class Parking
|
|
65
64
|
}
|
66
65
|
@canvas = canvas {
|
67
66
|
layout_data {
|
68
|
-
width
|
69
|
-
height
|
67
|
+
width CANVAS_LENGTH
|
68
|
+
height CANVAS_LENGTH
|
70
69
|
}
|
71
70
|
|
72
71
|
background :dark_gray
|
@@ -77,42 +76,33 @@ class Parking
|
|
77
76
|
}
|
78
77
|
|
79
78
|
def parking_floor
|
80
|
-
parking_quad(67.5, 0, 125)
|
81
|
-
parking_quad(67.5, 0, 125)
|
82
|
-
|
83
|
-
|
84
|
-
parking_quad(67.5, 0, 125) { |shp|
|
85
|
-
shp.rotate(180)
|
86
|
-
}
|
87
|
-
parking_quad(67.5, 0, 125) { |shp|
|
88
|
-
shp.rotate(270)
|
89
|
-
}
|
79
|
+
parking_quad(67.5, 0, 125, 0)
|
80
|
+
parking_quad(67.5, 0, 125, 90)
|
81
|
+
parking_quad(67.5, 0, 125, 180)
|
82
|
+
parking_quad(67.5, 0, 125, 270)
|
90
83
|
end
|
91
84
|
|
92
|
-
def parking_quad(location_x, location_y, length,
|
85
|
+
def parking_quad(location_x, location_y, length, angle)
|
93
86
|
distance = (1.0/3)*length
|
94
|
-
parking_spot(location_x, location_y, length,
|
95
|
-
parking_spot(location_x + distance, location_y, length,
|
96
|
-
parking_spot(location_x + 2*distance, location_y, length,
|
97
|
-
parking_spot(location_x + 3*distance, location_y, length,
|
87
|
+
parking_spot(location_x, location_y, length, angle)
|
88
|
+
parking_spot(location_x + distance, location_y, length, angle)
|
89
|
+
parking_spot(location_x + 2*distance, location_y, length, angle)
|
90
|
+
parking_spot(location_x + 3*distance, location_y, length, angle)
|
98
91
|
end
|
99
92
|
|
100
|
-
def parking_spot(location_x, location_y, length,
|
101
|
-
parking_spot_letter =
|
93
|
+
def parking_spot(location_x, location_y, length, angle)
|
94
|
+
parking_spot_letter = next_parking_spot_letter
|
102
95
|
height = length
|
103
96
|
width = (2.0/3)*length
|
104
|
-
|
97
|
+
|
98
|
+
shape(location_x, location_y) {
|
105
99
|
line_width (1.0/15)*length
|
106
100
|
foreground :white
|
107
101
|
|
108
|
-
block&.call(the_shape)
|
109
|
-
|
110
102
|
rectangle(location_x, location_y, width, height) {
|
111
|
-
background <= [
|
112
|
-
|
113
|
-
|
114
|
-
on_read: ->(b) {b ? :red : :dark_gray}
|
115
|
-
]
|
103
|
+
background <= [parking_spot_for(parking_spot_letter), :booked,
|
104
|
+
on_read: ->(value) {value ? :red : :dark_gray}
|
105
|
+
]
|
116
106
|
|
117
107
|
text {
|
118
108
|
x :default
|
@@ -123,7 +113,8 @@ class Parking
|
|
123
113
|
|
124
114
|
on_mouse_up do
|
125
115
|
begin
|
126
|
-
|
116
|
+
selected_parking_floor.book!(parking_spot_letter)
|
117
|
+
|
127
118
|
message_box {
|
128
119
|
text 'Parking Booked!'
|
129
120
|
message "Floor #{@parking_presenter.selected_floor} Parking Spot #{parking_spot_letter} Is Booked!"
|
@@ -138,8 +129,29 @@ class Parking
|
|
138
129
|
line(location_x, location_y, location_x + width, location_y)
|
139
130
|
line(location_x + width, location_y, location_x + width, location_y + height)
|
140
131
|
|
132
|
+
# Rotate around the canvas center point
|
133
|
+
transform {
|
134
|
+
translation CANVAS_LENGTH/2.0, CANVAS_LENGTH/2.0
|
135
|
+
rotation angle
|
136
|
+
translation -CANVAS_LENGTH/2.0, -CANVAS_LENGTH/2.0
|
137
|
+
}
|
141
138
|
}
|
142
139
|
end
|
140
|
+
|
141
|
+
def parking_spot_for(parking_spot_letter)
|
142
|
+
selected_parking_floor.parking_spots[parking_spot_letter]
|
143
|
+
end
|
144
|
+
|
145
|
+
def selected_parking_floor
|
146
|
+
@parking_presenter.floors[@parking_presenter.selected_floor - 1]
|
147
|
+
end
|
148
|
+
|
149
|
+
private
|
150
|
+
|
151
|
+
def next_parking_spot_letter
|
152
|
+
@parking_spot_letters = Model::ParkingSpot::LETTERS.clone if @parking_spot_letters.nil? || @parking_spot_letters.empty?
|
153
|
+
@parking_spot_letters.shift
|
154
|
+
end
|
143
155
|
end
|
144
156
|
|
145
157
|
Parking.launch
|