glimmer-dsl-swt 4.17.10.0 → 4.17.10.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +25 -24
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +9 -8
- data/lib/glimmer/data_binding/table_items_binding.rb +8 -9
- data/lib/glimmer/data_binding/tree_items_binding.rb +7 -7
- data/lib/glimmer/launcher.rb +9 -9
- data/lib/glimmer/swt/styled_text_proxy.rb +8 -13
- data/lib/glimmer/swt/table_proxy.rb +14 -14
- data/lib/glimmer/swt/widget_proxy.rb +34 -14
- data/samples/hello/hello_button.rb +46 -0
- data/samples/hello/hello_table.rb +0 -4
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 811cbe738d6049291f6f00f32234ebef5af6d334009136314a309bf96807d863
|
4
|
+
data.tar.gz: f2618026dc2b90cd076a75ffde44334aac013dc412afd23368cc0f072c4b5ed5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad40ab20b33c48f575ac525b88e1c6c3fd38a5db937416afa748b6d4700f0b0930a3dbf000b69c3ac03cbdc092510762aeacc8a1588616679db6a783ce26fbfc
|
7
|
+
data.tar.gz: 6bc20ea164c4fda7e35e5400ceb6e864205dc6be59eefc98a296f3df3fd795594b2f054988cbdd55ac6d0bbf555546dfdcad8231906a810ef099212420749aae
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.17.10.5
|
4
|
+
|
5
|
+
- Hello, Button! Sample
|
6
|
+
|
7
|
+
### 4.17.10.4
|
8
|
+
|
9
|
+
- Do not select first row in a table by default (keep unselected)
|
10
|
+
- Prevented extra call to model data in table items data-binding
|
11
|
+
- Upgraded to glimmer v1.0.5
|
12
|
+
|
13
|
+
### 4.17.10.3
|
14
|
+
|
15
|
+
- Fixed issue in StyledText data-binding relating to capturing selection changes on mouse click
|
16
|
+
|
17
|
+
### 4.17.10.2
|
18
|
+
|
19
|
+
- Upgraded glimmer gem to version 1.0.4
|
20
|
+
- Fixed issues relating to data-binding `styled_text` widget
|
21
|
+
|
22
|
+
### 4.17.10.1
|
23
|
+
|
24
|
+
- Upgraded glimmer gem to version 1.0.3
|
25
|
+
- Upgraded rouge gem to version 3.25.0
|
26
|
+
|
3
27
|
### 4.17.10.0
|
4
28
|
|
5
29
|
- Support table editing via `date_time` for date/time values
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.17.10.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.17.10.5
|
2
2
|
|
3
|
-
## JRuby Desktop Development GUI
|
3
|
+
## JRuby Desktop Development GUI Framework
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
5
5
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
6
6
|
[![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer-dsl-swt/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer-dsl-swt?branch=master)
|
@@ -61,8 +61,6 @@ Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObt
|
|
61
61
|
|
62
62
|
```ruby
|
63
63
|
# ...
|
64
|
-
@tic_tac_toe_board = Board.new
|
65
|
-
|
66
64
|
@shell = shell {
|
67
65
|
text "Tic-Tac-Toe"
|
68
66
|
minimum_size 150, 178
|
@@ -83,11 +81,6 @@ Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObt
|
|
83
81
|
}
|
84
82
|
}
|
85
83
|
}
|
86
|
-
|
87
|
-
observe(@tic_tac_toe_board, :game_status) { |game_status|
|
88
|
-
display_win_message if game_status == Board::WIN
|
89
|
-
display_draw_message if game_status == Board::DRAW
|
90
|
-
}
|
91
84
|
# ...
|
92
85
|
```
|
93
86
|
|
@@ -238,7 +231,7 @@ Glimmer App:
|
|
238
231
|
|
239
232
|
## Table of contents
|
240
233
|
|
241
|
-
- [Glimmer (
|
234
|
+
- [Glimmer (JRuby Desktop Development GUI Framework)](#jruby-desktop-development-gui-framework)
|
242
235
|
- [Examples](#examples)
|
243
236
|
- [Hello, World!](#hello-world)
|
244
237
|
- [Tic Tac Toe](#tic-tac-toe)
|
@@ -353,7 +346,6 @@ Glimmer App:
|
|
353
346
|
- [Hello, Expand Bar!](#hello-expand-bar)
|
354
347
|
- [Hello, Radio!](#hello-radio)
|
355
348
|
- [Hello, Radio Group!](#hello-radio-group)
|
356
|
-
- [Hello, Checkbox!](#hello-checkbox)
|
357
349
|
- [Hello, Group!](#hello-group)
|
358
350
|
- [Hello, Checkbox!](#hello-checkbox)
|
359
351
|
- [Hello, Checkbox Group!](#hello-checkbox-group)
|
@@ -362,6 +354,7 @@ Glimmer App:
|
|
362
354
|
- [Hello, Date Time!](#hello-date-time)
|
363
355
|
- [Hello, Spinner!](#hello-spinner)
|
364
356
|
- [Hello, Table!](#hello-table)
|
357
|
+
- [Hello, Button!](#hello-button)
|
365
358
|
- [Elaborate Samples](#elaborate-samples)
|
366
359
|
- [User Profile](#user-profile)
|
367
360
|
- [Login](#login)
|
@@ -455,7 +448,7 @@ jgem install glimmer-dsl-swt
|
|
455
448
|
|
456
449
|
Or this command if you want a specific version:
|
457
450
|
```
|
458
|
-
jgem install glimmer-dsl-swt -v 4.17.10.
|
451
|
+
jgem install glimmer-dsl-swt -v 4.17.10.5
|
459
452
|
|
460
453
|
```
|
461
454
|
|
@@ -532,7 +525,7 @@ bin/glimmer samples
|
|
532
525
|
Below are the full usage instructions that come up when running `glimmer` without args.
|
533
526
|
|
534
527
|
```
|
535
|
-
Glimmer (
|
528
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.17.10.5
|
536
529
|
|
537
530
|
|
538
531
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
@@ -710,7 +703,7 @@ glimmer bin/greeter
|
|
710
703
|
|
711
704
|
#### Desktopify
|
712
705
|
|
713
|
-
|
706
|
+
Desktopify basically turns a website into a desktop application by wrapping the website within a [Browser Widget](#browser-widget).
|
714
707
|
|
715
708
|
The desktopify app is similar to the standard scaffolded app. It can be extended and the [browser may even be instrumented](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/browser/Browser.html).
|
716
709
|
|
@@ -1010,7 +1003,7 @@ Output:
|
|
1010
1003
|
|
1011
1004
|
Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
|
1012
1005
|
Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
|
1013
|
-
Swt glimmer-dsl-swt 4.17.10.
|
1006
|
+
Swt glimmer-dsl-swt 4.17.10.5
|
1014
1007
|
AndyMaleh Glimmer DSL for SWT
|
1015
1008
|
Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
|
1016
1009
|
Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
|
@@ -3874,14 +3867,6 @@ Hello, Radio Group!
|
|
3874
3867
|
|
3875
3868
|
![Hello Radio Group](images/glimmer-hello-radio-group.png)
|
3876
3869
|
|
3877
|
-
#### Hello, Checkbox!
|
3878
|
-
|
3879
|
-
This sample demonstrates the use of a `checkbox` (aka `check` or `button(:check)`) in Glimmer.
|
3880
|
-
|
3881
|
-
Code:
|
3882
|
-
|
3883
|
-
[samples/hello/hello_checkbox.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_checkbox.rb)
|
3884
|
-
|
3885
3870
|
#### Hello, Group!
|
3886
3871
|
|
3887
3872
|
This sample demonstrates the use of a `group` in Glimmer (not to be confused with the logical radio group custom widget, this is just an alternative to `composite` that provides a border around content).
|
@@ -4030,6 +4015,22 @@ Hello, Table! Context Menu
|
|
4030
4015
|
|
4031
4016
|
![Hello Table](images/glimmer-hello-table-context-menu.png)
|
4032
4017
|
|
4018
|
+
#### Hello, Button!
|
4019
|
+
|
4020
|
+
This sample demonstrates the use of `button` widget in Glimmer, including data-binding and click event triggering via `on_widget_selected`.
|
4021
|
+
|
4022
|
+
Code:
|
4023
|
+
|
4024
|
+
[samples/hello/hello_button.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_button.rb)
|
4025
|
+
|
4026
|
+
Hello, Button!
|
4027
|
+
|
4028
|
+
![Hello Button](images/glimmer-hello-button.png)
|
4029
|
+
|
4030
|
+
Hello, Button! Incremented 7 times!
|
4031
|
+
|
4032
|
+
![Hello Button Incremented](images/glimmer-hello-button-incremented.png)
|
4033
|
+
|
4033
4034
|
### Elaborate Samples
|
4034
4035
|
|
4035
4036
|
For more elaborate samples, check the following:
|
@@ -4423,4 +4424,4 @@ Copyright (c) 2007-2020 - Andy Maleh.
|
|
4423
4424
|
|
4424
4425
|
--
|
4425
4426
|
|
4426
|
-
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (
|
4427
|
+
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (DSL Framework).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.17.10.
|
1
|
+
4.17.10.5
|
data/glimmer-dsl-swt.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer-dsl-swt 4.17.10.
|
5
|
+
# stub: glimmer-dsl-swt 4.17.10.5 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-dsl-swt".freeze
|
9
|
-
s.version = "4.17.10.
|
9
|
+
s.version = "4.17.10.5"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["AndyMaleh".freeze]
|
14
|
-
s.date = "2020-
|
15
|
-
s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI
|
14
|
+
s.date = "2020-12-09"
|
15
|
+
s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.executables = ["glimmer".freeze, "girb".freeze]
|
18
18
|
s.extra_rdoc_files = [
|
@@ -131,6 +131,7 @@ Gem::Specification.new do |s|
|
|
131
131
|
"samples/elaborate/tic_tac_toe/cell.rb",
|
132
132
|
"samples/elaborate/user_profile.rb",
|
133
133
|
"samples/hello/hello_browser.rb",
|
134
|
+
"samples/hello/hello_button.rb",
|
134
135
|
"samples/hello/hello_checkbox.rb",
|
135
136
|
"samples/hello/hello_checkbox_group.rb",
|
136
137
|
"samples/hello/hello_combo.rb",
|
@@ -172,7 +173,7 @@ Gem::Specification.new do |s|
|
|
172
173
|
end
|
173
174
|
|
174
175
|
if s.respond_to? :add_runtime_dependency then
|
175
|
-
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.
|
176
|
+
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.5"])
|
176
177
|
s.add_runtime_dependency(%q<super_module>.freeze, ["~> 1.4.1"])
|
177
178
|
s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["~> 0.3.0"])
|
178
179
|
s.add_runtime_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.2"])
|
@@ -182,7 +183,7 @@ Gem::Specification.new do |s|
|
|
182
183
|
s.add_runtime_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
|
183
184
|
s.add_runtime_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
184
185
|
s.add_runtime_dependency(%q<text-table>.freeze, [">= 1.2.4", "< 2.0.0"])
|
185
|
-
s.add_runtime_dependency(%q<rouge>.freeze, [">= 3.
|
186
|
+
s.add_runtime_dependency(%q<rouge>.freeze, [">= 3.25.0", "< 4.0.0"])
|
186
187
|
s.add_development_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0.0"])
|
187
188
|
s.add_development_dependency(%q<warbler>.freeze, [">= 2.0.5", "< 3.0.0"])
|
188
189
|
s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
@@ -191,7 +192,7 @@ Gem::Specification.new do |s|
|
|
191
192
|
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
192
193
|
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
193
194
|
else
|
194
|
-
s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.
|
195
|
+
s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.5"])
|
195
196
|
s.add_dependency(%q<super_module>.freeze, ["~> 1.4.1"])
|
196
197
|
s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["~> 0.3.0"])
|
197
198
|
s.add_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.2"])
|
@@ -201,7 +202,7 @@ Gem::Specification.new do |s|
|
|
201
202
|
s.add_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
|
202
203
|
s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
203
204
|
s.add_dependency(%q<text-table>.freeze, [">= 1.2.4", "< 2.0.0"])
|
204
|
-
s.add_dependency(%q<rouge>.freeze, [">= 3.
|
205
|
+
s.add_dependency(%q<rouge>.freeze, [">= 3.25.0", "< 4.0.0"])
|
205
206
|
s.add_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0.0"])
|
206
207
|
s.add_dependency(%q<warbler>.freeze, [">= 2.0.5", "< 3.0.0"])
|
207
208
|
s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
@@ -38,16 +38,16 @@ module Glimmer
|
|
38
38
|
@model_binding = model_binding
|
39
39
|
@table.swt_widget.data = @model_binding
|
40
40
|
@column_properties = column_properties
|
41
|
+
@table.on_widget_disposed do |dispose_event|
|
42
|
+
unregister_all_observables
|
43
|
+
end
|
41
44
|
if @table.respond_to?(:column_properties=)
|
42
45
|
@table.column_properties = @column_properties
|
43
46
|
else # assume custom widget
|
44
47
|
@table.body_root.column_properties = @column_properties
|
45
48
|
end
|
46
|
-
call(@model_binding.evaluate_property)
|
47
49
|
@table_observer_registration = observe(model_binding)
|
48
|
-
|
49
|
-
unregister_all_observables
|
50
|
-
end
|
50
|
+
call
|
51
51
|
end
|
52
52
|
|
53
53
|
def call(new_model_collection=nil)
|
@@ -65,7 +65,7 @@ module Glimmer
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def populate_table(model_collection, parent, column_properties)
|
68
|
-
selected_table_item_models = parent.swt_widget.getSelection.map(&:
|
68
|
+
selected_table_item_models = parent.swt_widget.getSelection.map(&:get_data)
|
69
69
|
parent.finish_edit!
|
70
70
|
parent.swt_widget.items.each(&:dispose)
|
71
71
|
parent.swt_widget.removeAll
|
@@ -74,11 +74,10 @@ module Glimmer
|
|
74
74
|
for index in 0..(column_properties.size-1)
|
75
75
|
table_item.setText(index, model.send(column_properties[index]).to_s)
|
76
76
|
end
|
77
|
-
table_item.
|
77
|
+
table_item.set_data(model)
|
78
78
|
end
|
79
|
-
selected_table_items = parent.search {|item| selected_table_item_models.include?(item.
|
80
|
-
|
81
|
-
parent.swt_widget.setSelection(selected_table_items) unless selected_table_items.empty?
|
79
|
+
selected_table_items = parent.search {|item| selected_table_item_models.include?(item.get_data) }
|
80
|
+
parent.swt_widget.setSelection(selected_table_items)
|
82
81
|
parent.sort!
|
83
82
|
parent.swt_widget.redraw if parent&.swt_widget&.respond_to?(:redraw)
|
84
83
|
end
|
@@ -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
|
@@ -69,7 +69,7 @@ module Glimmer
|
|
69
69
|
old_tree_item_expansion_by_data = old_tree_items.reduce({}) {|hash, ti| hash.merge(ti.getData => ti.getExpanded)}
|
70
70
|
old_tree_items.each do |tree_item|
|
71
71
|
tree_item.getData('observer_registrations').each(&:unregister)
|
72
|
-
end
|
72
|
+
end
|
73
73
|
parent.swt_widget.items.each(&:dispose)
|
74
74
|
parent.swt_widget.removeAll
|
75
75
|
populate_tree_node(model_tree_root_node, parent.swt_widget, tree_properties)
|
@@ -85,9 +85,9 @@ module Glimmer
|
|
85
85
|
array + [observe(model_tree_node, key_value_pair.last)]
|
86
86
|
end
|
87
87
|
|
88
|
-
tree_item.
|
89
|
-
tree_item.
|
90
|
-
tree_item.
|
88
|
+
tree_item.set_data('observer_registrations', observer_registrations)
|
89
|
+
tree_item.set_data(model_tree_node)
|
90
|
+
tree_item.text = (model_tree_node && model_tree_node.send(tree_properties[:text])).to_s
|
91
91
|
[model_tree_node && model_tree_node.send(tree_properties[:children])].flatten.to_a.compact.each do |child|
|
92
92
|
populate_tree_node(child, tree_item, tree_properties)
|
93
93
|
end
|
data/lib/glimmer/launcher.rb
CHANGED
@@ -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
|
@@ -31,12 +31,12 @@ module Glimmer
|
|
31
31
|
OPERATING_SYSTEMS_SUPPORTED = ["mac", "windows", "linux"]
|
32
32
|
|
33
33
|
TEXT_USAGE = <<~MULTI_LINE_STRING
|
34
|
-
Glimmer (
|
34
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v#{File.read(File.expand_path('../../../VERSION', __FILE__))}
|
35
35
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
36
36
|
|
37
|
-
Runs Glimmer applications and tasks.
|
37
|
+
Runs Glimmer applications and tasks.
|
38
38
|
|
39
|
-
When applications are specified, they are run using JRuby,
|
39
|
+
When applications are specified, they are run using JRuby,
|
40
40
|
automatically preloading the glimmer Ruby gem and SWT jar dependency.
|
41
41
|
|
42
42
|
Optionally, extra Glimmer options, JRuby options, and/or environment variables may be passed in.
|
@@ -112,7 +112,7 @@ module Glimmer
|
|
112
112
|
def launch(application, jruby_options: [], env_vars: {}, glimmer_options: {})
|
113
113
|
jruby_options_string = jruby_options.join(' ') + ' ' if jruby_options.any?
|
114
114
|
env_vars = env_vars.merge(glimmer_option_env_vars(glimmer_options))
|
115
|
-
env_vars_string = env_vars.map do |k,v|
|
115
|
+
env_vars_string = env_vars.map do |k,v|
|
116
116
|
if OS.windows? && ENV['PROMPT'] # detect command prompt (or powershell)
|
117
117
|
"set #{k}=#{v} && "
|
118
118
|
else
|
@@ -224,8 +224,8 @@ module Glimmer
|
|
224
224
|
task_name = task.name_with_args.sub('glimmer:', '')
|
225
225
|
line = "glimmer #{task_name.ljust(max_task_size)} # #{task.comment}"
|
226
226
|
bound = TTY::Screen.width - 6
|
227
|
-
line.size <= bound ? line : "#{line[0..(bound - 3)]}..."
|
228
|
-
end
|
227
|
+
line.size <= bound ? line : "#{line[0..(bound - 3)]}..."
|
228
|
+
end
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
@@ -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
|
@@ -27,17 +27,12 @@ module Glimmer
|
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
29
29
|
class StyledTextProxy < WidgetProxy
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
else
|
37
|
-
super(attribute_name, *args)
|
38
|
-
end
|
30
|
+
def initialize(*args)
|
31
|
+
super
|
32
|
+
on_modify_text { |event|
|
33
|
+
@last_modify_text = text
|
34
|
+
}
|
39
35
|
end
|
40
|
-
|
41
36
|
end
|
42
37
|
end
|
43
38
|
end
|
@@ -245,7 +245,7 @@ module Glimmer
|
|
245
245
|
end
|
246
246
|
end
|
247
247
|
|
248
|
-
attr_reader :table_editor, :table_editor_widget_proxy, :sort_property, :sort_direction, :sort_block, :sort_type, :sort_by_block, :additional_sort_properties, :editor, :editable
|
248
|
+
attr_reader :table_editor, :table_editor_widget_proxy, :sort_property, :sort_direction, :sort_block, :sort_type, :sort_by_block, :additional_sort_properties, :editor, :editable
|
249
249
|
attr_accessor :column_properties
|
250
250
|
alias editable? editable
|
251
251
|
|
@@ -353,19 +353,6 @@ module Glimmer
|
|
353
353
|
@additional_sort_properties = args unless args.empty?
|
354
354
|
end
|
355
355
|
|
356
|
-
def editor=(args)
|
357
|
-
@editor = args
|
358
|
-
end
|
359
|
-
|
360
|
-
def cells_for(model)
|
361
|
-
column_properties.map {|property| model.send(property)}
|
362
|
-
end
|
363
|
-
|
364
|
-
def cells
|
365
|
-
column_count = @table.column_properties.size
|
366
|
-
swt_widget.items.map {|item| column_count.times.map {|i| item.get_text(i)} }
|
367
|
-
end
|
368
|
-
|
369
356
|
def sort!
|
370
357
|
return unless sort_property && (sort_type || sort_block || sort_by_block)
|
371
358
|
array = model_binding.evaluate_property
|
@@ -395,6 +382,19 @@ module Glimmer
|
|
395
382
|
model_binding.call(sorted_array)
|
396
383
|
end
|
397
384
|
|
385
|
+
def editor=(args)
|
386
|
+
@editor = args
|
387
|
+
end
|
388
|
+
|
389
|
+
def cells_for(model)
|
390
|
+
column_properties.map {|property| model.send(property)}
|
391
|
+
end
|
392
|
+
|
393
|
+
def cells
|
394
|
+
column_count = @table.column_properties.size
|
395
|
+
swt_widget.items.map {|item| column_count.times.map {|i| item.get_text(i)} }
|
396
|
+
end
|
397
|
+
|
398
398
|
# Performs a search for table items matching block condition
|
399
399
|
# If no condition block is passed, returns all table items
|
400
400
|
# Returns a Java TableItem array to easily set as selection on org.eclipse.swt.Table if needed
|
@@ -357,35 +357,52 @@ module Glimmer
|
|
357
357
|
}
|
358
358
|
end,
|
359
359
|
:caret_position => lambda do |observer|
|
360
|
+
on_caret_moved { |event|
|
361
|
+
observer.call(@swt_widget.getSelection.x) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
362
|
+
}
|
360
363
|
on_swt_keyup { |event|
|
361
|
-
observer.call(@swt_widget.getCaretOffset
|
364
|
+
observer.call(@swt_widget.getSelection.x) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
362
365
|
}
|
363
366
|
on_swt_mouseup { |event|
|
364
|
-
observer.call(@swt_widget.getCaretOffset
|
367
|
+
observer.call(@swt_widget.getSelection.x) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
365
368
|
}
|
366
369
|
end,
|
367
370
|
:caret_offset => lambda do |observer|
|
371
|
+
on_caret_moved { |event|
|
372
|
+
observer.call(@swt_widget.getCaretOffset) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
373
|
+
}
|
374
|
+
end,
|
375
|
+
:selection => lambda do |observer|
|
376
|
+
on_widget_selected { |event|
|
377
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
378
|
+
}
|
368
379
|
on_swt_keyup { |event|
|
369
|
-
observer.call(@swt_widget.getCaretOffset
|
380
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
370
381
|
}
|
371
382
|
on_swt_mouseup { |event|
|
372
|
-
observer.call(@swt_widget.getCaretOffset
|
383
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
373
384
|
}
|
374
385
|
end,
|
375
|
-
:
|
386
|
+
:selection_count => lambda do |observer|
|
387
|
+
on_widget_selected { |event|
|
388
|
+
observer.call(@swt_widget.getSelectionCount) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
389
|
+
}
|
376
390
|
on_swt_keyup { |event|
|
377
|
-
observer.call(@swt_widget.
|
391
|
+
observer.call(@swt_widget.getSelectionCount) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
378
392
|
}
|
379
393
|
on_swt_mouseup { |event|
|
380
|
-
observer.call(@swt_widget.
|
394
|
+
observer.call(@swt_widget.getSelectionCount) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
381
395
|
}
|
382
396
|
end,
|
383
|
-
:
|
397
|
+
:selection_range => lambda do |observer|
|
398
|
+
on_widget_selected { |event|
|
399
|
+
observer.call(@swt_widget.getSelectionRange) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
400
|
+
}
|
384
401
|
on_swt_keyup { |event|
|
385
|
-
observer.call(@swt_widget.
|
402
|
+
observer.call(@swt_widget.getSelectionRange) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
386
403
|
}
|
387
404
|
on_swt_mouseup { |event|
|
388
|
-
observer.call(@swt_widget.
|
405
|
+
observer.call(@swt_widget.getSelectionRange) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
389
406
|
}
|
390
407
|
end,
|
391
408
|
:top_index => lambda do |observer|
|
@@ -714,14 +731,17 @@ module Glimmer
|
|
714
731
|
setter: {name: 'setFocus', invoker: lambda { |widget, args| @swt_widget.setFocus if args.first }},
|
715
732
|
},
|
716
733
|
'caret_position' => {
|
717
|
-
getter: {name: 'getCaretPosition', invoker: lambda { |widget, args| @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.
|
718
|
-
setter: {name: 'setSelection', invoker: lambda { |widget, args| @swt_widget.setSelection(args.first) if args.first }},
|
734
|
+
getter: {name: 'getCaretPosition', invoker: lambda { |widget, args| @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getSelection.x}},
|
735
|
+
setter: {name: 'setSelection', invoker: lambda { |widget, args| @swt_widget.setSelection(args.first, args.first + @swt_widget.getSelectionCount) if args.first }},
|
719
736
|
},
|
720
737
|
'selection_count' => {
|
721
738
|
getter: {name: 'getSelectionCount'},
|
722
739
|
setter: {name: 'setSelection', invoker: lambda { |widget, args|
|
723
|
-
|
724
|
-
|
740
|
+
if args.first
|
741
|
+
caret_position = @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getSelection.x
|
742
|
+
# TODO handle negative length
|
743
|
+
@swt_widget.setSelection(caret_position, caret_position + args.first)
|
744
|
+
end
|
725
745
|
}},
|
726
746
|
},
|
727
747
|
}
|
@@ -0,0 +1,46 @@
|
|
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 HelloButton
|
23
|
+
include Glimmer
|
24
|
+
|
25
|
+
attr_accessor :count
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
@count = 0
|
29
|
+
end
|
30
|
+
|
31
|
+
def launch
|
32
|
+
shell {
|
33
|
+
text 'Hello, Button!'
|
34
|
+
|
35
|
+
button {
|
36
|
+
text bind(self, :count) {|value| "Click To Increment: #{value} "}
|
37
|
+
|
38
|
+
on_widget_selected {
|
39
|
+
self.count += 1
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}.open
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
HelloButton.new.launch
|
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.17.10.
|
4
|
+
version: 4.17.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-09 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: 1.0.
|
18
|
+
version: 1.0.5
|
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: 1.0.
|
26
|
+
version: 1.0.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -185,7 +185,7 @@ dependencies:
|
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version: 3.
|
188
|
+
version: 3.25.0
|
189
189
|
- - "<"
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: 4.0.0
|
@@ -196,7 +196,7 @@ dependencies:
|
|
196
196
|
requirements:
|
197
197
|
- - ">="
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version: 3.
|
199
|
+
version: 3.25.0
|
200
200
|
- - "<"
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: 4.0.0
|
@@ -310,7 +310,7 @@ dependencies:
|
|
310
310
|
- - "~>"
|
311
311
|
- !ruby/object:Gem::Version
|
312
312
|
version: 0.7.0
|
313
|
-
description: Glimmer DSL for SWT (JRuby Desktop Development GUI
|
313
|
+
description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
314
314
|
email: andy.am@gmail.com
|
315
315
|
executables:
|
316
316
|
- glimmer
|
@@ -431,6 +431,7 @@ files:
|
|
431
431
|
- samples/elaborate/tic_tac_toe/cell.rb
|
432
432
|
- samples/elaborate/user_profile.rb
|
433
433
|
- samples/hello/hello_browser.rb
|
434
|
+
- samples/hello/hello_button.rb
|
434
435
|
- samples/hello/hello_checkbox.rb
|
435
436
|
- samples/hello/hello_checkbox_group.rb
|
436
437
|
- samples/hello/hello_combo.rb
|