glimmer-dsl-opal 0.9.3 → 0.11.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 +28 -0
- data/LICENSE.txt +1 -1
- data/README.md +114 -49
- data/VERSION +1 -1
- data/lib/display.rb +1 -1
- data/lib/glimmer-dsl-opal.rb +3 -2
- data/lib/glimmer-dsl-opal/ext/file.rb +1 -1
- data/lib/glimmer-dsl-opal/ext/glimmer/dsl/engine.rb +8 -4
- data/lib/glimmer-dsl-opal/samples/elaborate/contact_manager/contact_repository.rb +4 -4
- data/lib/glimmer-dsl-opal/samples/elaborate/login.rb +7 -7
- data/lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb +3 -3
- data/lib/glimmer-dsl-opal/samples/hello/hello_browser.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_button.rb +2 -2
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +5 -5
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +2 -2
- data/lib/glimmer-dsl-opal/samples/hello/hello_computed.rb +6 -6
- data/lib/glimmer-dsl-opal/samples/hello/hello_computed/contact.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb +5 -5
- data/lib/glimmer-dsl-opal/samples/hello/hello_dialog.rb +78 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +7 -7
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb +2 -2
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +2 -2
- data/lib/glimmer-dsl-opal/samples/hello/hello_menu_bar.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +7 -7
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +1 -1
- data/lib/glimmer-dsl-swt.rb +1 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +2 -1
- data/lib/glimmer/dsl/opal/async_exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/bind_expression.rb +24 -25
- data/lib/glimmer/dsl/opal/block_property_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/color_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +7 -7
- data/lib/glimmer/dsl/opal/dialog_expression.rb +20 -0
- data/lib/glimmer/dsl/opal/display_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/dsl.rb +5 -1
- data/lib/glimmer/dsl/opal/exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/font_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/menu_bar_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/menu_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/message_box_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/property_expression.rb +2 -1
- data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/rgb_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/rgba_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/shape_expression.rb +26 -0
- data/lib/glimmer/dsl/opal/shell_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/shine_data_binding_expression.rb +49 -0
- data/lib/glimmer/dsl/opal/swt_expression.rb +4 -4
- data/lib/glimmer/dsl/opal/sync_exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/widget_expression.rb +1 -1
- data/lib/glimmer/swt.rb +1 -1
- data/lib/glimmer/swt/color_proxy.rb +1 -1
- data/lib/glimmer/swt/combo_proxy.rb +1 -0
- data/lib/glimmer/swt/composite_proxy.rb +18 -2
- data/lib/glimmer/swt/control_editor.rb +1 -1
- data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
- data/lib/glimmer/swt/custom/radio_group.rb +1 -1
- data/lib/glimmer/swt/dialog_proxy.rb +188 -0
- data/lib/glimmer/swt/display_proxy.rb +132 -9
- data/lib/glimmer/swt/font_proxy.rb +1 -1
- data/lib/glimmer/swt/grid_layout_proxy.rb +28 -33
- data/lib/glimmer/swt/label_proxy.rb +1 -1
- data/lib/glimmer/swt/latest_dialog_proxy.rb +44 -0
- data/lib/glimmer/swt/latest_message_box_proxy.rb +4 -2
- data/lib/glimmer/swt/latest_shell_proxy.rb +7 -3
- data/lib/glimmer/swt/layout_data_proxy.rb +4 -0
- data/lib/glimmer/swt/layout_proxy.rb +9 -6
- data/lib/glimmer/swt/make_shift_shell_proxy.rb +1 -1
- data/lib/glimmer/swt/menu_item_proxy.rb +1 -1
- data/lib/glimmer/swt/menu_proxy.rb +1 -1
- data/lib/glimmer/swt/message_box_proxy.rb +23 -17
- data/lib/glimmer/swt/row_layout_proxy.rb +34 -7
- data/lib/glimmer/swt/shell_proxy.rb +43 -9
- data/lib/glimmer/swt/style_constantizable.rb +1 -1
- data/lib/glimmer/swt/swt_proxy.rb +1 -1
- data/lib/glimmer/swt/tab_folder_proxy.rb +1 -1
- data/lib/glimmer/swt/table_editor.rb +1 -1
- data/lib/glimmer/swt/table_item_proxy.rb +1 -1
- data/lib/glimmer/swt/table_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +53 -21
- data/lib/glimmer/ui/custom_shell.rb +17 -3
- data/lib/glimmer/ui/custom_widget.rb +1 -1
- data/lib/glimmer/util/proc_tracker.rb +17 -6
- data/lib/net/http.rb +1 -1
- data/lib/os.rb +1 -1
- metadata +17 -11
@@ -0,0 +1,44 @@
|
|
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
|
+
module Glimmer
|
23
|
+
module SWT
|
24
|
+
class LatestDialogProxy #< DialogProxy
|
25
|
+
# TODO consider overriding all methods from DialogProxy and proxying to them
|
26
|
+
# TODO consider the idea of promoting this object into the real dialog once Document is ready
|
27
|
+
|
28
|
+
def initialize(parent, args, block)
|
29
|
+
# No Op
|
30
|
+
end
|
31
|
+
|
32
|
+
def open
|
33
|
+
Document.ready? do
|
34
|
+
DisplayProxy.instance.async_exec {
|
35
|
+
DisplayProxy.instance.dialogs.last&.open
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
1
|
+
# Copyright (c) 2020-2021 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
|
@@ -31,7 +31,9 @@ module Glimmer
|
|
31
31
|
|
32
32
|
def open
|
33
33
|
Document.ready? do
|
34
|
-
DisplayProxy.instance.
|
34
|
+
DisplayProxy.instance.async_exec {
|
35
|
+
DisplayProxy.instance.message_boxes.last&.open
|
36
|
+
}
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
1
|
+
# Copyright (c) 2020-2021 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
|
@@ -19,9 +19,11 @@
|
|
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
|
+
require 'glimmer/swt/shell_proxy'
|
23
|
+
|
22
24
|
module Glimmer
|
23
25
|
module SWT
|
24
|
-
class LatestShellProxy
|
26
|
+
class LatestShellProxy < ShellProxy
|
25
27
|
def initialize(parent, args, block)
|
26
28
|
# No Op
|
27
29
|
end
|
@@ -40,7 +42,9 @@ module Glimmer
|
|
40
42
|
|
41
43
|
def open
|
42
44
|
Document.ready? do
|
43
|
-
|
45
|
+
DisplayProxy.instance.async_exec {
|
46
|
+
latest_shell&.open
|
47
|
+
}
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
@@ -17,6 +17,8 @@ module Glimmer
|
|
17
17
|
:grab_excess_vertical_space,
|
18
18
|
:width_hint,
|
19
19
|
:height_hint
|
20
|
+
alias width width_hint
|
21
|
+
alias height height_hint
|
20
22
|
|
21
23
|
def initialize(parent, args)
|
22
24
|
@parent = parent
|
@@ -35,12 +37,14 @@ module Glimmer
|
|
35
37
|
@parent.dom_element.css('width', "#{@width_hint}px")
|
36
38
|
# reapply
|
37
39
|
end
|
40
|
+
alias width= width_hint=
|
38
41
|
|
39
42
|
def height_hint=(height_hint)
|
40
43
|
@height_hint = height_hint
|
41
44
|
@parent.dom_element.css('height', "#{@height_hint}px")
|
42
45
|
# reapply
|
43
46
|
end
|
47
|
+
alias height= height_hint=
|
44
48
|
|
45
49
|
def horizontal_alignment=(horizontal_alignment)
|
46
50
|
@horizontal_alignment = horizontal_alignment
|
@@ -31,29 +31,32 @@ module Glimmer
|
|
31
31
|
|
32
32
|
def initialize(parent, args)
|
33
33
|
@parent = parent
|
34
|
+
@args = args
|
34
35
|
@parent = parent.body_root if @parent.is_a?(Glimmer::UI::CustomWidget)
|
35
36
|
@parent.css_classes.each do |css_class|
|
36
37
|
@parent.remove_css_class(css_class) if css_class.include?('layout')
|
37
38
|
end
|
38
|
-
@args = args
|
39
39
|
@parent.add_css_class(css_class)
|
40
40
|
@parent.layout = self
|
41
41
|
self.margin_width = 15 if respond_to?(:margin_width=)
|
42
42
|
self.margin_height = 15 if respond_to?(:margin_height=)
|
43
43
|
end
|
44
|
-
|
45
|
-
def
|
46
|
-
|
44
|
+
|
45
|
+
def layout(composite = nil, flush_cache = false)
|
46
|
+
# TODO implement def layout(composite = nil, flush_cache = false) as per SWT API
|
47
|
+
composite ||= @parent
|
48
|
+
initialize(composite, @args)
|
47
49
|
end
|
48
50
|
|
49
|
-
def
|
50
|
-
|
51
|
+
def css_class
|
52
|
+
self.class.name.split('::').last.underscore.sub(/_proxy$/, '').gsub('_', '-')
|
51
53
|
end
|
52
54
|
|
53
55
|
# Decorates widget dom. Subclasses may override. Returns widget dom by default.
|
54
56
|
def dom(widget_dom)
|
55
57
|
widget_dom
|
56
58
|
end
|
59
|
+
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
1
|
+
# Copyright (c) 2020-2021 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
|
@@ -26,9 +26,9 @@ module Glimmer
|
|
26
26
|
module SWT
|
27
27
|
class MessageBoxProxy < WidgetProxy
|
28
28
|
STYLE = <<~CSS
|
29
|
-
.
|
29
|
+
.message-box {
|
30
30
|
position: fixed;
|
31
|
-
z-index:
|
31
|
+
z-index: 1000;
|
32
32
|
padding-top: 100px;
|
33
33
|
left: 0;
|
34
34
|
top: 0;
|
@@ -39,15 +39,15 @@ module Glimmer
|
|
39
39
|
background-color: rgba(0,0,0,0.4);
|
40
40
|
text-align: center;
|
41
41
|
}
|
42
|
-
.
|
42
|
+
.message-box-content .text {
|
43
43
|
background: rgb(80, 116, 211);
|
44
44
|
color: white;
|
45
45
|
padding: 5px;
|
46
46
|
}
|
47
|
-
.
|
47
|
+
.message-box-content .message {
|
48
48
|
padding: 20px;
|
49
49
|
}
|
50
|
-
.
|
50
|
+
.message-box-content {
|
51
51
|
background-color: #fefefe;
|
52
52
|
padding-bottom: 15px;
|
53
53
|
border: 1px solid #888;
|
@@ -74,7 +74,7 @@ module Glimmer
|
|
74
74
|
i = 0
|
75
75
|
@parent = parent
|
76
76
|
@parent = nil if parent.is_a?(LatestShellProxy)
|
77
|
-
@parent ||= DisplayProxy.instance.shells.
|
77
|
+
@parent ||= DisplayProxy.instance.shells.detect(&:open?) || ShellProxy.new([])
|
78
78
|
@args = args
|
79
79
|
@block = block
|
80
80
|
@children = Set.new
|
@@ -87,7 +87,7 @@ module Glimmer
|
|
87
87
|
|
88
88
|
def text=(txt)
|
89
89
|
@text = txt
|
90
|
-
dom_element.find('.
|
90
|
+
dom_element.find('.message-box-content .text').html(@text)
|
91
91
|
end
|
92
92
|
|
93
93
|
def html_message
|
@@ -96,23 +96,29 @@ module Glimmer
|
|
96
96
|
|
97
97
|
def message=(msg)
|
98
98
|
@message = msg
|
99
|
-
dom_element.find('.
|
99
|
+
dom_element.find('.message-box-content .message').html(html_message)
|
100
|
+
end
|
101
|
+
|
102
|
+
def open?
|
103
|
+
@open
|
100
104
|
end
|
101
105
|
|
102
106
|
def open
|
103
|
-
|
107
|
+
shell.open(async: false) unless shell.open?
|
108
|
+
owned_proc = Glimmer::Util::ProcTracker.new(owner: self, invoked_from: :open) {
|
109
|
+
parent.post_initialize_child(self)
|
110
|
+
@open = true
|
111
|
+
}
|
112
|
+
DisplayProxy.instance.async_exec(owned_proc)
|
104
113
|
end
|
105
114
|
|
106
115
|
def hide
|
107
116
|
dom_element.remove
|
117
|
+
@open = false
|
108
118
|
end
|
109
119
|
|
110
120
|
def content(&block)
|
111
|
-
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Opal::MessageBoxExpression.new, &block)
|
112
|
-
end
|
113
|
-
|
114
|
-
def name
|
115
|
-
'div'
|
121
|
+
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Opal::MessageBoxExpression.new, 'message_box', *@args, &block)
|
116
122
|
end
|
117
123
|
|
118
124
|
def selector
|
@@ -134,9 +140,9 @@ module Glimmer
|
|
134
140
|
def dom
|
135
141
|
@dom ||= html {
|
136
142
|
div(id: id, class: "modal #{name}") {
|
137
|
-
div(class: '
|
143
|
+
div(class: 'message-box-content') {
|
138
144
|
header(class: 'text') {
|
139
|
-
text
|
145
|
+
"#{text} " # ensure title area occuppied when there is no text by adding non-breaking space ( )
|
140
146
|
}
|
141
147
|
tag(_name: 'p', id: 'message', class: 'message') {
|
142
148
|
html_message
|
@@ -14,6 +14,16 @@ module Glimmer
|
|
14
14
|
.row-layout-pack-false {
|
15
15
|
align-items: stretch;
|
16
16
|
}
|
17
|
+
|
18
|
+
.row-layout-center.row-layout-horizontal > * {
|
19
|
+
margin-top: auto;
|
20
|
+
margin-bottom: auto;
|
21
|
+
}
|
22
|
+
|
23
|
+
.row-layout-center.row-layout-vertical > * {
|
24
|
+
margin-left: auto;
|
25
|
+
margin-right: auto;
|
26
|
+
}
|
17
27
|
|
18
28
|
.row-layout-horizontal {
|
19
29
|
flex-direction: row;
|
@@ -32,15 +42,17 @@ module Glimmer
|
|
32
42
|
}
|
33
43
|
CSS
|
34
44
|
|
35
|
-
attr_reader :type, :margin_width, :margin_height, :margin_top, :margin_right, :margin_bottom, :margin_left, :spacing, :pack
|
36
|
-
|
45
|
+
attr_reader :type, :fill, :margin_width, :margin_height, :margin_top, :margin_right, :margin_bottom, :margin_left, :spacing, :pack, :center
|
46
|
+
|
37
47
|
def initialize(parent, args)
|
38
48
|
super(parent, args)
|
39
|
-
@type = @args.first || :horizontal
|
40
|
-
@marign_width = 15
|
41
|
-
@margin_height = 15
|
42
|
-
self.pack = true
|
43
49
|
@parent.dom_element.add_class('row-layout')
|
50
|
+
self.type = args.first || :horizontal
|
51
|
+
self.pack = true
|
52
|
+
end
|
53
|
+
|
54
|
+
def type=(value)
|
55
|
+
@type = value
|
44
56
|
@parent.dom_element.add_class(horizontal? ? 'row-layout-horizontal' : 'row-layout-vertical')
|
45
57
|
end
|
46
58
|
|
@@ -67,6 +79,21 @@ module Glimmer
|
|
67
79
|
end
|
68
80
|
end
|
69
81
|
|
82
|
+
def fill=(value)
|
83
|
+
# TODO verify this is a correct implementation and interpretation of RowLayout in SWT
|
84
|
+
self.pack(!value)
|
85
|
+
end
|
86
|
+
|
87
|
+
def center=(center_value)
|
88
|
+
@center = center_value
|
89
|
+
# Using padding for width since margin-right isn't getting respected with width 100%
|
90
|
+
if @center
|
91
|
+
parent.dom_element.add_class("row-layout-center")
|
92
|
+
else
|
93
|
+
parent.dom_element.remove_class("row-layout-center")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
70
97
|
def margin_width=(pixels)
|
71
98
|
@margin_width = pixels
|
72
99
|
# Using padding for width since margin-right isn't getting respected with width 100%
|
@@ -101,7 +128,7 @@ module Glimmer
|
|
101
128
|
@margin_left = pixels
|
102
129
|
@parent.dom_element.css('padding-left', @margin_left)
|
103
130
|
end
|
104
|
-
|
131
|
+
|
105
132
|
def spacing=(spacing)
|
106
133
|
@spacing = spacing.to_i
|
107
134
|
# TODO implement changes to accomodate layout_data in the future
|
@@ -24,6 +24,17 @@ module Glimmer
|
|
24
24
|
width: 100%;
|
25
25
|
height: 100%;
|
26
26
|
}
|
27
|
+
.shell .dialog-overlay {
|
28
|
+
position: fixed;
|
29
|
+
z-index: 10;
|
30
|
+
padding-top: 100px;
|
31
|
+
left: 0;
|
32
|
+
top: 0;
|
33
|
+
width: 100%;
|
34
|
+
height: 100%;
|
35
|
+
overflow: auto;
|
36
|
+
background-color: rgba(0,0,0,0.4);
|
37
|
+
}
|
27
38
|
CSS
|
28
39
|
|
29
40
|
# TODO consider renaming to ShellProxy to match SWT API
|
@@ -36,9 +47,7 @@ module Glimmer
|
|
36
47
|
def initialize(args)
|
37
48
|
@args = args
|
38
49
|
@children = []
|
39
|
-
# TODO
|
40
|
-
Document.find('body').empty unless ENV['RUBY_ENV'] == 'test'
|
41
|
-
render
|
50
|
+
render # TODO attach to specific element
|
42
51
|
@layout = FillLayoutProxy.new(self, [])
|
43
52
|
@layout.margin_width = 0
|
44
53
|
@layout.margin_height = 0
|
@@ -84,7 +93,7 @@ module Glimmer
|
|
84
93
|
def dom
|
85
94
|
i = 0
|
86
95
|
body_id = id
|
87
|
-
body_class = ([name] + css_classes.to_a).join(' ')
|
96
|
+
body_class = ([name, 'hide'] + css_classes.to_a).join(' ')
|
88
97
|
@dom ||= html {
|
89
98
|
div(id: body_id, class: body_class) {
|
90
99
|
# TODO consider supporting the idea of dynamic CSS building on close of shell that adds only as much CSS as needed for widgets that were mentioned
|
@@ -98,15 +107,40 @@ module Glimmer
|
|
98
107
|
}
|
99
108
|
end
|
100
109
|
end
|
101
|
-
''
|
110
|
+
div(class: 'dialog-overlay hide') {
|
111
|
+
}
|
102
112
|
}
|
103
113
|
}.to_s
|
104
114
|
end
|
105
115
|
|
106
|
-
def open
|
107
|
-
|
108
|
-
|
109
|
-
|
116
|
+
def open(async: true)
|
117
|
+
work = lambda do
|
118
|
+
unless @open
|
119
|
+
DisplayProxy.instance.shells.select(&:open?).reject {|s| s == self}.map(&:hide)
|
120
|
+
dom_element.remove_class('hide')
|
121
|
+
@open = true
|
122
|
+
end
|
123
|
+
end
|
124
|
+
if async
|
125
|
+
DisplayProxy.instance.async_exec(&work)
|
126
|
+
else
|
127
|
+
work.call
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def hide
|
132
|
+
dom_element.add_class('hide')
|
133
|
+
@open = false
|
134
|
+
end
|
135
|
+
|
136
|
+
def close
|
137
|
+
DisplayProxy.instance.shells.delete(self)
|
138
|
+
dom_element.remove
|
139
|
+
@open = false
|
140
|
+
end
|
141
|
+
|
142
|
+
def open?
|
143
|
+
@open
|
110
144
|
end
|
111
145
|
end
|
112
146
|
end
|