glimmer-dsl-swt 4.21.2.2 → 4.22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +19 -13
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +179 -92
- data/docs/reference/GLIMMER_SAMPLES.md +13 -0
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/data_binding/widget_binding.rb +2 -2
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/sync_call_expression.rb +38 -0
- data/lib/glimmer/rake_task/package.rb +5 -3
- data/lib/glimmer/swt/custom/drawable.rb +4 -2
- data/lib/glimmer/swt/shell_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +9 -3
- data/lib/glimmer/ui/custom_widget.rb +4 -2
- data/samples/elaborate/battleship/view/cell.rb +10 -2
- data/samples/hello/hello_drag_and_drop.rb +1 -1
- data/samples/hello/hello_scrolled_composite.rb +95 -0
- data/samples/hello/hello_world.rb +1 -0
- data/vendor/swt/linux/swt.jar +0 -0
- data/vendor/swt/linux_aarch64/swt.jar +0 -0
- data/vendor/swt/mac/swt.jar +0 -0
- data/vendor/swt/mac_aarch64/swt.jar +0 -0
- data/vendor/swt/windows/swt.jar +0 -0
- metadata +7 -5
@@ -5,6 +5,7 @@
|
|
5
5
|
- [Hello, Label!](#hello-label)
|
6
6
|
- [Hello, Text!](#hello-text)
|
7
7
|
- [Hello, Composite!](#hello-composite)
|
8
|
+
- [Hello, Scrolled Composite!](#hello-scrolled-composite)
|
8
9
|
- [Hello, Layout!](#hello-layout)
|
9
10
|
- [Hello, Shell!](#hello-shell)
|
10
11
|
- [Hello, Tab!](#hello-tab)
|
@@ -178,6 +179,18 @@ Code:
|
|
178
179
|
|
179
180
|

|
180
181
|
|
182
|
+
#### Hello, Scrolled Composite!
|
183
|
+
|
184
|
+
This sample demonstrates the `scrolled_composite` widget, which is used to add scrollbars around content that exceeds the size of the window.
|
185
|
+
|
186
|
+
Code:
|
187
|
+
|
188
|
+
[samples/hello/hello_scrolled_composite.rb](/samples/hello/hello_scrolled_composite.rb)
|
189
|
+
|
190
|
+

|
191
|
+
|
192
|
+

|
193
|
+
|
181
194
|
#### Hello, Layout!
|
182
195
|
|
183
196
|
This sample demonstrates the standard 3 layouts in SWT (though one can write their own for very advanced applications): `fill_layout`, `row_layout`, and `grid_layout`
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -49,7 +49,7 @@ module Glimmer
|
|
49
49
|
def call(value)
|
50
50
|
SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @sync_exec, override_async_exec: @async_exec) do
|
51
51
|
if @widget.respond_to?(:disposed?) && @widget.disposed?
|
52
|
-
deregister_all_observables
|
52
|
+
deregister_all_observables unless @widget.shell_proxy.last_shell_closing?
|
53
53
|
return
|
54
54
|
end
|
55
55
|
# need the rescue false for a scenario with tree items not being equal to model objects raising an exception
|
@@ -61,7 +61,7 @@ module Glimmer
|
|
61
61
|
|
62
62
|
def evaluate_property
|
63
63
|
if @widget.respond_to?(:disposed?) && @widget.disposed?
|
64
|
-
deregister_all_observables
|
64
|
+
deregister_all_observables unless @widget.shell_proxy.last_shell_closing?
|
65
65
|
return
|
66
66
|
end
|
67
67
|
@widget.get_attribute(@property)
|
@@ -33,7 +33,7 @@ module Glimmer
|
|
33
33
|
# of a ModelBinding, which is then connected to an anonymous widget observer
|
34
34
|
# (aka widget_data_binder as per widget_data_binders array)
|
35
35
|
#
|
36
|
-
# Depends on
|
36
|
+
# Depends on BindExpression
|
37
37
|
class DataBindingExpression < Expression
|
38
38
|
def can_interpret?(parent, keyword, *args, &block)
|
39
39
|
args.size == 1 and
|
@@ -0,0 +1,38 @@
|
|
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
|
+
require 'glimmer/dsl/static_expression'
|
23
|
+
require 'glimmer/dsl/swt/exec_expression'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module SWT
|
28
|
+
# Synchronously executes code block against the SWT Event Loop
|
29
|
+
# to manipulate SWT UI objects on the UI thread safely with
|
30
|
+
# immediate priority when needed.
|
31
|
+
#
|
32
|
+
# Returns the value produced by evaluating the expression.
|
33
|
+
class SyncCallExpression < StaticExpression
|
34
|
+
include ExecExpression
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -25,6 +25,8 @@ require 'os'
|
|
25
25
|
module Glimmer
|
26
26
|
module RakeTask
|
27
27
|
module Package
|
28
|
+
JDK_VERSION = '17.0.1'
|
29
|
+
|
28
30
|
class << self
|
29
31
|
attr_accessor :jpackage_extra_args
|
30
32
|
|
@@ -90,10 +92,10 @@ module Glimmer
|
|
90
92
|
def native(native_type=nil, native_extra_args)
|
91
93
|
puts "Generating native executable with jpackage..."
|
92
94
|
java_version = `jruby -v`
|
93
|
-
if java_version.include?(
|
94
|
-
puts "Java Version
|
95
|
+
if java_version.include?(JDK_VERSION)
|
96
|
+
puts "Java Version #{JDK_VERSION} Detected!"
|
95
97
|
else
|
96
|
-
puts "WARNING! Glimmer Packaging Pre-Requisite Java Version
|
98
|
+
puts "WARNING! Glimmer Packaging Pre-Requisite Java Version #{JDK_VERSION} Is Not Found!"
|
97
99
|
end
|
98
100
|
require 'facets/string/titlecase'
|
99
101
|
require 'facets/string/underscore'
|
@@ -109,8 +109,10 @@ module Glimmer
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def deregister_shape_painting
|
112
|
-
|
113
|
-
|
112
|
+
unless shell_proxy.last_shell_closing?
|
113
|
+
@paint_listener_proxy&.deregister
|
114
|
+
@resize_listener_proxy&.deregister
|
115
|
+
end
|
114
116
|
end
|
115
117
|
|
116
118
|
def setup_shape_painting
|
@@ -175,8 +175,10 @@ module Glimmer
|
|
175
175
|
@keyword = underscored_widget_name.to_s
|
176
176
|
if respond_to?(:on_widget_disposed)
|
177
177
|
on_widget_disposed {
|
178
|
-
|
179
|
-
|
178
|
+
unless shell_proxy.last_shell_closing?
|
179
|
+
clear_shapes
|
180
|
+
deregister_shape_painting
|
181
|
+
end
|
180
182
|
}
|
181
183
|
end
|
182
184
|
end
|
@@ -199,7 +201,11 @@ module Glimmer
|
|
199
201
|
end
|
200
202
|
|
201
203
|
def shell_proxy
|
202
|
-
@swt_widget.shell
|
204
|
+
if @swt_widget.respond_to?(:shell)
|
205
|
+
@swt_widget.shell.get_data('proxy')
|
206
|
+
else
|
207
|
+
@parent_proxy&.shell_proxy
|
208
|
+
end
|
203
209
|
end
|
204
210
|
|
205
211
|
def extract_args(underscored_widget_name, args)
|
@@ -188,8 +188,10 @@ module Glimmer
|
|
188
188
|
auto_exec { execute_hook('after_body') }
|
189
189
|
auto_exec do
|
190
190
|
@dispose_listener_registration = @body_root.on_widget_disposed do
|
191
|
-
|
192
|
-
|
191
|
+
unless @body_root.shell_proxy.last_shell_closing?
|
192
|
+
observer_registrations.compact.each(&:deregister)
|
193
|
+
observer_registrations.clear
|
194
|
+
end
|
193
195
|
end
|
194
196
|
end
|
195
197
|
post_add_content if content.nil?
|
@@ -54,10 +54,18 @@ class Battleship
|
|
54
54
|
|
55
55
|
rectangle(0, 0, [:max, -1], [:max, -1])
|
56
56
|
oval(:default, :default, 10, 10) {
|
57
|
-
|
57
|
+
if model.nil?
|
58
|
+
foreground COLOR_EMPTY
|
59
|
+
else
|
60
|
+
foreground <= [model, :hit, on_read: ->(h) {h == nil ? COLOR_EMPTY : (h ? COLOR_HIT : COLOR_NO_HIT)}]
|
61
|
+
end
|
58
62
|
}
|
59
63
|
oval(:default, :default, 5, 5) {
|
60
|
-
|
64
|
+
if model.nil?
|
65
|
+
background COLOR_EMPTY
|
66
|
+
else
|
67
|
+
background <= [model, :hit, on_read: ->(h) {h == nil ? COLOR_EMPTY : (h ? COLOR_HIT : COLOR_NO_HIT)}]
|
68
|
+
end
|
61
69
|
}
|
62
70
|
|
63
71
|
on_mouse_move do |event|
|
@@ -0,0 +1,95 @@
|
|
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
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
shell {
|
27
|
+
grid_layout {
|
28
|
+
margin_width 0
|
29
|
+
margin_height 0
|
30
|
+
}
|
31
|
+
|
32
|
+
text 'Hello, Scrolled Composite!'
|
33
|
+
maximum_size 400, 400
|
34
|
+
|
35
|
+
composite {
|
36
|
+
layout_data {
|
37
|
+
horizontal_alignment :center
|
38
|
+
}
|
39
|
+
|
40
|
+
row_layout
|
41
|
+
|
42
|
+
button {
|
43
|
+
text '<<'
|
44
|
+
|
45
|
+
on_widget_selected do
|
46
|
+
@scrolled_composite.set_origin(0, @scrolled_composite.origin.y)
|
47
|
+
end
|
48
|
+
}
|
49
|
+
|
50
|
+
button {
|
51
|
+
text '>>'
|
52
|
+
|
53
|
+
on_widget_selected do
|
54
|
+
@scrolled_composite.set_origin(@inner_composite.size.x, @scrolled_composite.origin.y)
|
55
|
+
end
|
56
|
+
}
|
57
|
+
|
58
|
+
button {
|
59
|
+
text '^^'
|
60
|
+
|
61
|
+
on_widget_selected do
|
62
|
+
@scrolled_composite.set_origin(@scrolled_composite.origin.x, 0)
|
63
|
+
end
|
64
|
+
}
|
65
|
+
|
66
|
+
button {
|
67
|
+
text 'vv'
|
68
|
+
|
69
|
+
on_widget_selected do
|
70
|
+
@scrolled_composite.set_origin(@scrolled_composite.origin.x, @inner_composite.size.y)
|
71
|
+
end
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
@scrolled_composite = scrolled_composite {
|
76
|
+
layout_data :fill, :fill, true, true
|
77
|
+
|
78
|
+
@inner_composite = composite {
|
79
|
+
row_layout(:vertical)
|
80
|
+
|
81
|
+
background :white
|
82
|
+
|
83
|
+
50.times do |n|
|
84
|
+
label {
|
85
|
+
layout_data {
|
86
|
+
height 20
|
87
|
+
}
|
88
|
+
|
89
|
+
text "Line #{n+1} has a lot of gibberish in it. In fact, it has so much gibberish that it does not fit the window horizontally, so scrollbars must be used to see all the text."
|
90
|
+
background :white
|
91
|
+
}
|
92
|
+
end
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}.open
|
data/vendor/swt/linux/swt.jar
CHANGED
Binary file
|
Binary file
|
data/vendor/swt/mac/swt.jar
CHANGED
Binary file
|
Binary file
|
data/vendor/swt/windows/swt.jar
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.22.0.0
|
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-11
|
11
|
+
date: 2021-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 2.5.
|
18
|
+
version: 2.5.4
|
19
19
|
name: glimmer
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.5.
|
26
|
+
version: 2.5.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -466,6 +466,7 @@ files:
|
|
466
466
|
- lib/glimmer/dsl/swt/shell_expression.rb
|
467
467
|
- lib/glimmer/dsl/swt/shine_data_binding_expression.rb
|
468
468
|
- lib/glimmer/dsl/swt/swt_expression.rb
|
469
|
+
- lib/glimmer/dsl/swt/sync_call_expression.rb
|
469
470
|
- lib/glimmer/dsl/swt/sync_exec_expression.rb
|
470
471
|
- lib/glimmer/dsl/swt/tab_item_expression.rb
|
471
472
|
- lib/glimmer/dsl/swt/table_items_data_binding_expression.rb
|
@@ -667,6 +668,7 @@ files:
|
|
667
668
|
- samples/hello/hello_radio_group.rb
|
668
669
|
- samples/hello/hello_sash_form.rb
|
669
670
|
- samples/hello/hello_scale.rb
|
671
|
+
- samples/hello/hello_scrolled_composite.rb
|
670
672
|
- samples/hello/hello_shape.rb
|
671
673
|
- samples/hello/hello_shell.rb
|
672
674
|
- samples/hello/hello_slider.rb
|
@@ -709,7 +711,7 @@ post_install_message:
|
|
709
711
|
|
710
712
|
You are ready to use `glimmer` and `girb` commands on Windows and Linux.
|
711
713
|
|
712
|
-
On the Mac, run `glimmer-setup` command to complete setup of Glimmer DSL for SWT, making `glimmer` and `girb` commands ready for use:
|
714
|
+
On the Mac, run `glimmer-setup` command to complete setup of Glimmer DSL for SWT (it will configure a Mac required jruby option globally `-J-XstartOnFirstThread` so that you do not have to add manually), making `glimmer` and `girb` commands ready for use:
|
713
715
|
|
714
716
|
glimmer-setup
|
715
717
|
|