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,113 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Glimmer Tree 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 && @target.display
16
- end
17
-
18
- class Person
19
- attr_accessor :name, :age, :adult, :people
20
- end
21
-
22
- class Manager < Person
23
- def initialize
24
- @people = []
25
- end
26
-
27
- attr_accessor :people
28
- end
29
-
30
- class Company
31
- def initialize
32
- @owner = []
33
- end
34
-
35
- attr_accessor :owner
36
- end
37
-
38
- it "data binds text widget to a string property" do
39
- person1 = Person.new
40
- person1.name = "Bruce Ting"
41
- person1.age = 45
42
- person1.adult = true
43
-
44
- person2 = Person.new
45
- person2.name = "Julia Fang"
46
- person2.age = 17
47
- person2.adult = false
48
-
49
- manager = Manager.new
50
- manager.name = "Tim Harkins"
51
- manager.age = 79
52
- manager.adult = true
53
- manager.people << person1
54
- manager.people << person2
55
-
56
- company = Company.new
57
- company.owner = manager
58
-
59
- @target = shell {
60
- @tree = tree(:virtual, :border) {
61
- items bind(company, :owner), tree_properties(children: :people, text: :name)
62
- }
63
- }
64
-
65
- expect(@tree.widget.getItems.size).to eq(1)
66
-
67
- rootNode = @tree.widget.getItems[0]
68
- expect(rootNode.getText()).to eq("Tim Harkins")
69
-
70
- expect(rootNode.getItems.size).to eq(2)
71
- node1 = rootNode.getItems[0]
72
- node2 = rootNode.getItems[1]
73
- expect(node1.getText()).to eq("Bruce Ting")
74
- expect(node2.getText()).to eq("Julia Fang")
75
-
76
- manager.name = "Tim Lee Harkins"
77
-
78
- rootNode = @tree.widget.getItems[0]
79
- expect(rootNode.getText()).to eq("Tim Lee Harkins")
80
-
81
- person1.name = "Bruce A. Ting"
82
- node1 = @tree.widget.getItems.first.getItems.first
83
- expect(node1.getText()).to eq("Bruce A. Ting")
84
-
85
- person2.name = "Julia Katherine Fang"
86
- node2 = @tree.widget.getItems.first.getItems.last
87
- expect(node2.getText()).to eq("Julia Katherine Fang")
88
-
89
- person3 = Person.new
90
- person3.name = "Bob David Kennith"
91
- person3.age = 37
92
- person3.adult = true
93
-
94
- manager.people << person3
95
- manager.people = manager.people
96
-
97
- rootNode = @tree.widget.getItems.first
98
- expect(rootNode.getItems.size).to eq(3)
99
- node3 = rootNode.getItems.last
100
- expect(node3.getText()).to eq("Bob David Kennith")
101
-
102
- manager.people.delete_at(0)
103
-
104
- rootNode = @tree.widget.getItems.first
105
- expect(rootNode.getItems.size).to eq(2)
106
- node1 = rootNode.getItems.first
107
- node2 = rootNode.getItems.last
108
- expect(node1.getText()).to eq("Julia Katherine Fang")
109
- expect(node2.getText()).to eq("Bob David Kennith")
110
-
111
- end
112
-
113
- end
@@ -1,251 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Glimmer 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
- include_package 'org.eclipse.swt.graphics'
10
-
11
- Shell = org.eclipse.swt.widgets.Shell unless Object.const_defined?(:Shell)
12
- Composite = org.eclipse.swt.widgets.Composite unless Object.const_defined?(:Composite)
13
- Text = org.eclipse.swt.widgets.Text unless Object.const_defined?(:Text)
14
- Spinner = org.eclipse.swt.widgets.Spinner unless Object.const_defined?(:Spinner)
15
- List = org.eclipse.swt.widgets.List unless Object.const_defined?(:List)
16
- Button = org.eclipse.swt.widgets.Button unless Object.const_defined?(:Button)
17
- Group = org.eclipse.swt.widgets.Group unless Object.const_defined?(:Group)
18
-
19
- GridLayout = org.eclipse.swt.layout.GridLayout unless Object.const_defined?(:GridLayout)
20
- FillLayout = org.eclipse.swt.layout.FillLayout unless Object.const_defined?(:FillLayout)
21
- RowLayout = org.eclipse.swt.layout.RowLayout unless Object.const_defined?(:RowLayout)
22
-
23
- Rectangle = org.eclipse.swt.graphics.Rectangle unless Object.const_defined?(:Rectangle)
24
- Point = org.eclipse.swt.graphics.Point unless Object.const_defined?(:Point)
25
-
26
- before do
27
- @target = nil
28
- dsl :swt
29
- end
30
-
31
- after do
32
- @target.display.dispose if @target.display
33
- end
34
-
35
- it "tests shell_with_default_layout" do
36
- @target = shell
37
-
38
- expect(@target).to_not be_nil
39
- expect(@target.widget).to_not be_nil
40
- expect(@target.widget).to be_instance_of(Shell)
41
- expect(@target.widget.getLayout).to_not be_nil
42
- expect(@target.widget.getLayout).to be_instance_of(FillLayout)
43
- end
44
-
45
- it "tests shell_with_title_and_layout" do
46
- shell_layout = GridLayout.new
47
- @target = shell {
48
- text "Title"
49
- layout shell_layout
50
- }
51
-
52
- expect(@target.widget.getText).to eq( "Title")
53
- expect(@target.widget.getLayout).to eq( shell_layout)
54
- end
55
-
56
- it "tests shell_with_bounds" do
57
- @target = shell {
58
- bounds 50, 75, 800, 600
59
- }
60
-
61
- expect(@target.widget.getBounds).to eq( Rectangle.new(50, 75, 800, 600) )
62
- end
63
-
64
- it "tests shell_with_size" do
65
- @target = shell {
66
- size 800, 600
67
- }
68
-
69
- expect(@target.widget.getSize).to eq( Point.new(800, 600) )
70
- end
71
-
72
- it "tests shell_and_composite_with_default_style_and_layout" do
73
- @target = shell {
74
- composite
75
- }
76
-
77
- expect(@target.widget.children.size).to eq( 1)
78
- expect(@target.widget.children[0]).to be_instance_of(Composite)
79
- composite_widget = @target.widget.children[0]
80
- expect(composite_widget).to have_style(:none)
81
- expect(composite_widget.getLayout).to be_instance_of(GridLayout)
82
- grid_layout = composite_widget.getLayout
83
- expect(grid_layout.numColumns).to eq( 1)
84
- expect(grid_layout.makeColumnsEqualWidth).to eq( false)
85
- end
86
-
87
- it "tests shell_and_group_with_default_style_and_layout" do
88
- @target = shell {
89
- group {
90
- text "Title"
91
- }
92
- }
93
-
94
- expect(@target.widget.children.size).to eq( 1)
95
- expect(@target.widget.children[0]).to be_instance_of(Java::OrgEclipseSwtWidgets::Group)
96
- group_widget = @target.widget.children[0]
97
- expect(group_widget).to have_style(:none)
98
- expect(group_widget.getLayout).to be_instance_of(GridLayout)
99
- grid_layout = group_widget.getLayout
100
- expect(grid_layout.numColumns).to eq( 1)
101
- expect(grid_layout.makeColumnsEqualWidth).to eq( false)
102
- expect(group_widget.getText).to eq( "Title")
103
- end
104
-
105
- it "tests shell_and_composite_with_style_and_layout" do
106
- composite_layout = RowLayout.new
107
- @target = shell {
108
- composite(:no_focus) {
109
- layout composite_layout
110
- }
111
- }
112
-
113
- expect(@target.widget.children.size).to eq( 1)
114
- expect(@target.widget.children[0]).to be_instance_of(Composite)
115
- composite_widget = @target.widget.children[0]
116
- expect(composite_widget).to have_style(:no_focus)
117
- expect(composite_widget.getLayout).to eq( composite_layout)
118
- end
119
-
120
- it "tests shell_and_composite_and_text_with_default_style" do
121
- @target = shell {
122
- composite {
123
- text
124
- }
125
- }
126
-
127
- composite_widget = @target.widget.children[0]
128
- expect(composite_widget.children.size).to eq( 1)
129
- expect(composite_widget.children[0]).to be_instance_of(Text)
130
- text_widget = composite_widget.children[0]
131
- expect(text_widget).to have_style(:border)
132
- end
133
-
134
- it "tests shell_and_composite_with_custom_layout_and_text_with_default_style" do
135
- composite_layout = RowLayout.new
136
- @target = shell {
137
- composite {
138
- text
139
- layout composite_layout
140
- }
141
- }
142
-
143
- composite_widget = @target.widget.children[0]
144
- expect(composite_widget.getLayout).to eq( composite_layout)
145
- expect(composite_widget.children.size).to eq( 1)
146
- expect(composite_widget.children[0]).to be_instance_of(Text)
147
- text_widget = composite_widget.children[0]
148
- expect(text_widget).to have_style(:border)
149
- end
150
-
151
- it "tests shell_and_composite_and_text_with_style_and_text" do
152
- @target = shell {
153
- composite {
154
- text(:password) {
155
- text "Hello"
156
- }
157
- }
158
- }
159
-
160
- composite_widget = @target.widget.children[0]
161
- expect(composite_widget.children.size).to eq( 1)
162
- expect(composite_widget.children[0]).to be_instance_of(Text)
163
- text_widget = composite_widget.children[0]
164
- expect(text_widget).to have_style(:password)
165
- expect(text_widget.getText).to eq( "Hello")
166
- end
167
-
168
- it "tests shell_and_spinner_default" do
169
- @target = shell {
170
- @spinner = spinner {
171
- selection 55
172
- }
173
- }
174
-
175
- expect(@spinner.widget).to be_instance_of(Spinner)
176
- expect(@spinner.widget).to have_style(:border)
177
- expect(@spinner.widget.getSelection).to eq( 55)
178
- end
179
-
180
- it "tests shell_and_list_default" do
181
- @target = shell {
182
- @list = list {
183
- }
184
- }
185
-
186
- expect(@list.widget).to be_instance_of(List)
187
- expect(@list.widget).to have_style(:border)
188
- expect(@list.widget).to have_style(:single)
189
- expect(@list.widget).to have_style(:v_scroll)
190
- end
191
-
192
- it "tests shell_and_button_default" do
193
- @target = shell {
194
- @button = button {
195
- text "Push Me"
196
- }
197
- }
198
-
199
- expect(@button.widget).to be_instance_of(Button)
200
- expect(@button.widget).to have_style(:push)
201
- expect(@button.widget.text).to eq( "Push Me")
202
- end
203
-
204
- it "tests shell_and_table_and_table_column_defaults" do
205
- @target = shell {
206
- @table = table {
207
- @table_column = table_column
208
- }
209
- }
210
-
211
- expect(@table.widget).to have_style(:border)
212
- assert @table.widget.getHeaderVisible
213
- assert @table.widget.getLinesVisible
214
- expect(@table_column.widget.getWidth).to eq( 80)
215
- end
216
-
217
- it "tests shell_containing_undefined_command" do
218
- @target = shell {
219
- undefined_command(:undefined_parameter) {
220
- }
221
- }
222
-
223
- expect(@target).to_not be_nil
224
- expect(@target.widget).to_not be_nil
225
- expect(@target.widget).to be_instance_of(Shell)
226
- expect(@target.widget.getLayout).to_not be_nil
227
- expect(@target.widget.getLayout).to be_instance_of(FillLayout)
228
- end
229
-
230
-
231
- it "tests add_contents" do
232
- @target = shell {
233
- }
234
-
235
- add_contents(@target) {
236
- composite {
237
- text(:password) {
238
- text "Hello"
239
- }
240
- }
241
- }
242
-
243
- composite_widget = @target.widget.children[0]
244
- expect(composite_widget.children.size).to eq( 1)
245
- expect(composite_widget.children[0]).to be_instance_of(Text)
246
- text_widget = composite_widget.children[0]
247
- expect(text_widget).to have_style(:password)
248
- expect(text_widget.getText).to eq( "Hello")
249
- end
250
-
251
- end
@@ -1,154 +0,0 @@
1
- require "spec_helper"
2
- # require_relative "../../lib/parent"
3
-
4
- describe "Glimmer Xml" do
5
- include Glimmer
6
-
7
- before do
8
- dsl :xml
9
- end
10
-
11
- it "tests single html tag" do
12
- @target = html
13
-
14
- assert_not_nil @target
15
- expect(@target.to_xml).to eq("<html/>")
16
- end
17
-
18
- it "tests single document tag upper case" do
19
- @target = tag(:_name => "DOCUMENT")
20
-
21
- assert_not_nil @target
22
- expect(@target.to_xml).to eq("<DOCUMENT/>")
23
- end
24
-
25
- it "tests open and closed html tag" do
26
- @target = html {}
27
-
28
- assert_not_nil @target
29
- expect(@target.to_xml).to eq("<html></html>")
30
- end
31
-
32
- it "tests open and closed html tag with contents" do
33
- @target = html { "This is an HTML Document" }
34
-
35
- assert_not_nil @target
36
- expect(@target.to_xml).to eq("<html>This is an HTML Document</html>")
37
- end
38
-
39
- it "tests open and closed html tag with attributes" do
40
- @target = html(:id => "thesis", :class => "document") {
41
- }
42
-
43
- assert_not_nil @target
44
- expect(@target.to_xml).to eq('<html id="thesis" class="document"></html>')
45
- end
46
-
47
- it "tests open and closed html tag with attributes and nested body with attributes" do
48
- @target = html(:id => "thesis", :class => "document") {
49
- body(:id => "main") {
50
- }
51
- }
52
-
53
- assert_not_nil @target
54
- expect(@target.to_xml).to eq('<html id="thesis" class="document"><body id="main"></body></html>')
55
- end
56
-
57
- it "tests tag with contents before and after nested tag" do
58
- @target = html(:id => "thesis", :class => "document") {
59
- text "Before body"
60
- body(:id => "main") {
61
- }
62
- text "When a string is the last part of the tag contents, text prefix is optional"
63
- }
64
-
65
- assert_not_nil @target
66
- expect(@target.to_xml).to eq('<html id="thesis" class="document">Before body<body id="main"></body>When a string is the last part of the tag contents, text prefix is optional</html>')
67
- end
68
-
69
- it "tests different name spaced tags" do
70
- @target = w3c.html(:id => "thesis", :class => "document") {
71
- document.body(:id => "main") {
72
- }
73
- }
74
-
75
- assert_not_nil @target
76
- expect(@target.to_xml).to eq('<w3c:html id="thesis" class="document"><document:body id="main"></document:body></w3c:html>')
77
- end
78
-
79
- it "tests different name spaced attributes and tags" do
80
- @target = w3c.html(w3c.id => "thesis", :class => "document") {
81
- document.body(document.id => "main") {
82
- }
83
- }
84
-
85
- assert_not_nil @target
86
- expect(@target.to_xml).to eq('<w3c:html w3c:id="thesis" class="document"><document:body document:id="main"></document:body></w3c:html>')
87
- end
88
-
89
- it "tests name space context" do
90
- @target = name_space(:w3c) {
91
- html(:id => "thesis", :class => "document") {
92
- body(:id => "main") {
93
- }
94
- }
95
- }
96
-
97
- assert_not_nil @target
98
- expect(@target.to_xml).to eq('<w3c:html id="thesis" class="document"><w3c:body id="main"></w3c:body></w3c:html>')
99
- end
100
-
101
- it "tests two name space contexts" do
102
- @target = name_space(:w3c) {
103
- html(:id => "thesis", :class => "document") {
104
- name_space(:document) {
105
- sectionDivider(:id => "main") {
106
- }
107
- }
108
- }
109
- }
110
-
111
- assert_not_nil @target
112
- expect(@target.to_xml).to eq('<w3c:html id="thesis" class="document"><document:sectionDivider id="main"></document:sectionDivider></w3c:html>')
113
- end
114
-
115
- it "tests two name space contexts including contents" do
116
- @target = name_space(:w3c) {
117
- html(:id => "thesis", :class => "document") {
118
- text "before section divider"
119
- name_space(:document) {
120
- sectionDivider(:id => "main") {
121
- "section divider"
122
- }
123
- }
124
- text "after section divider"
125
- }
126
- }
127
-
128
- assert_not_nil @target
129
- expect(@target.to_xml).to eq('<w3c:html id="thesis" class="document">before section divider<document:sectionDivider id="main">section divider</document:sectionDivider>after section divider</w3c:html>')
130
- end
131
-
132
- it "tests mixed contents custom syntax" do
133
- @target = html{"before section divider#strong{section divider}after section divider"}
134
-
135
- assert_not_nil @target
136
- expect(@target.to_xml).to eq('<html>before section divider<strong>section divider</strong>after section divider</html>')
137
- end
138
-
139
- #TODO handle special characters such as #, {, }, and .
140
- #TODO CDATA support
141
- #TODO encode special characters
142
-
143
- it "tests html alternative syntax for id and class attributes" do
144
- @target = html_thesis_document {
145
- body_main {
146
- h1__title
147
- }
148
- }
149
-
150
- assert_not_nil @target
151
- expect(@target.to_xml).to eq('<html id="thesis" class="document"><body id="main"><h1 class="title" /></body></html>')
152
- end
153
-
154
- end