glimmer-dsl-opal 0.7.1 → 0.8.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 +45 -0
- data/README.md +453 -48
- data/VERSION +1 -1
- data/lib/display.rb +31 -0
- data/lib/glimmer-dsl-opal.rb +15 -36
- data/lib/glimmer-dsl-opal/ext/class.rb +10 -0
- data/lib/glimmer-dsl-opal/ext/file.rb +29 -0
- data/lib/glimmer-dsl-opal/ext/struct.rb +37 -0
- data/lib/glimmer-dsl-opal/samples/elaborate/contact_manager.rb +50 -23
- data/lib/glimmer-dsl-opal/samples/elaborate/login.rb +22 -5
- data/lib/glimmer-dsl-opal/samples/hello/hello_browser.rb +24 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_button.rb +46 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_computed.rb +27 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +7 -7
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb +62 -32
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +47 -22
- data/lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb +37 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb +84 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +2 -2
- data/lib/glimmer/data_binding/observable_element.rb +1 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +3 -3
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +6 -0
- data/lib/glimmer/dsl/opal/dsl.rb +2 -0
- data/lib/glimmer/dsl/opal/menu_bar_expression.rb +54 -0
- data/lib/glimmer/dsl/opal/menu_expression.rb +61 -0
- data/lib/glimmer/dsl/opal/widget_expression.rb +3 -2
- data/lib/glimmer/dsl/opal/widget_listener_expression.rb +2 -2
- data/lib/glimmer/swt/combo_proxy.rb +40 -1
- data/lib/glimmer/swt/control_editor.rb +2 -1
- data/lib/glimmer/swt/custom/checkbox_group.rb +2 -2
- data/lib/glimmer/swt/custom/radio_group.rb +2 -2
- data/lib/glimmer/swt/date_time_proxy.rb +66 -1
- data/lib/glimmer/swt/event_listener_proxy.rb +14 -4
- data/lib/glimmer/swt/font_proxy.rb +4 -4
- data/lib/glimmer/swt/grid_layout_proxy.rb +21 -12
- data/lib/glimmer/swt/label_proxy.rb +17 -6
- data/lib/glimmer/swt/layout_data_proxy.rb +10 -7
- data/lib/glimmer/swt/list_proxy.rb +33 -0
- data/lib/glimmer/swt/menu_item_proxy.rb +87 -0
- data/lib/glimmer/swt/menu_proxy.rb +162 -0
- data/lib/glimmer/swt/message_box_proxy.rb +53 -67
- data/lib/glimmer/swt/property_owner.rb +2 -0
- data/lib/glimmer/swt/radio_proxy.rb +1 -1
- data/lib/glimmer/swt/shell_proxy.rb +32 -187
- data/lib/glimmer/swt/tab_folder_proxy.rb +43 -0
- data/lib/glimmer/swt/table_column_proxy.rb +4 -3
- data/lib/glimmer/swt/table_editor.rb +2 -2
- data/lib/glimmer/swt/table_item_proxy.rb +15 -5
- data/lib/glimmer/swt/table_proxy.rb +34 -12
- data/lib/glimmer/swt/text_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +335 -38
- data/lib/glimmer/ui/custom_shell.rb +9 -7
- data/lib/glimmer/ui/custom_widget.rb +3 -3
- data/lib/os.rb +36 -0
- metadata +36 -3
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020 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
|
+
|
1
22
|
require_relative 'hello_computed/contact'
|
2
23
|
|
3
24
|
class HelloComputed
|
@@ -14,6 +35,7 @@ class HelloComputed
|
|
14
35
|
def launch
|
15
36
|
shell {
|
16
37
|
text 'Hello, Computed!'
|
38
|
+
|
17
39
|
composite {
|
18
40
|
grid_layout {
|
19
41
|
num_columns 2
|
@@ -21,6 +43,7 @@ class HelloComputed
|
|
21
43
|
horizontal_spacing 20
|
22
44
|
vertical_spacing 10
|
23
45
|
}
|
46
|
+
|
24
47
|
label {text 'First &Name: '}
|
25
48
|
text {
|
26
49
|
text bind(@contact, :first_name)
|
@@ -29,6 +52,7 @@ class HelloComputed
|
|
29
52
|
grab_excess_horizontal_space true
|
30
53
|
}
|
31
54
|
}
|
55
|
+
|
32
56
|
label {text '&Last Name: '}
|
33
57
|
text {
|
34
58
|
text bind(@contact, :last_name)
|
@@ -37,6 +61,7 @@ class HelloComputed
|
|
37
61
|
grab_excess_horizontal_space true
|
38
62
|
}
|
39
63
|
}
|
64
|
+
|
40
65
|
label {text '&Year of Birth: '}
|
41
66
|
text {
|
42
67
|
text bind(@contact, :year_of_birth)
|
@@ -45,6 +70,7 @@ class HelloComputed
|
|
45
70
|
grab_excess_horizontal_space true
|
46
71
|
}
|
47
72
|
}
|
73
|
+
|
48
74
|
label {text 'Name: '}
|
49
75
|
label {
|
50
76
|
text bind(@contact, :name, computed_by: [:first_name, :last_name])
|
@@ -53,6 +79,7 @@ class HelloComputed
|
|
53
79
|
grab_excess_horizontal_space true
|
54
80
|
}
|
55
81
|
}
|
82
|
+
|
56
83
|
label {text 'Age: '}
|
57
84
|
label {
|
58
85
|
text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2020 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
|
@@ -26,7 +26,7 @@ require 'date'
|
|
26
26
|
class EmailShell
|
27
27
|
include Glimmer::UI::CustomShell
|
28
28
|
|
29
|
-
# multiple options without default values
|
29
|
+
# multiple options without default values
|
30
30
|
options :date, :subject, :from, :message
|
31
31
|
|
32
32
|
# single option with default value
|
@@ -41,7 +41,7 @@ class EmailShell
|
|
41
41
|
shell(swt_style) {
|
42
42
|
grid_layout(2, false)
|
43
43
|
|
44
|
-
text subject
|
44
|
+
text subject
|
45
45
|
|
46
46
|
label {
|
47
47
|
text 'Date:'
|
@@ -78,7 +78,7 @@ class EmailShell
|
|
78
78
|
}
|
79
79
|
|
80
80
|
background :white
|
81
|
-
text message
|
81
|
+
text message
|
82
82
|
}
|
83
83
|
}
|
84
84
|
}
|
@@ -149,7 +149,7 @@ class HelloCustomShell
|
|
149
149
|
}
|
150
150
|
}
|
151
151
|
}.open
|
152
|
-
end
|
152
|
+
end
|
153
153
|
end
|
154
154
|
|
155
155
|
HelloCustomShell.new.launch
|
@@ -1,41 +1,71 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
1
|
+
# Copyright (c) 2020 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.
|
23
21
|
|
24
22
|
class HelloListMultiSelection
|
23
|
+
class Person
|
24
|
+
attr_accessor :provinces, :provinces_options
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
self.provinces_options = [
|
28
|
+
'',
|
29
|
+
'Alberta',
|
30
|
+
'British Columbia',
|
31
|
+
'Manitoba',
|
32
|
+
'New Brunswick',
|
33
|
+
'Newfoundland and Labrador',
|
34
|
+
'Northwest Territories',
|
35
|
+
'Nova Scotia',
|
36
|
+
'Nunavut',
|
37
|
+
'Ontario',
|
38
|
+
'Prince Edward Island',
|
39
|
+
'Quebec',
|
40
|
+
'Saskatchewan',
|
41
|
+
'Yukon'
|
42
|
+
]
|
43
|
+
reset_provinces
|
44
|
+
end
|
45
|
+
|
46
|
+
def reset_provinces
|
47
|
+
self.provinces = ['Quebec', 'Manitoba', 'Alberta']
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
25
51
|
include Glimmer
|
52
|
+
|
26
53
|
def launch
|
27
54
|
person = Person.new
|
55
|
+
|
28
56
|
shell {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
57
|
+
grid_layout
|
58
|
+
|
59
|
+
text 'Hello, List Multi Selection!'
|
60
|
+
|
61
|
+
list(:multi) {
|
62
|
+
selection bind(person, :provinces)
|
63
|
+
}
|
64
|
+
|
65
|
+
button {
|
66
|
+
text 'Reset Selections To Default Values'
|
67
|
+
|
68
|
+
on_widget_selected { person.reset_provinces }
|
39
69
|
}
|
40
70
|
}.open
|
41
71
|
end
|
@@ -1,31 +1,56 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
# Copyright (c) 2007-2020 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.
|
13
21
|
|
14
22
|
class HelloListSingleSelection
|
23
|
+
class Person
|
24
|
+
attr_accessor :country, :country_options
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
self.country_options = ['', 'Canada', 'US', 'Mexico']
|
28
|
+
reset_country
|
29
|
+
end
|
30
|
+
|
31
|
+
def reset_country
|
32
|
+
self.country = 'Canada'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
15
36
|
include Glimmer
|
37
|
+
|
16
38
|
def launch
|
17
39
|
person = Person.new
|
40
|
+
|
18
41
|
shell {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
42
|
+
grid_layout
|
43
|
+
|
44
|
+
text 'Hello, List Single Selection!'
|
45
|
+
|
46
|
+
list {
|
47
|
+
selection bind(person, :country)
|
48
|
+
}
|
49
|
+
|
50
|
+
button {
|
51
|
+
text 'Reset Selection To Default Value'
|
52
|
+
|
53
|
+
on_widget_selected { person.reset_country }
|
29
54
|
}
|
30
55
|
}.open
|
31
56
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright (c) 2020 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
|
+
include Glimmer
|
23
|
+
|
24
|
+
shell {
|
25
|
+
text 'Hello, Message Box!'
|
26
|
+
|
27
|
+
button {
|
28
|
+
text 'Please Click To Win a Surprise'
|
29
|
+
|
30
|
+
on_widget_selected {
|
31
|
+
message_box {
|
32
|
+
text 'Surprise'
|
33
|
+
message "Congratulations!\n\nYou won $1,000,000!"
|
34
|
+
}.open
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}.open
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Copyright (c) 2020 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
|
+
include Glimmer
|
23
|
+
|
24
|
+
shell {
|
25
|
+
grid_layout {
|
26
|
+
margin_width 0
|
27
|
+
margin_height 0
|
28
|
+
}
|
29
|
+
|
30
|
+
text 'Hello, Pop Up Context Menu!'
|
31
|
+
|
32
|
+
label {
|
33
|
+
text "Right-Click on the Text to\nPop Up a Context Menu"
|
34
|
+
font height: 50
|
35
|
+
|
36
|
+
menu {
|
37
|
+
menu {
|
38
|
+
text '&History'
|
39
|
+
menu {
|
40
|
+
text '&Recent'
|
41
|
+
menu_item {
|
42
|
+
text 'File 1'
|
43
|
+
on_widget_selected {
|
44
|
+
message_box {
|
45
|
+
text 'File 1'
|
46
|
+
message 'File 1 Contents'
|
47
|
+
}.open
|
48
|
+
}
|
49
|
+
}
|
50
|
+
menu_item {
|
51
|
+
text 'File 2'
|
52
|
+
on_widget_selected {
|
53
|
+
message_box {
|
54
|
+
text 'File 2'
|
55
|
+
message 'File 2 Contents'
|
56
|
+
}.open
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
menu {
|
61
|
+
text '&Archived'
|
62
|
+
menu_item {
|
63
|
+
text 'File 3'
|
64
|
+
on_widget_selected {
|
65
|
+
message_box {
|
66
|
+
text 'File 3'
|
67
|
+
message 'File 3 Contents'
|
68
|
+
}.open
|
69
|
+
}
|
70
|
+
}
|
71
|
+
menu_item {
|
72
|
+
text 'File 4'
|
73
|
+
on_widget_selected {
|
74
|
+
message_box {
|
75
|
+
text 'File 4'
|
76
|
+
message 'File 4 Contents'
|
77
|
+
}.open
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}.open
|
@@ -207,13 +207,13 @@ class HelloTable
|
|
207
207
|
text 'Game Date'
|
208
208
|
width 150
|
209
209
|
sort_property :date # ensure sorting by real date value (not `game_date` string specified in items below)
|
210
|
-
|
210
|
+
editor :date_drop_down, property: :date_time
|
211
211
|
}
|
212
212
|
table_column {
|
213
213
|
text 'Game Time'
|
214
214
|
width 150
|
215
215
|
sort_property :time # ensure sorting by real time value (not `game_time` string specified in items below)
|
216
|
-
|
216
|
+
editor :time, property: :date_time
|
217
217
|
}
|
218
218
|
table_column {
|
219
219
|
text 'Ballpark'
|