glimmer 0.1.11.470 → 0.2.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +104 -66
  3. data/bin/girb +1 -3
  4. data/bin/glimmer +1 -1
  5. data/lib/glimmer_application.rb +35 -76
  6. data/vendor/swt/linux/swt.jar +0 -0
  7. data/vendor/swt/mac/swt.jar +0 -0
  8. data/vendor/swt/windows/swt.jar +0 -0
  9. metadata +15 -55
  10. data/.coveralls.yml +0 -1
  11. data/.rspec +0 -2
  12. data/.ruby-gemset +0 -1
  13. data/.ruby-version +0 -1
  14. data/Gemfile +0 -14
  15. data/RELEASE.md +0 -15
  16. data/Rakefile +0 -43
  17. data/TODO.md +0 -12
  18. data/VERSION +0 -1
  19. data/bin/girb_runner.rb +0 -1
  20. data/glimmer.gemspec +0 -160
  21. data/images/Bitter-sweet.jpg +0 -0
  22. data/samples/contactmanager/contact.rb +0 -9
  23. data/samples/contactmanager/contact_manager.rb +0 -71
  24. data/samples/contactmanager/contact_manager_presenter.rb +0 -24
  25. data/samples/contactmanager/contact_repository.rb +0 -24
  26. data/samples/hello_combo.rb +0 -36
  27. data/samples/hello_list_multi_selection.rb +0 -46
  28. data/samples/hello_list_single_selection.rb +0 -36
  29. data/samples/hello_tab.rb +0 -26
  30. data/samples/hello_world.rb +0 -10
  31. data/samples/hellocomputed/contact.rb +0 -19
  32. data/samples/hellocomputed/hello_computed.rb +0 -68
  33. data/samples/login.rb +0 -92
  34. data/samples/tictactoe/tic_tac_toe.rb +0 -64
  35. data/samples/tictactoe/tic_tac_toe_board.rb +0 -146
  36. data/spec/lib/command_handlers/models/observable_model_spec.rb +0 -22
  37. data/spec/lib/command_handlers/models/r_widget_spec.rb +0 -52
  38. data/spec/lib/glimmer__combo_data_binding__spec.rb +0 -130
  39. data/spec/lib/glimmer__constant__spec.rb +0 -30
  40. data/spec/lib/glimmer__data_binding__spec.rb +0 -404
  41. data/spec/lib/glimmer__list_data_binding__spec.rb +0 -224
  42. data/spec/lib/glimmer__listeners__spec.rb +0 -60
  43. data/spec/lib/glimmer__shine_data_binding__spec.rb +0 -89
  44. data/spec/lib/glimmer__tab_item__spec.rb +0 -55
  45. data/spec/lib/glimmer__table_data_binding__spec.rb +0 -121
  46. data/spec/lib/glimmer__tree_data_binding__spec.rb +0 -113
  47. data/spec/lib/glimmer_spec.rb +0 -251
  48. data/spec/lib/xml/glimmer_xml_spec.rb +0 -154
  49. data/spec/samples/contactmanager/contact_manager_presenter_spec.rb +0 -81
  50. data/spec/samples/tictactoe/tic_tac_toe_spec.rb +0 -263
  51. data/spec/spec_helper.rb +0 -124
@@ -1,224 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Glimmer List Data Binding" do
4
- include Glimmer
5
-
6
- include_package 'org.eclipse.swt'
7
- include_package 'org.eclipse.swt.widgets'
8
- include_package 'org.eclipse.swt.layout'
9
-
10
- SWT = org.eclipse.swt.SWT unless Object.const_defined?(:SWT)
11
-
12
- before do
13
- dsl :swt
14
- end
15
-
16
- after do
17
- @target.display.dispose if @target.display
18
- end
19
-
20
- class Person
21
- attr_accessor :country, :country_options
22
- attr_accessor :provinces, :provinces_options
23
-
24
- def initialize
25
- self.country_options=[
26
- "",
27
- "Canada",
28
- "US",
29
- "Mexico"
30
- ]
31
- self.provinces_options=[
32
- "",
33
- "Quebec",
34
- "Ontario",
35
- "Manitoba",
36
- "Saskatchewan",
37
- "Alberta",
38
- "British Columbia",
39
- "Nova Skotia",
40
- "Newfoundland"
41
- ]
42
- end
43
- end
44
-
45
- it "tests single selection property" do
46
- person = Person.new
47
-
48
- @target = shell {
49
- @list = list {
50
- selection bind(person, :country)
51
- }
52
- }
53
-
54
- expect(@list.widget.item_count).to eq(4)
55
- expect(@list.widget.selection_index).to eq(-1)
56
- expect(@list.widget.selection.to_a).to eq([])
57
-
58
- @list.widget.select(1)
59
- @list.widget.notifyListeners(SWT::Selection, nil)
60
- expect(person.country).to eq("Canada")
61
-
62
- person.country_options << "France"
63
-
64
- expect(@list.widget.item_count).to eq(5)
65
-
66
- person.country_options=["", "Canada", "US", "Mexico", "Russia", "France"]
67
-
68
- expect(@list.widget.item_count).to eq(6)
69
-
70
- person.country_options << "Italy"
71
- person.country_options << "Germany"
72
- person.country_options << "Australia"
73
-
74
- expect(@list.widget.item_count).to eq(9)
75
-
76
- person.country = "Canada"
77
-
78
- expect(@list.widget.selection_index).to eq(1)
79
- expect(@list.widget.selection.to_a).to eq(["Canada"])
80
-
81
- person.country = "Russia"
82
-
83
- expect(@list.widget.selection_index).to eq(4)
84
- expect(@list.widget.selection.to_a).to eq(["Russia"])
85
-
86
- person.country = ""
87
-
88
- expect(@list.widget.selection_index).to eq(0)
89
- expect(@list.widget.selection.to_a).to eq([""])
90
-
91
- person.country = "Japan"
92
-
93
- expect(@list.widget.selection_index).to eq(0)
94
- expect(@list.widget.selection.to_a).to eq([""])
95
-
96
- @list.widget.select(2)
97
- @list.widget.notifyListeners(SWT::Selection, nil)
98
- expect(person.country).to eq("US")
99
- end
100
-
101
- it "tests single selection property with model preinitialized" do
102
- person = Person.new
103
- person.country = "Canada"
104
-
105
- @target = shell {
106
- @list = list {
107
- selection bind(person, :country)
108
- }
109
- }
110
-
111
- expect(@list.widget.item_count).to eq(4)
112
- expect(@list.widget.selection_index).to eq(1)
113
- expect(@list.widget.selection.to_a).to eq(["Canada"])
114
-
115
- @list.widget.select(2)
116
- @list.widget.notifyListeners(SWT::Selection, nil)
117
- expect(person.country).to eq("US")
118
-
119
- person.country_options << "France"
120
-
121
- expect(@list.widget.item_count).to eq(5)
122
-
123
- person.country_options=["", "Canada", "US", "Mexico", "Russia", "France"]
124
-
125
- expect(@list.widget.item_count).to eq(6)
126
-
127
- person.country_options << "Italy"
128
- person.country_options << "Germany"
129
- person.country_options << "Australia"
130
-
131
- expect(@list.widget.item_count).to eq(9)
132
-
133
- person.country = "Canada"
134
-
135
- expect(@list.widget.selection_index).to eq(1)
136
- expect(@list.widget.selection.to_a).to eq(["Canada"])
137
-
138
- person.country = "Russia"
139
-
140
- expect(@list.widget.selection_index).to eq(4)
141
- expect(@list.widget.selection.to_a).to eq(["Russia"])
142
-
143
- person.country = ""
144
-
145
- expect(@list.widget.selection_index).to eq(0)
146
- expect(@list.widget.selection.to_a).to eq([""])
147
-
148
- person.country = "Japan"
149
-
150
- expect(@list.widget.selection_index).to eq(0)
151
- expect(@list.widget.selection.to_a).to eq([""])
152
- end
153
-
154
- it "tests multi selection property" do
155
- person = Person.new
156
-
157
- @target = shell {
158
- @list = list(:multi) {
159
- selection bind(person, :provinces)
160
- }
161
- }
162
-
163
- expect(@list.widget.selection_count.to_i).to eq(0)
164
- expect(@list.widget.selection.to_a).to eq([])
165
-
166
- @list.widget.select(1)
167
- @list.widget.notifyListeners(SWT::Selection, nil)
168
- expect(person.provinces).to eq(["Quebec"])
169
-
170
- @list.widget.select(2)
171
- @list.widget.notifyListeners(SWT::Selection, nil)
172
- expect(person.provinces).to eq(["Quebec", "Ontario"])
173
-
174
- person.provinces=["Ontario", "Manitoba", "Alberta"]
175
-
176
- expect(@list.widget.selection_count.to_i).to eq(3)
177
- expect(@list.widget.selection_indices.to_a).to eq([2, 3, 5])
178
- expect(@list.widget.selection.to_a).to eq(["Ontario", "Manitoba", "Alberta"])
179
-
180
- person.provinces << "Quebec"
181
- person.provinces << "Saskatchewan"
182
- person.provinces << "British Columbia"
183
-
184
- expect(@list.widget.selection_count.to_i).to eq(6)
185
- expect(@list.widget.selection_indices.to_a).to eq([1, 2, 3, 4, 5, 6])
186
- expect(@list.widget.selection.to_a).to eq(["Quebec", "Ontario", "Manitoba", "Saskatchewan", "Alberta", "British Columbia"])
187
- end
188
-
189
- it "tests multi selection property with model preinitialized" do
190
- person = Person.new
191
- person.provinces = []
192
-
193
- @target = shell {
194
- @list = list(:multi) {
195
- selection bind(person, :provinces)
196
- }
197
- }
198
-
199
- expect(@list.widget.selection_count.to_i).to eq(0)
200
- expect(@list.widget.selection.to_a).to eq([])
201
-
202
- @list.widget.select(1)
203
- @list.widget.notifyListeners(SWT::Selection, nil)
204
- expect(person.provinces).to eq(["Quebec"])
205
-
206
- @list.widget.select(2)
207
- @list.widget.notifyListeners(SWT::Selection, nil)
208
- expect(person.provinces).to eq(["Quebec", "Ontario"])
209
-
210
- person.provinces=["Ontario", "Manitoba", "Alberta"]
211
-
212
- expect(@list.widget.selection_count.to_i).to eq(3)
213
- expect(@list.widget.selection_indices.to_a).to eq([2, 3, 5])
214
- expect(@list.widget.selection.to_a).to eq(["Ontario", "Manitoba", "Alberta"])
215
-
216
- person.provinces << "Quebec"
217
- person.provinces << "Saskatchewan"
218
- person.provinces << "British Columbia"
219
-
220
- expect(@list.widget.selection_count.to_i).to eq(6)
221
- expect(@list.widget.selection_indices.to_a).to eq([1, 2, 3, 4, 5, 6])
222
- expect(@list.widget.selection.to_a).to eq(["Quebec", "Ontario", "Manitoba", "Saskatchewan", "Alberta", "British Columbia"])
223
- end
224
- end
@@ -1,60 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Glimmer Listeners" do
4
- include Glimmer
5
-
6
- include_package 'org.eclipse.swt'
7
- include_package 'org.eclipse.swt.widgets'
8
- include_package 'org.eclipse.swt.layout'
9
-
10
- before do
11
- dsl :swt
12
- end
13
-
14
- after do
15
- @target.display.dispose if @target.display
16
- end
17
-
18
- class Person
19
- attr_accessor :name, :age, :adult
20
- end
21
-
22
- it "tests text widget verify listener" do
23
- @target = shell {
24
- composite {
25
- @text = text {
26
- text "Howdy"
27
- on_verify_text do |verify_event|
28
- verify_event.doit = false if verify_event.text == "Hello"
29
- end
30
- }
31
- }
32
- }
33
-
34
- @text.widget.setText("Hi")
35
- expect(@text.widget.getText).to eq("Hi")
36
-
37
- @text.widget.setText("Hello")
38
- expect(@text.widget.getText).to eq("Hi")
39
- end
40
-
41
- def test_button_widget_selection_listener
42
- person = Person.new
43
- person.name = "Bruce Ting"
44
-
45
- @target = shell {
46
- composite {
47
- @button = button {
48
- on_widget_selected do
49
- person.name = "Bruce Lao"
50
- end
51
- }
52
- }
53
- }
54
- expect(person.name).to eq("Bruce Ting")
55
- @button.widget.setSelection(true)
56
- @button.widget.notifyListeners(SWT::Selection, nil)
57
- expect(person.name).to eq("Bruce Lao")
58
- end
59
-
60
- end
@@ -1,89 +0,0 @@
1
- ## NOTE: Unsupported in Ruby 2 syntax
2
- # require "spec_helper"
3
- #
4
- # require_relative "../../lib/shine"
5
- #
6
- # describe "Glimmer Shine Data Binding" do
7
- # include Glimmer
8
- #
9
- # include_package 'org.eclipse.swt'
10
- # include_package 'org.eclipse.swt.widgets'
11
- # include_package 'org.eclipse.swt.layout'
12
- #
13
- # before do
14
- # dsl :swt
15
- # end
16
- #
17
- # after do
18
- # @target.display.dispose if @target.display
19
- # end
20
- #
21
- # class Person
22
- # attr_accessor :name, :age, :adult
23
- # end
24
- #
25
- # it "tests text_widget_data_binding_string_property_spaceship" do
26
- # person = Person.new
27
- # person.name = "Bruce Ting"
28
- #
29
- # @target = shell {
30
- # composite {
31
- # @text = text {
32
- # }
33
- # }
34
- # }
35
- #
36
- # [@text, :text] <=> [person, :name]
37
- #
38
- # expect(@text.widget.getText).to eq( "Bruce Ting")
39
- #
40
- # person.name = "Lady Butterfly"
41
- # expect(@text.widget.getText).to eq( "Lady Butterfly")
42
- #
43
- # @text.widget.setText("Allen Cork")
44
- # expect(person.name).to eq( "Allen Cork")
45
- #
46
- # comparison = ["he"] <=> ["he"]
47
- # expect(comparison).to eq(0)
48
- # end
49
- #
50
- # it "tests multiple_widget_data_bindings_to_different_model_properties_spaceship" do
51
- # person = Person.new
52
- # person.name = "Nancy"
53
- # person.age = 15
54
- # person.adult = true
55
- #
56
- # @target = shell {
57
- # composite {
58
- # @label = label {}
59
- # @text = text {}
60
- # @check_box = button(:check) {}
61
- # }
62
- # }
63
- #
64
- # [@label, :text] <=> [person, :name]
65
- # [@text, :text] <=> [person, :age, :fixnum]
66
- # [@check_box, :selection] <=> [person, :adult]
67
- #
68
- # expect(@label.widget.getText).to eq( "Nancy")
69
- # expect(@text.widget.getText).to eq( "15")
70
- # expect(@check_box.widget.getSelection).to eq( true)
71
- #
72
- # person.name = "Drew"
73
- # expect(@label.widget.getText).to eq( "Drew")
74
- #
75
- # person.age = 27
76
- # expect(@text.widget.getText).to eq( "27")
77
- #
78
- # person.adult = false
79
- # expect(@check_box.widget.getSelection).to eq( false)
80
- #
81
- # @text.widget.setText("30")
82
- # expect(person.age).to eq( 30)
83
- #
84
- # @check_box.widget.setSelection(true)
85
- # @check_box.widget.notifyListeners(SWT::Selection, nil)
86
- # expect(person.adult).to eq( true)
87
- # end
88
- #
89
- # end
@@ -1,55 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Glimmer Tab Item" do
4
- include Glimmer
5
-
6
- before do
7
- dsl :swt
8
- end
9
-
10
- after do
11
- @target.display.dispose if @target.display
12
- end
13
-
14
- it "tests tab item composite with default layout" do
15
- @target = shell {
16
- @tab_folder = tab_folder {
17
- @tab_item_composite = tab_item {
18
- text "Tab 1"
19
- label {text "Hello"}
20
- }
21
- }
22
- }
23
-
24
- expect(@target).to_not be_nil
25
- expect(@target.widget).to_not be_nil
26
- expect(@tab_folder.widget.items.size).to eq(1)
27
- expect(@tab_item_composite.widget).to be_instance_of(org.eclipse.swt.widgets.Composite)
28
- expect(@tab_folder.widget.items[0].control).to eq(@tab_item_composite.widget)
29
- expect(@tab_item_composite.tab_item.widget.text).to eq("Tab 1")
30
- expect(@tab_item_composite.widget.getLayout).to_not be_nil
31
- expect(@tab_item_composite.widget.getLayout).to be_instance_of(org.eclipse.swt.layout.GridLayout)
32
- end
33
-
34
- it "tests tab item composite with fill layout" do
35
- @target = shell {
36
- @tab_folder = tab_folder {
37
- @tab_item_composite = tab_item {
38
- text "Tab 2"
39
- layout org.eclipse.swt.layout.FillLayout.new
40
- label {text "Hello"}
41
- }
42
- }
43
- }
44
-
45
- expect(@target).to_not be_nil
46
- expect(@target.widget).to_not be_nil
47
- expect(@tab_folder.widget.items.size).to eq(1)
48
- expect(@tab_item_composite.widget).to be_instance_of(org.eclipse.swt.widgets.Composite)
49
- expect(@tab_folder.widget.items[0].control).to eq(@tab_item_composite.widget)
50
- expect(@tab_item_composite.tab_item.widget.text).to eq("Tab 2")
51
- expect(@tab_item_composite.widget.getLayout).to_not be_nil
52
- expect(@tab_item_composite.widget.getLayout).to be_instance_of(org.eclipse.swt.layout.FillLayout)
53
- end
54
-
55
- end
@@ -1,121 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Glimmer Table Data Binding" do
4
- include Glimmer
5
-
6
- include_package 'org.eclipse.swt'
7
- include_package 'org.eclipse.swt.widgets'
8
- include_package 'org.eclipse.swt.layout'
9
-
10
- before do
11
- dsl :swt
12
- end
13
-
14
- after do
15
- @target.display.dispose if @target.display
16
- end
17
-
18
- class Group
19
- def initialize
20
- @people = []
21
- end
22
-
23
- attr_accessor :people
24
- end
25
-
26
- class Person
27
- attr_accessor :name, :age, :adult
28
- end
29
-
30
- it "data binds text widget to a string property" do
31
- person1 = Person.new
32
- person1.name = "Bruce Ting"
33
- person1.age = 45
34
- person1.adult = true
35
-
36
- person2 = Person.new
37
- person2.name = "Julia Fang"
38
- person2.age = 17
39
- person2.adult = false
40
-
41
- group = Group.new
42
- group.people << person1
43
- group.people << person2
44
-
45
- @target = shell {
46
- @table = table {
47
- table_column {
48
- text "Name"
49
- width 120
50
- }
51
- table_column {
52
- text "Age"
53
- width 120
54
- }
55
- table_column {
56
- text "Adult"
57
- width 120
58
- }
59
- items bind(group, :people), column_properties(:name, :age, :adult)
60
- }
61
- }
62
-
63
- expect(@table.widget.getColumnCount).to eq(3)
64
- expect(@table.widget.getItems.size).to eq(2)
65
-
66
- expect(@table.widget.getItems[0].getText(0)).to eq("Bruce Ting")
67
- expect(@table.widget.getItems[0].getText(1)).to eq("45")
68
- expect(@table.widget.getItems[0].getText(2)).to eq("true")
69
-
70
- expect(@table.widget.getItems[1].getText(0)).to eq("Julia Fang")
71
- expect(@table.widget.getItems[1].getText(1)).to eq("17")
72
- expect(@table.widget.getItems[1].getText(2)).to eq("false")
73
-
74
- person3 = Person.new
75
- person3.name = "Andrea Shingle"
76
- person3.age = 23
77
- person3.adult = true
78
-
79
- group.people << person3
80
-
81
- expect(@table.widget.getItems.size).to eq(3)
82
- expect(@table.widget.getItems[2].getText(0)).to eq("Andrea Shingle")
83
- expect(@table.widget.getItems[2].getText(1)).to eq("23")
84
- expect(@table.widget.getItems[2].getText(2)).to eq("true")
85
-
86
- group.people.delete person2
87
-
88
- expect(@table.widget.getItems.size).to eq(2)
89
- expect(@table.widget.getItems[1].getText(0)).to eq("Andrea Shingle")
90
- expect(@table.widget.getItems[1].getText(1)).to eq("23")
91
- expect(@table.widget.getItems[1].getText(2)).to eq("true")
92
-
93
- group.people.delete_at(0)
94
-
95
- expect(@table.widget.getItems.size).to eq(1)
96
- expect(@table.widget.getItems[0].getText(0)).to eq("Andrea Shingle")
97
- expect(@table.widget.getItems[0].getText(1)).to eq("23")
98
- expect(@table.widget.getItems[0].getText(2)).to eq("true")
99
-
100
- group.people.clear
101
-
102
- expect(0).to eq(@table.widget.getItems.size)
103
-
104
- group.people = [person2, person1]
105
-
106
- expect(2).to eq(@table.widget.getItems.size)
107
-
108
- expect(@table.widget.getItems[0].getText(0)).to eq("Julia Fang")
109
- expect(@table.widget.getItems[0].getText(1)).to eq("17")
110
- expect(@table.widget.getItems[0].getText(2)).to eq("false")
111
-
112
- expect(@table.widget.getItems[1].getText(0)).to eq("Bruce Ting")
113
- expect(@table.widget.getItems[1].getText(1)).to eq("45")
114
- expect(@table.widget.getItems[1].getText(2)).to eq("true")
115
-
116
- person1.name = "Bruce Flee"
117
-
118
- expect(@table.widget.getItems[1].getText(0)).to eq("Bruce Flee")
119
- end
120
-
121
- end