glimmer-dsl-swt 4.17.6.0 → 4.17.8.3

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -2
  3. data/README.md +211 -82
  4. data/VERSION +1 -1
  5. data/glimmer-dsl-swt.gemspec +14 -3
  6. data/lib/glimmer/data_binding/tree_items_binding.rb +20 -2
  7. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +61 -0
  8. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -0
  9. data/lib/glimmer/dsl/swt/dialog_expression.rb +1 -0
  10. data/lib/glimmer/dsl/swt/directory_dialog_expression.rb +48 -0
  11. data/lib/glimmer/dsl/swt/dsl.rb +1 -0
  12. data/lib/glimmer/dsl/swt/file_dialog_expression.rb +48 -0
  13. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +3 -3
  14. data/lib/glimmer/dsl/swt/shell_expression.rb +3 -3
  15. data/lib/glimmer/dsl/swt/widget_expression.rb +8 -8
  16. data/lib/glimmer/swt/custom/checkbox_group.rb +181 -0
  17. data/lib/glimmer/swt/custom/code_text.rb +43 -33
  18. data/lib/glimmer/swt/custom/radio_group.rb +94 -19
  19. data/lib/glimmer/swt/directory_dialog_proxy.rb +65 -0
  20. data/lib/glimmer/swt/expand_item_proxy.rb +0 -1
  21. data/lib/glimmer/swt/file_dialog_proxy.rb +66 -0
  22. data/lib/glimmer/swt/menu_proxy.rb +3 -3
  23. data/lib/glimmer/swt/shell_proxy.rb +5 -5
  24. data/lib/glimmer/swt/tab_item_proxy.rb +3 -3
  25. data/lib/glimmer/swt/table_proxy.rb +25 -25
  26. data/lib/glimmer/swt/widget_listener_proxy.rb +4 -4
  27. data/lib/glimmer/swt/widget_proxy.rb +27 -27
  28. data/lib/glimmer/ui/custom_shell.rb +3 -3
  29. data/samples/elaborate/contact_manager.rb +3 -3
  30. data/samples/elaborate/meta_sample.rb +24 -19
  31. data/samples/hello/hello_browser.rb +3 -3
  32. data/samples/hello/hello_checkbox.rb +18 -18
  33. data/samples/hello/hello_checkbox_group.rb +68 -0
  34. data/samples/hello/hello_combo.rb +12 -12
  35. data/samples/hello/hello_directory_dialog.rb +60 -0
  36. data/samples/hello/hello_expand_bar.rb +3 -1
  37. data/samples/hello/hello_file_dialog.rb +60 -0
  38. data/samples/hello/hello_group.rb +104 -0
  39. data/samples/hello/hello_list_multi_selection.rb +23 -23
  40. data/samples/hello/hello_list_single_selection.rb +18 -17
  41. data/samples/hello/hello_menu_bar.rb +3 -3
  42. data/samples/hello/hello_pop_up_context_menu.rb +3 -3
  43. data/samples/hello/hello_radio.rb +20 -20
  44. data/samples/hello/hello_radio_group.rb +25 -25
  45. data/samples/hello/hello_table.rb +130 -0
  46. data/samples/hello/hello_world.rb +3 -3
  47. metadata +13 -2
@@ -19,30 +19,30 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- class Person
23
- attr_accessor :provinces, :provinces_options
24
-
25
- def initialize
26
- self.provinces_options=[
27
- "",
28
- "Quebec",
29
- "Ontario",
30
- "Manitoba",
31
- "Saskatchewan",
32
- "Alberta",
33
- "British Columbia",
34
- "Nova Skotia",
35
- "Newfoundland"
36
- ]
37
- self.provinces = ["Quebec", "Manitoba", "Alberta"]
38
- end
39
-
40
- def reset_provinces
41
- self.provinces = ["Quebec", "Manitoba", "Alberta"]
42
- end
43
- end
44
-
45
22
  class HelloListMultiSelection
23
+ class Person
24
+ attr_accessor :provinces, :provinces_options
25
+
26
+ def initialize
27
+ self.provinces_options=[
28
+ "",
29
+ "Quebec",
30
+ "Ontario",
31
+ "Manitoba",
32
+ "Saskatchewan",
33
+ "Alberta",
34
+ "British Columbia",
35
+ "Nova Skotia",
36
+ "Newfoundland"
37
+ ]
38
+ self.provinces = ["Quebec", "Manitoba", "Alberta"]
39
+ end
40
+
41
+ def reset_provinces
42
+ self.provinces = ["Quebec", "Manitoba", "Alberta"]
43
+ end
44
+ end
45
+
46
46
  include Glimmer
47
47
 
48
48
  def launch
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-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
@@ -19,21 +19,22 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- class Person
23
- attr_accessor :country, :country_options
24
-
25
- def initialize
26
- self.country_options=["", "Canada", "US", "Mexico"]
27
- self.country = "Canada"
28
- end
29
-
30
- def reset_country
31
- self.country = "Canada"
32
- end
33
- end
34
-
35
22
  class HelloListSingleSelection
23
+ class Person
24
+ attr_accessor :country, :country_options
25
+
26
+ def initialize
27
+ self.country_options=["", "Canada", "US", "Mexico"]
28
+ self.country = "Canada"
29
+ end
30
+
31
+ def reset_country
32
+ self.country = "Canada"
33
+ end
34
+ end
35
+
36
36
  include Glimmer
37
+
37
38
  def launch
38
39
  person = Person.new
39
40
 
@@ -55,4 +56,4 @@ class HelloListSingleSelection
55
56
  end
56
57
  end
57
58
 
58
- HelloListSingleSelection.new.launch
59
+ HelloListSingleSelection.new.launch
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-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
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-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
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-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
@@ -19,31 +19,31 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- class Person
23
- attr_accessor :male, :female, :child, :teen, :adult, :senior
24
-
25
- def initialize
26
- reset
22
+ class HelloRadio
23
+ class Person
24
+ attr_accessor :male, :female, :child, :teen, :adult, :senior
25
+
26
+ def initialize
27
+ reset
28
+ end
29
+
30
+ def reset
31
+ self.male = nil
32
+ self.female = nil
33
+ self.child = nil
34
+ self.teen = nil
35
+ self.adult = true
36
+ self.senior = nil
37
+ end
27
38
  end
28
39
 
29
- def reset
30
- self.male = nil
31
- self.female = nil
32
- self.child = nil
33
- self.teen = nil
34
- self.adult = true
35
- self.senior = nil
36
- end
37
- end
38
-
39
- class HelloRadio
40
40
  include Glimmer
41
41
 
42
42
  def launch
43
43
  person = Person.new
44
44
 
45
45
  shell {
46
- text 'Hello, Radio!'
46
+ text 'Hello, Radio!'
47
47
  row_layout :vertical
48
48
 
49
49
  label {
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-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
@@ -19,36 +19,36 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- class Person
23
- attr_accessor :gender, :age_group
24
-
25
- def initialize
26
- reset
27
- end
28
-
29
- def gender_options
30
- ['Male', 'Female']
31
- end
32
-
33
- def age_group_options
34
- ['Child', 'Teen', 'Adult', 'Senior']
35
- end
36
-
37
- def reset
38
- self.gender = nil
39
- self.age_group = 'Adult'
22
+ class HelloRadioGroup
23
+ class Person
24
+ attr_accessor :gender, :age_group
25
+
26
+ def initialize
27
+ reset
28
+ end
29
+
30
+ def gender_options
31
+ ['Male', 'Female']
32
+ end
33
+
34
+ def age_group_options
35
+ ['Child', 'Teen', 'Adult', 'Senior']
36
+ end
37
+
38
+ def reset
39
+ self.gender = nil
40
+ self.age_group = 'Adult'
41
+ end
40
42
  end
41
- end
42
43
 
43
- class HelloRadioGroup
44
44
  include Glimmer
45
45
 
46
46
  def launch
47
47
  person = Person.new
48
48
 
49
49
  shell {
50
- text 'Hello, Radio Group!'
51
- row_layout :vertical
50
+ text 'Hello, Radio Group!'
51
+ row_layout :vertical
52
52
 
53
53
  label {
54
54
  text 'Gender:'
@@ -0,0 +1,130 @@
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.
21
+
22
+ class HelloTable
23
+ class BaseballGame
24
+ class << self
25
+ def schedule
26
+ @schedule ||= [
27
+ new('Chicago Cubs', 'Milwaukee Brewers', Time.new(2037, 10, 6, 12, 0)),
28
+ new('Chicago Cubs', 'Milwaukee Brewers', Time.new(2037, 10, 7, 12, 0)),
29
+ new('Milwaukee Brewers', 'Chicago Cubs', Time.new(2037, 10, 8, 12, 0)),
30
+ new('Milwaukee Brewers', 'Chicago Cubs', Time.new(2037, 10, 9, 12, 0)),
31
+ new('Milwaukee Brewers', 'Chicago Cubs', Time.new(2037, 10, 10, 12, 0)),
32
+ new('Chicago White Sox', 'St Louis Cardinals', Time.new(2037, 10, 6, 18, 0)),
33
+ new('Chicago White Sox', 'St Louis Cardinals', Time.new(2037, 10, 7, 18, 0)),
34
+ new('St Louis Cardinals', 'Chicago White Sox', Time.new(2037, 10, 8, 18, 0)),
35
+ new('St Louis Cardinals', 'Chicago White Sox', Time.new(2037, 10, 9, 18, 0)),
36
+ new('St Louis Cardinals', 'Chicago White Sox', Time.new(2037, 10, 10, 18, 0)),
37
+ ]
38
+ end
39
+
40
+ def schedule=(new_schedule)
41
+ @schedule = new_schedule
42
+ end
43
+ end
44
+
45
+ include Glimmer::DataBinding::ObservableModel
46
+
47
+ TEAM_BALLPARKS = {
48
+ 'Chicago Cubs' => 'Wrigley Field',
49
+ 'Chicago White Sox' => 'Guaranteed Rate Field',
50
+ 'Milwaukee Brewers' => 'Miller Park',
51
+ 'St Louis Cardinals' => 'Busch Stadium'
52
+ }
53
+
54
+ attr_accessor :home_team, :away_team, :date_time, :ballpark
55
+
56
+ def initialize(home_team, away_team, date_time)
57
+ self.home_team = home_team
58
+ self.away_team = away_team
59
+ self.date_time = date_time
60
+ end
61
+
62
+ def home_team=(home_team_value)
63
+ if home_team_value != away_team
64
+ @home_team = home_team_value
65
+ self.ballpark = TEAM_BALLPARKS[@home_team]
66
+ end
67
+ end
68
+
69
+ def away_team=(away_team_value)
70
+ if away_team_value != home_team
71
+ @away_team = away_team_value
72
+ end
73
+ end
74
+
75
+ def game_date_time
76
+ date_time.strftime("%Y-%m-%d %I:%M %p")
77
+ end
78
+
79
+ def home_team_options
80
+ TEAM_BALLPARKS.keys
81
+ end
82
+
83
+ def away_team_options
84
+ TEAM_BALLPARKS.keys
85
+ end
86
+ end
87
+
88
+ include Glimmer
89
+
90
+ def launch
91
+ shell {
92
+ text 'Hello, Table!'
93
+ table { |table_proxy|
94
+ table_column {
95
+ text 'Game Date/Time'
96
+ width 150
97
+ sort_property :date_time # ensure sorting by real date value (not `game_date_time` string specified in items below)
98
+ editor :none
99
+ }
100
+ table_column {
101
+ text 'Home Team'
102
+ width 150
103
+ editor :combo, :read_only
104
+ }
105
+ table_column {
106
+ text 'Away Team'
107
+ width 150
108
+ editor :combo, :read_only
109
+ }
110
+ table_column {
111
+ text 'Ballpark'
112
+ width 150
113
+ editor :none
114
+ }
115
+
116
+ # Data-bind table items (rows) to a model collection property, specifying column properties ordering per nested model
117
+ items bind(BaseballGame, :schedule), column_properties(:game_date_time, :home_team, :away_team, :ballpark)
118
+
119
+ # Sort by these additional properties after handling the main column sort the user selected
120
+ additional_sort_properties :date_time, :home_team, :away_team, :ballpark
121
+
122
+ on_mouse_up { |event|
123
+ table_proxy.edit_table_item(event.table_item, event.column_index)
124
+ }
125
+ }
126
+ }.open
127
+ end
128
+ end
129
+
130
+ HelloTable.new.launch
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-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