glimmer-dsl-opal 0.11.0 → 0.12.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 +8 -0
- data/README.md +18 -14
- data/VERSION +1 -1
- data/lib/display.rb +3 -0
- data/lib/glimmer-dsl-opal/samples/elaborate/contact_manager.rb +17 -13
- data/lib/glimmer-dsl-opal/samples/elaborate/login.rb +55 -28
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +2 -2
- data/lib/glimmer/data_binding/table_items_binding.rb +2 -2
- data/lib/glimmer/dsl/opal/table_items_data_binding_expression.rb +2 -2
- data/lib/glimmer/swt/layout_proxy.rb +23 -3
- data/lib/glimmer/swt/table_proxy.rb +19 -3
- data/lib/glimmer/ui/custom_shell.rb +13 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a5328b8fd90117a9774e990256d5650ab8c15cd2745a29a466384261a1ead8a
|
4
|
+
data.tar.gz: 2cfceae33c796f8aea84036dba490aa55ca94b5f7785c0c2f75dbc5e27535259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e574405ade34c331a168a3dd2814112269dff90a72d58678f06246d94246e2a1c7bfc7e56163df61c2805fc58764a5da48687273ce98ce5c10cf27cf52fb5d51
|
7
|
+
data.tar.gz: 297d37971d6939413fa2dd2535169b486a7c5332395f34b5d2f2c0697f41fce67c61c613dba83575b88e5904ef128354f5846e9e7e96963aa065f93050f2476d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.12.0
|
4
|
+
|
5
|
+
- Support CustomShell.launch opening in the same window if no other shell is open or DisplayProxy.open_custom_shells_in_current_window = true is set
|
6
|
+
- Support CustomShell.launch opening a new window if a shell is already open
|
7
|
+
- Support passing `table` data-binding column properties as `column_properties` or `column_attributes` an extra hash option to `bind` method call
|
8
|
+
- Support Shine data-binding syntax in `table`
|
9
|
+
- Update Hello, Custom Shell!, Hello, Table!, Contact Manager, and Login samples to use Shine data-binding syntax
|
10
|
+
|
3
11
|
## 0.11.0
|
4
12
|
|
5
13
|
- Upgrade to glimmer 2.0.0
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
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 Opal 0.
|
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 Opal 0.12.0 (Pure Ruby Web GUI)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-opal.svg)](http://badge.fury.io/rb/glimmer-dsl-opal)
|
3
3
|
[![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
4
|
|
@@ -141,7 +141,7 @@ Hello, Table! Game Booked
|
|
141
141
|
|
142
142
|
NOTE: Glimmer DSL for Opal is an alpha project. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
|
143
143
|
|
144
|
-
**Alpha Version** 0.
|
144
|
+
**Alpha Version** 0.12.0 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
|
145
145
|
|
146
146
|
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
147
147
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
@@ -151,7 +151,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
151
151
|
|
152
152
|
## Table of Contents
|
153
153
|
|
154
|
-
- [Glimmer DSL for Opal 0.
|
154
|
+
- [Glimmer DSL for Opal 0.12.0 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-0110-pure-ruby-web-gui)
|
155
155
|
- [Principles](#principles)
|
156
156
|
- [Background](#background)
|
157
157
|
- [Pre-requisites](#pre-requisites)
|
@@ -252,9 +252,9 @@ Add the following to `Gemfile`:
|
|
252
252
|
gem 'opal-rails', '~> 1.1.2'
|
253
253
|
gem 'opal-async', '~> 1.2.0'
|
254
254
|
gem 'opal-jquery', '~> 0.4.4'
|
255
|
-
gem 'glimmer-dsl-opal', '~> 0.
|
256
|
-
gem 'glimmer-dsl-xml', '~> 1.
|
257
|
-
gem 'glimmer-dsl-css', '~> 1.
|
255
|
+
gem 'glimmer-dsl-opal', '~> 0.12.0'
|
256
|
+
gem 'glimmer-dsl-xml', '~> 1.2.0', require: false
|
257
|
+
gem 'glimmer-dsl-css', '~> 1.2.0', require: false
|
258
258
|
|
259
259
|
```
|
260
260
|
|
@@ -468,7 +468,7 @@ class HelloCombo
|
|
468
468
|
text 'Hello, Combo!'
|
469
469
|
|
470
470
|
combo(:read_only) {
|
471
|
-
selection
|
471
|
+
selection <=> [person, :country]
|
472
472
|
}
|
473
473
|
|
474
474
|
button {
|
@@ -533,9 +533,7 @@ class HelloComputed
|
|
533
533
|
0
|
534
534
|
end
|
535
535
|
end
|
536
|
-
end
|
537
536
|
|
538
|
-
class HelloComputed
|
539
537
|
include Glimmer
|
540
538
|
|
541
539
|
def initialize
|
@@ -549,6 +547,7 @@ class HelloComputed
|
|
549
547
|
def launch
|
550
548
|
shell {
|
551
549
|
text 'Hello, Computed!'
|
550
|
+
|
552
551
|
composite {
|
553
552
|
grid_layout {
|
554
553
|
num_columns 2
|
@@ -556,41 +555,46 @@ class HelloComputed
|
|
556
555
|
horizontal_spacing 20
|
557
556
|
vertical_spacing 10
|
558
557
|
}
|
558
|
+
|
559
559
|
label {text 'First &Name: '}
|
560
560
|
text {
|
561
|
-
text
|
561
|
+
text <=> [@contact, :first_name]
|
562
562
|
layout_data {
|
563
563
|
horizontal_alignment :fill
|
564
564
|
grab_excess_horizontal_space true
|
565
565
|
}
|
566
566
|
}
|
567
|
+
|
567
568
|
label {text '&Last Name: '}
|
568
569
|
text {
|
569
|
-
text
|
570
|
+
text <=> [@contact, :last_name]
|
570
571
|
layout_data {
|
571
572
|
horizontal_alignment :fill
|
572
573
|
grab_excess_horizontal_space true
|
573
574
|
}
|
574
575
|
}
|
576
|
+
|
575
577
|
label {text '&Year of Birth: '}
|
576
578
|
text {
|
577
|
-
text
|
579
|
+
text <=> [@contact, :year_of_birth]
|
578
580
|
layout_data {
|
579
581
|
horizontal_alignment :fill
|
580
582
|
grab_excess_horizontal_space true
|
581
583
|
}
|
582
584
|
}
|
585
|
+
|
583
586
|
label {text 'Name: '}
|
584
587
|
label {
|
585
|
-
text
|
588
|
+
text <= [@contact, :name, computed_by: [:first_name, :last_name]]
|
586
589
|
layout_data {
|
587
590
|
horizontal_alignment :fill
|
588
591
|
grab_excess_horizontal_space true
|
589
592
|
}
|
590
593
|
}
|
594
|
+
|
591
595
|
label {text 'Age: '}
|
592
596
|
label {
|
593
|
-
text
|
597
|
+
text <= [@contact, :age, on_write: :to_i, computed_by: [:year_of_birth]]
|
594
598
|
layout_data {
|
595
599
|
horizontal_alignment :fill
|
596
600
|
grab_excess_horizontal_space true
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.12.0
|
data/lib/display.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
+
require 'glimmer-dsl-swt'
|
2
|
+
|
1
3
|
require_relative "contact_manager/contact_manager_presenter"
|
2
4
|
|
3
5
|
class ContactManager
|
4
|
-
include Glimmer
|
6
|
+
include Glimmer::UI::CustomShell
|
5
7
|
|
6
|
-
|
8
|
+
before_body {
|
7
9
|
@contact_manager_presenter = ContactManagerPresenter.new
|
8
10
|
@contact_manager_presenter.list
|
9
|
-
|
11
|
+
}
|
10
12
|
|
11
|
-
|
13
|
+
body {
|
12
14
|
shell {
|
13
15
|
text "Contact Manager"
|
14
16
|
composite {
|
@@ -28,7 +30,7 @@ class ContactManager
|
|
28
30
|
}
|
29
31
|
text {
|
30
32
|
layout_data :fill, :center, true, false
|
31
|
-
text
|
33
|
+
text <=> [@contact_manager_presenter, :first_name]
|
32
34
|
on_key_pressed {|key_event|
|
33
35
|
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
34
36
|
}
|
@@ -41,7 +43,7 @@ class ContactManager
|
|
41
43
|
}
|
42
44
|
text {
|
43
45
|
layout_data :fill, :center, true, false
|
44
|
-
text
|
46
|
+
text <=> [@contact_manager_presenter, :last_name]
|
45
47
|
on_key_pressed {|key_event|
|
46
48
|
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
47
49
|
}
|
@@ -54,7 +56,7 @@ class ContactManager
|
|
54
56
|
}
|
55
57
|
text {
|
56
58
|
layout_data :fill, :center, true, false
|
57
|
-
text
|
59
|
+
text <=> [@contact_manager_presenter, :email]
|
58
60
|
on_key_pressed {|key_event|
|
59
61
|
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
60
62
|
}
|
@@ -87,7 +89,7 @@ class ContactManager
|
|
87
89
|
}
|
88
90
|
}
|
89
91
|
|
90
|
-
table(:multi) { |table_proxy|
|
92
|
+
table(:editable, :multi) { |table_proxy|
|
91
93
|
layout_data {
|
92
94
|
horizontal_alignment :fill
|
93
95
|
vertical_alignment :fill
|
@@ -95,6 +97,7 @@ class ContactManager
|
|
95
97
|
grab_excess_vertical_space true
|
96
98
|
height_hint 200
|
97
99
|
}
|
100
|
+
|
98
101
|
table_column {
|
99
102
|
text "First Name"
|
100
103
|
width 80
|
@@ -107,15 +110,16 @@ class ContactManager
|
|
107
110
|
text "Email"
|
108
111
|
width 200
|
109
112
|
}
|
110
|
-
|
111
|
-
|
113
|
+
|
114
|
+
items <=> [@contact_manager_presenter, :results, column_attributes: [:first_name, :last_name, :email]]
|
115
|
+
|
112
116
|
on_mouse_up { |event|
|
113
117
|
table_proxy.edit_table_item(event.table_item, event.column_index)
|
114
118
|
}
|
115
119
|
}
|
116
120
|
}
|
117
|
-
}
|
118
|
-
|
121
|
+
}
|
122
|
+
}
|
119
123
|
end
|
120
124
|
|
121
|
-
ContactManager.
|
125
|
+
ContactManager.launch
|
@@ -1,4 +1,25 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2020-2021 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
|
+
require 'glimmer-dsl-swt'
|
2
23
|
|
3
24
|
class LoginPresenter
|
4
25
|
|
@@ -14,29 +35,26 @@ class LoginPresenter
|
|
14
35
|
|
15
36
|
def status=(status)
|
16
37
|
@status = status
|
17
|
-
|
18
|
-
notify_observers("logged_in")
|
19
|
-
notify_observers("logged_out")
|
20
38
|
end
|
21
39
|
|
22
40
|
def valid?
|
23
41
|
!@user_name.to_s.strip.empty? && !@password.to_s.strip.empty?
|
24
42
|
end
|
25
43
|
|
26
|
-
def logged_in
|
44
|
+
def logged_in?
|
27
45
|
self.status == "Logged In"
|
28
46
|
end
|
29
47
|
|
30
|
-
def logged_out
|
31
|
-
!self.logged_in
|
48
|
+
def logged_out?
|
49
|
+
!self.logged_in?
|
32
50
|
end
|
33
51
|
|
34
|
-
def login
|
52
|
+
def login!
|
35
53
|
return unless valid?
|
36
54
|
self.status = "Logged In"
|
37
55
|
end
|
38
56
|
|
39
|
-
def logout
|
57
|
+
def logout!
|
40
58
|
self.user_name = ""
|
41
59
|
self.password = ""
|
42
60
|
self.status = "Logged Out"
|
@@ -45,19 +63,24 @@ class LoginPresenter
|
|
45
63
|
end
|
46
64
|
|
47
65
|
class Login
|
48
|
-
include Glimmer
|
66
|
+
include Glimmer::UI::CustomShell
|
67
|
+
|
68
|
+
before_body {
|
69
|
+
@presenter = LoginPresenter.new
|
70
|
+
}
|
49
71
|
|
50
|
-
|
51
|
-
|
52
|
-
@shell = shell {
|
72
|
+
body {
|
73
|
+
shell {
|
53
74
|
text "Login"
|
75
|
+
|
54
76
|
composite {
|
55
77
|
grid_layout 2, false #two columns with differing widths
|
56
78
|
|
57
79
|
label { text "Username:" } # goes in column 1
|
58
80
|
@user_name_text = text { # goes in column 2
|
59
|
-
text <=> [presenter, :user_name]
|
60
|
-
enabled <= [presenter, :logged_out]
|
81
|
+
text <=> [@presenter, :user_name]
|
82
|
+
enabled <= [@presenter, :logged_out?, computed_by: :status]
|
83
|
+
|
61
84
|
on_key_pressed { |event|
|
62
85
|
@password_text.set_focus if event.keyCode == swt(:cr)
|
63
86
|
}
|
@@ -65,40 +88,44 @@ class Login
|
|
65
88
|
|
66
89
|
label { text "Password:" }
|
67
90
|
@password_text = text(:password, :border) {
|
68
|
-
text <=> [presenter, :password]
|
69
|
-
enabled <= [presenter, :logged_out]
|
91
|
+
text <=> [@presenter, :password]
|
92
|
+
enabled <= [@presenter, :logged_out?, computed_by: :status]
|
93
|
+
|
70
94
|
on_key_pressed { |event|
|
71
|
-
presenter.login if event.keyCode == swt(:cr)
|
95
|
+
@presenter.login! if event.keyCode == swt(:cr)
|
72
96
|
}
|
73
97
|
}
|
74
98
|
|
75
99
|
label { text "Status:" }
|
76
|
-
label { text <= [presenter, :status] }
|
100
|
+
label { text <= [@presenter, :status] }
|
77
101
|
|
78
102
|
button {
|
79
103
|
text "Login"
|
80
|
-
enabled <= [presenter, :logged_out]
|
81
|
-
|
104
|
+
enabled <= [@presenter, :logged_out?, computed_by: :status]
|
105
|
+
|
106
|
+
on_widget_selected { @presenter.login! }
|
82
107
|
on_key_pressed { |event|
|
83
|
-
|
108
|
+
if event.keyCode == swt(:cr)
|
109
|
+
@presenter.login!
|
110
|
+
end
|
84
111
|
}
|
85
112
|
}
|
86
113
|
|
87
114
|
button {
|
88
115
|
text "Logout"
|
89
|
-
enabled <= [presenter, :logged_in]
|
90
|
-
|
116
|
+
enabled <= [@presenter, :logged_in?, computed_by: :status]
|
117
|
+
|
118
|
+
on_widget_selected { @presenter.logout! }
|
91
119
|
on_key_pressed { |event|
|
92
120
|
if event.keyCode == swt(:cr)
|
93
|
-
presenter.logout
|
121
|
+
@presenter.logout!
|
94
122
|
@user_name_text.set_focus
|
95
123
|
end
|
96
124
|
}
|
97
125
|
}
|
98
126
|
}
|
99
127
|
}
|
100
|
-
|
101
|
-
end
|
128
|
+
}
|
102
129
|
end
|
103
130
|
|
104
|
-
Login.
|
131
|
+
Login.launch
|
@@ -137,7 +137,7 @@ class HelloCustomShell
|
|
137
137
|
width 360
|
138
138
|
}
|
139
139
|
|
140
|
-
items
|
140
|
+
items <=> [@email_system, :emails, column_attributes: [:date, :subject, :from]]
|
141
141
|
|
142
142
|
on_mouse_up { |event|
|
143
143
|
email = event.table_item.get_data
|
@@ -237,10 +237,10 @@ class HelloTable
|
|
237
237
|
}
|
238
238
|
|
239
239
|
# Data-bind table items (rows) to a model collection property, specifying column properties ordering per nested model
|
240
|
-
items
|
240
|
+
items <=> [BaseballGame, :schedule, column_attributes: [:game_date, :game_time, :ballpark, :home_team, :away_team, :promotion]]
|
241
241
|
|
242
242
|
# Data-bind table selection
|
243
|
-
selection
|
243
|
+
selection <=> [BaseballGame, :selected_game]
|
244
244
|
|
245
245
|
# Default initial sort property
|
246
246
|
sort_property :date
|
@@ -15,8 +15,8 @@ module Glimmer
|
|
15
15
|
@last_populated_model_collection = nil
|
16
16
|
@table = parent
|
17
17
|
@model_binding = model_binding
|
18
|
-
|
19
|
-
@
|
18
|
+
@column_properties = model_binding.binding_options[:column_attributes] || model_binding.binding_options[:column_properties] || column_properties # TODO
|
19
|
+
@table.editable = false if model_binding.binding_options[:read_only]
|
20
20
|
@table.data = @model_binding
|
21
21
|
##@table.on_widget_disposed do |dispose_event| # doesn't seem needed within Opal
|
22
22
|
## unregister_all_observables
|
@@ -12,10 +12,10 @@ module Glimmer
|
|
12
12
|
keyword == "items" and
|
13
13
|
block.nil? and
|
14
14
|
parent.is_a?(Glimmer::SWT::TableProxy) and
|
15
|
-
args.size
|
15
|
+
args.size.between?(1, 2) and
|
16
16
|
args[0].is_a?(DataBinding::ModelBinding) and
|
17
17
|
args[0].evaluate_property.is_a?(Array) and
|
18
|
-
args[1].is_a?(Array)
|
18
|
+
(args[1].nil? or args[1].is_a?(Array))
|
19
19
|
end
|
20
20
|
|
21
21
|
def interpret(parent, keyword, *args, &block)
|
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020-2021 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 'glimmer/swt/property_owner'
|
2
23
|
|
3
24
|
module Glimmer
|
@@ -13,9 +34,8 @@ module Glimmer
|
|
13
34
|
end
|
14
35
|
|
15
36
|
def layout_class(keyword)
|
16
|
-
|
17
|
-
|
18
|
-
a_layout_class = Glimmer::SWT.const_get(class_name_main.to_sym) rescue Glimmer::SWT.const_get(class_name_alternative.to_sym)
|
37
|
+
class_name_main = "#{keyword.camelcase(:upper)}Proxy"
|
38
|
+
a_layout_class = Glimmer::SWT.const_get(class_name_main.to_sym)
|
19
39
|
a_layout_class if a_layout_class.ancestors.include?(Glimmer::SWT::LayoutProxy)
|
20
40
|
rescue => e
|
21
41
|
Glimmer::Config.logger.debug "Layout #{keyword} was not found!"
|
@@ -257,9 +257,7 @@ module Glimmer
|
|
257
257
|
@table_editor.minimumWidth = 90
|
258
258
|
@table_editor.minimumHeight = 20
|
259
259
|
if editable?
|
260
|
-
|
261
|
-
edit_table_item(event.table_item, event.column_index)
|
262
|
-
}
|
260
|
+
add_editable_event_listener
|
263
261
|
end
|
264
262
|
end
|
265
263
|
|
@@ -311,6 +309,24 @@ module Glimmer
|
|
311
309
|
end
|
312
310
|
alias editable editable?
|
313
311
|
|
312
|
+
def editable=(value)
|
313
|
+
if value
|
314
|
+
args.push(:editable)
|
315
|
+
dom_element.addClass('editable')
|
316
|
+
add_editable_event_listener
|
317
|
+
else
|
318
|
+
args.delete(:editable)
|
319
|
+
dom_element.removeClass('editable')
|
320
|
+
@editable_on_mouse_up_event_listener.deregister # TODO see why table event listener deregistration is not working
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
def add_editable_event_listener
|
325
|
+
@editable_on_mouse_up_event_listener = on_mouse_up { |event|
|
326
|
+
edit_table_item(event.table_item, event.column_index) if editable?
|
327
|
+
}
|
328
|
+
end
|
329
|
+
|
314
330
|
def selection
|
315
331
|
@selection.to_a
|
316
332
|
end
|
@@ -29,15 +29,12 @@ module Glimmer
|
|
29
29
|
include Glimmer::UI::CustomWidget
|
30
30
|
|
31
31
|
module ClassMethods
|
32
|
+
include Glimmer
|
32
33
|
attr_reader :custom_shell
|
33
34
|
|
34
35
|
def launch
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
def shutdown
|
40
|
-
@custom_shell.close
|
36
|
+
custom_shell = send(self.name.underscore.gsub('::', '__'))
|
37
|
+
custom_shell.open
|
41
38
|
end
|
42
39
|
end
|
43
40
|
|
@@ -73,11 +70,17 @@ module Glimmer
|
|
73
70
|
raise Error, 'Invalid custom shell body root! Must be a shell or another custom shell.' unless body_root.is_a?(Glimmer::SWT::ShellProxy) || body_root.is_a?(Glimmer::UI::CustomShell)
|
74
71
|
end
|
75
72
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
def open(async: true)
|
74
|
+
work = lambda do
|
75
|
+
body_root.open
|
76
|
+
end
|
77
|
+
if async
|
78
|
+
Glimmer::SWT::DisplayProxy.instance.async_exec(&work)
|
79
|
+
else
|
80
|
+
work.call
|
81
|
+
end
|
80
82
|
end
|
83
|
+
|
81
84
|
|
82
85
|
# DO NOT OVERRIDE. JUST AN ALIAS FOR `#open`. OVERRIDE `#open` INSTEAD.
|
83
86
|
def show
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-opal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|