glimmer-dsl-swt 4.20.1.0 → 4.20.4.1
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 +27 -0
- data/README.md +12 -6
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +5 -2
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer-dsl-swt.rb +1 -0
- data/lib/glimmer/data_binding/table_items_binding.rb +1 -0
- data/lib/glimmer/data_binding/tree_items_binding.rb +2 -2
- data/lib/glimmer/dsl/swt/bind_expression.rb +5 -25
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/shine_data_binding_expression.rb +2 -4
- data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +17 -12
- data/lib/glimmer/rake_task/scaffold.rb +2 -2
- data/lib/glimmer/swt/custom/animation.rb +6 -0
- data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
- data/lib/glimmer/swt/custom/radio_group.rb +2 -1
- data/lib/glimmer/swt/proxy_properties.rb +5 -5
- data/lib/glimmer/swt/widget_proxy.rb +3 -0
- data/lib/glimmer/ui/custom_shape.rb +1 -1
- data/lib/glimmer/ui/custom_widget.rb +1 -1
- data/samples/elaborate/calculator.rb +1 -1
- data/samples/elaborate/contact_manager.rb +2 -2
- data/samples/elaborate/meta_sample.rb +5 -5
- data/samples/elaborate/tetris.rb +2 -2
- data/samples/elaborate/tetris/view/bevel.rb +11 -11
- data/samples/elaborate/tetris/view/block.rb +1 -1
- data/samples/elaborate/tetris/view/high_score_dialog.rb +4 -4
- data/samples/elaborate/tetris/view/score_lane.rb +3 -3
- data/samples/elaborate/tetris/view/tetris_menu_bar.rb +9 -9
- data/samples/elaborate/timer.rb +8 -8
- data/samples/elaborate/weather.rb +8 -4
- data/samples/hello/hello_canvas_animation_data_binding.rb +1 -1
- data/samples/hello/hello_checkbox_group.rb +1 -1
- data/samples/hello/hello_code_text.rb +3 -3
- data/samples/hello/hello_computed.rb +20 -2
- data/samples/hello/hello_cool_bar.rb +1 -1
- data/samples/hello/hello_cursor.rb +1 -1
- data/samples/hello/hello_custom_shell.rb +17 -11
- data/samples/hello/hello_directory_dialog.rb +1 -1
- data/samples/hello/hello_radio_group.rb +2 -2
- data/samples/hello/hello_table.rb +1 -1
- data/samples/hello/hello_tool_bar.rb +1 -1
- data/samples/hello/hello_tree.rb +11 -11
- metadata +44 -26
- data/lib/glimmer/data_binding/shine.rb +0 -61
- data/samples/hello/hello_computed/contact.rb +0 -42
@@ -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!'
|
@@ -138,15 +136,23 @@ class HelloCustomShell
|
|
138
136
|
width 360
|
139
137
|
}
|
140
138
|
|
141
|
-
items
|
139
|
+
items <=> [@email_system, :emails, column_properties: [:date, :subject, :from]]
|
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
|
@@ -64,7 +64,7 @@ class HelloRadioGroup
|
|
64
64
|
|
65
65
|
radio_group {
|
66
66
|
row_layout :horizontal
|
67
|
-
selection
|
67
|
+
selection <=> [@person, :gender]
|
68
68
|
}
|
69
69
|
|
70
70
|
label {
|
@@ -74,7 +74,7 @@ class HelloRadioGroup
|
|
74
74
|
|
75
75
|
radio_group {
|
76
76
|
row_layout :horizontal
|
77
|
-
selection
|
77
|
+
selection <=> [@person, :age_group]
|
78
78
|
}
|
79
79
|
|
80
80
|
button {
|
data/samples/hello/hello_tree.rb
CHANGED
@@ -314,8 +314,8 @@ class HelloTree
|
|
314
314
|
margin_height 5
|
315
315
|
}
|
316
316
|
@tree = tree {
|
317
|
-
items
|
318
|
-
selection
|
317
|
+
items <= [Employee, :ceo, tree_properties: {children: :subordinates, text: :to_s}]
|
318
|
+
selection <=> [Employee, :selected_employee]
|
319
319
|
}
|
320
320
|
}
|
321
321
|
|
@@ -329,7 +329,7 @@ class HelloTree
|
|
329
329
|
}
|
330
330
|
text {
|
331
331
|
layout_data(:fill, :center, true, false)
|
332
|
-
text
|
332
|
+
text <=> [Employee, "selected_employee.first_name"]
|
333
333
|
font height: 16
|
334
334
|
}
|
335
335
|
|
@@ -340,7 +340,7 @@ class HelloTree
|
|
340
340
|
}
|
341
341
|
text {
|
342
342
|
layout_data(:fill, :center, true, false)
|
343
|
-
text
|
343
|
+
text <=> [Employee, "selected_employee.last_name"]
|
344
344
|
font height: 16
|
345
345
|
}
|
346
346
|
|
@@ -351,7 +351,7 @@ class HelloTree
|
|
351
351
|
}
|
352
352
|
combo {
|
353
353
|
layout_data(:fill, :center, true, false)
|
354
|
-
selection
|
354
|
+
selection <=> [Employee, "selected_employee.position"]
|
355
355
|
font height: 16
|
356
356
|
}
|
357
357
|
|
@@ -373,7 +373,7 @@ class HelloTree
|
|
373
373
|
spinner {
|
374
374
|
maximum 999_999
|
375
375
|
minimum 0
|
376
|
-
selection
|
376
|
+
selection <=> [Employee, "selected_employee.salary"]
|
377
377
|
font height: 16
|
378
378
|
}
|
379
379
|
}
|
@@ -385,7 +385,7 @@ class HelloTree
|
|
385
385
|
}
|
386
386
|
combo(:read_only) {
|
387
387
|
layout_data(:fill, :center, true, false)
|
388
|
-
selection
|
388
|
+
selection <=> [Employee, "selected_employee.health_insurance"]
|
389
389
|
font height: 16
|
390
390
|
}
|
391
391
|
|
@@ -396,7 +396,7 @@ class HelloTree
|
|
396
396
|
}
|
397
397
|
combo(:read_only) {
|
398
398
|
layout_data(:fill, :center, true, false)
|
399
|
-
selection
|
399
|
+
selection <=> [Employee, "selected_employee.desk_location"]
|
400
400
|
font height: 16
|
401
401
|
}
|
402
402
|
|
@@ -414,7 +414,7 @@ class HelloTree
|
|
414
414
|
spinner {
|
415
415
|
maximum 100
|
416
416
|
minimum 0
|
417
|
-
selection
|
417
|
+
selection <=> [Employee, "selected_employee.sales_bonus_percentage"]
|
418
418
|
font height: 16
|
419
419
|
}
|
420
420
|
label {
|
@@ -441,7 +441,7 @@ class HelloTree
|
|
441
441
|
spinner {
|
442
442
|
maximum 999_999
|
443
443
|
minimum 0
|
444
|
-
selection
|
444
|
+
selection <=> [Employee, "selected_employee.merit_bonus"]
|
445
445
|
font height: 16
|
446
446
|
}
|
447
447
|
}
|
@@ -467,7 +467,7 @@ class HelloTree
|
|
467
467
|
maximum 999_999_00
|
468
468
|
minimum 0
|
469
469
|
increment 100
|
470
|
-
selection
|
470
|
+
selection <=> [Employee, "selected_employee.#{attribute}", on_read: ->(v) {v.to_f * 100}, on_write: ->(v) {v.to_f / 100}]
|
471
471
|
font height: 16
|
472
472
|
}
|
473
473
|
}
|
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.20.1
|
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
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version:
|
18
|
+
version: 2.0.0
|
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:
|
26
|
+
version: 2.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -104,6 +104,46 @@ dependencies:
|
|
104
104
|
- - "<"
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: 2.0.0
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
requirement: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.1.7
|
113
|
+
- - "<"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 2.0.0
|
116
|
+
name: concurrent-ruby
|
117
|
+
prerelease: false
|
118
|
+
type: :runtime
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 1.1.7
|
124
|
+
- - "<"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 2.0.0
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.8.5
|
133
|
+
- - "<"
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: 2.0.0
|
136
|
+
name: jruby-win32ole
|
137
|
+
prerelease: false
|
138
|
+
type: :runtime
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 0.8.5
|
144
|
+
- - "<"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 2.0.0
|
107
147
|
- !ruby/object:Gem::Dependency
|
108
148
|
requirement: !ruby/object:Gem::Requirement
|
109
149
|
requirements:
|
@@ -198,26 +238,6 @@ dependencies:
|
|
198
238
|
- - "<"
|
199
239
|
- !ruby/object:Gem::Version
|
200
240
|
version: 4.0.0
|
201
|
-
- !ruby/object:Gem::Dependency
|
202
|
-
requirement: !ruby/object:Gem::Requirement
|
203
|
-
requirements:
|
204
|
-
- - ">="
|
205
|
-
- !ruby/object:Gem::Version
|
206
|
-
version: 0.8.5
|
207
|
-
- - "<"
|
208
|
-
- !ruby/object:Gem::Version
|
209
|
-
version: 2.0.0
|
210
|
-
name: jruby-win32ole
|
211
|
-
prerelease: false
|
212
|
-
type: :runtime
|
213
|
-
version_requirements: !ruby/object:Gem::Requirement
|
214
|
-
requirements:
|
215
|
-
- - ">="
|
216
|
-
- !ruby/object:Gem::Version
|
217
|
-
version: 0.8.5
|
218
|
-
- - "<"
|
219
|
-
- !ruby/object:Gem::Version
|
220
|
-
version: 2.0.0
|
221
241
|
- !ruby/object:Gem::Dependency
|
222
242
|
requirement: !ruby/object:Gem::Requirement
|
223
243
|
requirements:
|
@@ -390,7 +410,6 @@ files:
|
|
390
410
|
- lib/glimmer/Rakefile
|
391
411
|
- lib/glimmer/data_binding/list_selection_binding.rb
|
392
412
|
- lib/glimmer/data_binding/observable_widget.rb
|
393
|
-
- lib/glimmer/data_binding/shine.rb
|
394
413
|
- lib/glimmer/data_binding/table_items_binding.rb
|
395
414
|
- lib/glimmer/data_binding/tree_items_binding.rb
|
396
415
|
- lib/glimmer/data_binding/widget_binding.rb
|
@@ -572,7 +591,6 @@ files:
|
|
572
591
|
- samples/hello/hello_combo.rb
|
573
592
|
- samples/hello/hello_composite.rb
|
574
593
|
- samples/hello/hello_computed.rb
|
575
|
-
- samples/hello/hello_computed/contact.rb
|
576
594
|
- samples/hello/hello_cool_bar.rb
|
577
595
|
- samples/hello/hello_cursor.rb
|
578
596
|
- samples/hello/hello_custom_shape.rb
|
@@ -1,61 +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
|
-
module Glimmer
|
23
|
-
module DataBinding
|
24
|
-
class Shine
|
25
|
-
include Glimmer
|
26
|
-
|
27
|
-
def initialize(parent, parent_attribute)
|
28
|
-
@parent = parent
|
29
|
-
@parent_attribute = parent_attribute
|
30
|
-
end
|
31
|
-
|
32
|
-
alias original_compare <=>
|
33
|
-
|
34
|
-
def <=>(other)
|
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
|
38
|
-
@parent.content {
|
39
|
-
send(@parent_attribute, bind(*args_clone))
|
40
|
-
}
|
41
|
-
else # || other.is_a?(Hash) # TODO support hash e.g. {model: model_obj, attribute: :some_attribute, more-options...}
|
42
|
-
original_compare(other)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def <=(other)
|
47
|
-
if other.is_a?(Array)
|
48
|
-
args_clone = other.clone
|
49
|
-
if args_clone.last.is_a?(Hash)
|
50
|
-
args_clone.last[:read_only] = true
|
51
|
-
else # || other.is_a?(Hash) # TODO support hash e.g. {model: model_obj, attribute: :some_attribute, more-options...}
|
52
|
-
args_clone << {read_only: true}
|
53
|
-
end
|
54
|
-
@parent.content {
|
55
|
-
send(@parent_attribute, bind(*args_clone))
|
56
|
-
}
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -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
|