glimmer-dsl-swt 4.20.4.0 → 4.20.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 +9 -0
- data/README.md +5 -5
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/data_binding/table_items_binding.rb +1 -0
- data/samples/elaborate/weather.rb +8 -4
- data/samples/hello/hello_computed.rb +20 -2
- data/samples/hello/hello_custom_shell.rb +16 -10
- metadata +2 -3
- data/samples/hello/hello_computed/contact.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 477ae45e0e1bc13247941f92ae0b7548c2b6a73646f5f88ff7153491a2ec6c6a
|
4
|
+
data.tar.gz: 69cb3de2f04851c2282f952df47db2b9eda03279e44502b04e8f93eb9373178d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aa235c3ca3ec8155e60af29ffca40232d38e8d5e87317e14244afe49da93ca2cd0fe103b688a78f7d22587a16e89ebaafa1f1a60abd92fe16b82a1f1e3e42f1
|
7
|
+
data.tar.gz: 2f2d84b284317afd09bfed98ce5ebcf95d4707fd87d5e53b8d36b4da485a5685ef95339ba48d16c0f5800e753635c28823a8f56735cee237a982e51a3ff5aea7
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.20.4.1
|
4
|
+
|
5
|
+
- Ensure a `table` with `:editable` style loses it if `items <= ...` one-way data-binding (having read_only: true option) was setup.
|
6
|
+
- Tweak/refactor/improve samples
|
7
|
+
|
8
|
+
### 4.20.4.0
|
9
|
+
|
10
|
+
- Extracted Shine data-binding syntax and `BindExpression` to Glimmer 2
|
11
|
+
|
3
12
|
### 4.20.3.0
|
4
13
|
|
5
14
|
- Shine data-binding support for `custom widgets`, `custom shells`, and `custom shapes`
|
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.
|
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.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)
|
@@ -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.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.4.1 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 a beta, so default back to `bind` whenever needed).
|
21
21
|
|
@@ -347,7 +347,7 @@ jgem install glimmer-dsl-swt
|
|
347
347
|
|
348
348
|
Or this command if you want a specific version:
|
349
349
|
```
|
350
|
-
jgem install glimmer-dsl-swt -v 4.20.
|
350
|
+
jgem install glimmer-dsl-swt -v 4.20.4.1
|
351
351
|
```
|
352
352
|
|
353
353
|
`jgem` is JRuby's version of `gem` command.
|
@@ -375,7 +375,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
375
375
|
|
376
376
|
Add the following to `Gemfile`:
|
377
377
|
```
|
378
|
-
gem 'glimmer-dsl-swt', '~> 4.20.
|
378
|
+
gem 'glimmer-dsl-swt', '~> 4.20.4.1'
|
379
379
|
```
|
380
380
|
|
381
381
|
And, then run:
|
@@ -396,7 +396,7 @@ glimmer
|
|
396
396
|
```
|
397
397
|
|
398
398
|
```
|
399
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.
|
399
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.4.1
|
400
400
|
|
401
401
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
402
402
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.20.4.
|
1
|
+
4.20.4.1
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -39,6 +39,7 @@ module Glimmer
|
|
39
39
|
@model_binding = model_binding
|
40
40
|
@read_only_sort = @model_binding.binding_options[:read_only_sort]
|
41
41
|
@column_properties = @model_binding.binding_options[:column_properties] || @model_binding.binding_options[:column_attributes] || column_properties
|
42
|
+
@table.editable = false if @model_binding.binding_options[:read_only]
|
42
43
|
if @table.respond_to?(:column_properties=)
|
43
44
|
@table.column_properties = @column_properties
|
44
45
|
else # assume custom widget
|
@@ -29,6 +29,7 @@ class Weather
|
|
29
29
|
|
30
30
|
DEFAULT_FONT_HEIGHT = 30
|
31
31
|
DEFAULT_FOREGROUND = :white
|
32
|
+
DEFAULT_BACKGROUND = rgb(135, 176, 235)
|
32
33
|
|
33
34
|
attr_accessor :city, :temp, :temp_min, :temp_max, :feels_like, :humidity
|
34
35
|
|
@@ -54,7 +55,7 @@ class Weather
|
|
54
55
|
|
55
56
|
text 'Glimmer Weather'
|
56
57
|
minimum_size 400, 300
|
57
|
-
background
|
58
|
+
background DEFAULT_BACKGROUND
|
58
59
|
|
59
60
|
text {
|
60
61
|
layout_data(:center, :center, true, true)
|
@@ -78,7 +79,7 @@ class Weather
|
|
78
79
|
grid_layout 2, false
|
79
80
|
|
80
81
|
text temp_unit
|
81
|
-
background
|
82
|
+
background DEFAULT_BACKGROUND
|
82
83
|
|
83
84
|
rectangle(0, 0, [:default, -2], [:default, -2], 15, 15) {
|
84
85
|
foreground DEFAULT_FOREGROUND
|
@@ -128,8 +129,8 @@ class Weather
|
|
128
129
|
@weather_mutex.synchronize do
|
129
130
|
self.weather_data = JSON.parse(Net::HTTP.get('api.openweathermap.org', "/data/2.5/weather?q=#{city}&appid=1d16d70a9aec3570b5cbd27e6b421330"))
|
130
131
|
end
|
131
|
-
rescue
|
132
|
-
|
132
|
+
rescue => e
|
133
|
+
Glimmer::Config.logger.error "Unable to fetch weather due to error: #{e.full_message}"
|
133
134
|
end
|
134
135
|
|
135
136
|
def weather_data=(data)
|
@@ -148,14 +149,17 @@ class Weather
|
|
148
149
|
end
|
149
150
|
|
150
151
|
def kelvin_to_celsius(kelvin)
|
152
|
+
return nil if kelvin.nil?
|
151
153
|
kelvin - 273.15
|
152
154
|
end
|
153
155
|
|
154
156
|
def celsius_to_fahrenheit(celsius)
|
157
|
+
return nil if celsius.nil?
|
155
158
|
(celsius * 9 / 5 ) + 32
|
156
159
|
end
|
157
160
|
|
158
161
|
def kelvin_to_fahrenheit(kelvin)
|
162
|
+
return nil if kelvin.nil?
|
159
163
|
celsius_to_fahrenheit(kelvin_to_celsius(kelvin))
|
160
164
|
end
|
161
165
|
|
@@ -21,9 +21,27 @@
|
|
21
21
|
|
22
22
|
require 'glimmer-dsl-swt'
|
23
23
|
|
24
|
-
require_relative 'hello_computed/contact'
|
25
|
-
|
26
24
|
class HelloComputed
|
25
|
+
class Contact
|
26
|
+
attr_accessor :first_name, :last_name, :year_of_birth
|
27
|
+
|
28
|
+
def initialize(attribute_map)
|
29
|
+
@first_name = attribute_map[:first_name]
|
30
|
+
@last_name = attribute_map[:last_name]
|
31
|
+
@year_of_birth = attribute_map[:year_of_birth]
|
32
|
+
end
|
33
|
+
|
34
|
+
def name
|
35
|
+
"#{last_name}, #{first_name}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def age
|
39
|
+
Time.now.year - year_of_birth.to_i
|
40
|
+
rescue
|
41
|
+
0
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
27
45
|
include Glimmer::UI::CustomShell
|
28
46
|
|
29
47
|
before_body {
|
@@ -88,12 +88,10 @@ class EmailShell
|
|
88
88
|
end
|
89
89
|
|
90
90
|
class HelloCustomShell
|
91
|
-
include Glimmer::UI::CustomShell
|
92
|
-
|
93
91
|
Email = Struct.new(:date, :subject, :from, :message, keyword_init: true)
|
94
92
|
EmailSystem = Struct.new(:emails, keyword_init: true)
|
95
93
|
|
96
|
-
|
94
|
+
def initialize
|
97
95
|
@email_system = EmailSystem.new(
|
98
96
|
emails: [
|
99
97
|
Email.new(date: DateTime.new(2029, 10, 22, 11, 3, 0).strftime('%F %I:%M %p'), subject: '3rd Week Report', from: '"Dianne Tux" <dianne.tux@example.com>', message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"),
|
@@ -104,10 +102,10 @@ class HelloCustomShell
|
|
104
102
|
Email.new(date: DateTime.new(2029, 10, 2, 10, 34, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v98.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 98.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
|
105
103
|
]
|
106
104
|
)
|
107
|
-
|
105
|
+
end
|
108
106
|
|
109
|
-
|
110
|
-
shell {
|
107
|
+
def launch
|
108
|
+
shell { |shell_proxy|
|
111
109
|
grid_layout
|
112
110
|
|
113
111
|
text 'Hello, Custom Shell!'
|
@@ -142,11 +140,19 @@ class HelloCustomShell
|
|
142
140
|
|
143
141
|
on_mouse_up { |event|
|
144
142
|
email = event.table_item.get_data
|
145
|
-
|
143
|
+
|
144
|
+
# open a custom email shell
|
145
|
+
email_shell(
|
146
|
+
parent_shell: shell_proxy,
|
147
|
+
date: email.date,
|
148
|
+
subject: email.subject,
|
149
|
+
from: email.from,
|
150
|
+
message: email.message
|
151
|
+
).open
|
146
152
|
}
|
147
153
|
}
|
148
|
-
}
|
149
|
-
|
154
|
+
}.open
|
155
|
+
end
|
150
156
|
end
|
151
157
|
|
152
|
-
HelloCustomShell.launch
|
158
|
+
HelloCustomShell.new.launch
|
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.20.4.
|
4
|
+
version: 4.20.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: 2021-07-
|
11
|
+
date: 2021-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -591,7 +591,6 @@ files:
|
|
591
591
|
- samples/hello/hello_combo.rb
|
592
592
|
- samples/hello/hello_composite.rb
|
593
593
|
- samples/hello/hello_computed.rb
|
594
|
-
- samples/hello/hello_computed/contact.rb
|
595
594
|
- samples/hello/hello_cool_bar.rb
|
596
595
|
- samples/hello/hello_cursor.rb
|
597
596
|
- samples/hello/hello_custom_shape.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
# a copy of this software and associated documentation files (the
|
5
|
-
# "Software"), to deal in the Software without restriction, including
|
6
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
# the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be
|
12
|
-
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
22
|
-
class HelloComputed
|
23
|
-
class Contact
|
24
|
-
attr_accessor :first_name, :last_name, :year_of_birth
|
25
|
-
|
26
|
-
def initialize(attribute_map)
|
27
|
-
@first_name = attribute_map[:first_name]
|
28
|
-
@last_name = attribute_map[:last_name]
|
29
|
-
@year_of_birth = attribute_map[:year_of_birth]
|
30
|
-
end
|
31
|
-
|
32
|
-
def name
|
33
|
-
"#{last_name}, #{first_name}"
|
34
|
-
end
|
35
|
-
|
36
|
-
def age
|
37
|
-
Time.now.year - year_of_birth.to_i
|
38
|
-
rescue
|
39
|
-
0
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|