Class: Glimmer::SWT::MessageBoxProxy
Constant Summary
Constants inherited
from WidgetProxy
WidgetProxy::DEFAULT_INITIALIZERS
Instance Attribute Summary collapse
Attributes inherited from WidgetProxy
#args, #background, #children, #enabled, #focus, #font, #foreground, #parent, #path
Instance Method Summary
collapse
Methods inherited from WidgetProxy
#add_css_class, #add_css_classes, #add_observer, #apply_property_type_converters, #build_dom, #can_handle_observation_request?, #clear_css_classes, #css_classes, #dispose, #dom_element, #element, for, #handle_observation_request, #has_style?, #id, #id=, #listener_dom_element, max_id_number_for, max_id_numbers, next_id_number_for, #parent_dom_element, #parent_path, #post_add_content, #post_initialize_child, #property_type_converters, #remove_css_class, #remove_css_classes, #render, reset_max_id_numbers!, #set_attribute, #set_focus, #style_element, underscored_widget_name, widget_class, widget_exists?, #widget_property_listener_installers
#attribute_getter, #attribute_setter, #get_attribute, #set_attribute
Constructor Details
#initialize(parent, args, block) ⇒ MessageBoxProxy
Returns a new instance of MessageBoxProxy.
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 9
def initialize(parent, args, block)
i = 0
@parent = parent || DisplayProxy.instance.shells.first
@args = args
@block = block
@children = Set.new
@enabled = true
content do
on_widget_selected {
hide
}
end
end
|
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
7
8
9
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 7
def message
@message
end
|
#text ⇒ Object
Returns the value of attribute text.
7
8
9
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 7
def text
@text
end
|
Instance Method Details
#content(&block) ⇒ Object
49
50
51
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 49
def content(&block)
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Opal::MessageBoxExpression.new, &block)
end
|
#document ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 33
def document
element = self
begin
element = element.parent
end while(element.parent)
element
end
|
#dom ⇒ Object
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 118
def dom
modal_id = id
modal_style = css
modal_text = text
modal_message = message
modal_class = ['modal', name].join(' ')
@dom ||= html {
div(id: modal_id, style: modal_style, class: modal_class) {
style(class: 'modal-style') {
style_dom_modal_css
}
div(class: 'modal-content') {
(class: 'text') {
modal_text
}
tag(_name: 'p', id: 'message', class: 'message') {
modal_message
}
input(type: 'button', class: 'close', autofocus: 'autofocus', value: 'OK')
}
}
}.to_s
end
|
#hide ⇒ Object
45
46
47
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 45
def hide
dom_element.remove
end
|
#listener_path ⇒ Object
61
62
63
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 61
def listener_path
path + ' .close'
end
|
#name ⇒ Object
53
54
55
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 53
def name
'div'
end
|
#observation_request_to_event_mapping ⇒ Object
65
66
67
68
69
70
71
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 65
def observation_request_to_event_mapping
{
'on_widget_selected' => {
event: 'click'
},
}
end
|
#open ⇒ Object
41
42
43
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 41
def open
document.post_initialize_child(self)
end
|
#selector ⇒ Object
57
58
59
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 57
def selector
super + ' .close'
end
|
#style_dom_modal_css ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/glimmer/swt/message_box_proxy.rb', line 73
def style_dom_modal_css
" .modal {\n position: fixed;\n z-index: 1;\n padding-top: 100px;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: rgb(0,0,0);\n background-color: rgba(0,0,0,0.4);\n text-align: center;\n }\n .modal-content .text {\n background: rgb(80, 116, 211);\n color: white;\n padding: 5px;\n }\n .modal-content .message {\n padding: 20px;\n }\n .modal-content {\n background-color: #fefefe;\n padding-bottom: 15px;\n border: 1px solid #888;\n display: inline-block;\n min-width: 200px;\n }\n CSS\n# .close {\n# color: #aaaaaa;\n# float: right;\n# font-weight: bold;\n# margin: 5px;\n# }\n# .close:hover,\n# .close:focus {\n# color: #000;\n# text-decoration: none;\n# cursor: pointer;\n# }\nend\n"
|