Class: Glimmer::SWT::DisplayProxy
Constant Summary
Constants inherited
from WidgetProxy
WidgetProxy::DEFAULT_INITIALIZERS
Instance Attribute Summary
Attributes inherited from WidgetProxy
#args, #background, #children, #enabled, #focus, #font, #foreground, #parent
Class Method Summary
collapse
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, #content, #css_classes, #dispose, #dom_element, for, #handle_observation_request, #has_style?, #id, #id=, #listener_path, max_id_number_for, max_id_numbers, #name, next_id_number_for, #parent_dom_element, #parent_path, #post_add_content, #post_initialize_child, #property_type_converters, #remove_css_class, #remove_css_classes, reset_max_id_numbers!, #selector, #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
Returns a new instance of DisplayProxy.
10
11
12
|
# File 'lib/glimmer/swt/display_proxy.rb', line 10
def initialize
end
|
Class Method Details
.instance ⇒ Object
5
6
7
|
# File 'lib/glimmer/swt/display_proxy.rb', line 5
def instance
@instance ||= new
end
|
Instance Method Details
#async_exec(&block) ⇒ Object
Also known as:
sync_exec
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/glimmer/swt/display_proxy.rb', line 35
def async_exec(&block)
executer = lambda do
if Document.find('.modal').to_a.empty?
block.call
else
sleep(0.05)
Async::Task.new(&executer)
end
end
Async::Task.new(&executer)
end
|
#element ⇒ Object
Root element representing widget. Must be overridden by subclasses if different from div
19
20
21
|
# File 'lib/glimmer/swt/display_proxy.rb', line 19
def element
'body'
end
|
#listener_dom_element ⇒ Object
23
24
25
|
# File 'lib/glimmer/swt/display_proxy.rb', line 23
def listener_dom_element
Document
end
|
#observation_request_to_event_mapping ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/glimmer/swt/display_proxy.rb', line 49
def observation_request_to_event_mapping
{
'on_swt_keydown' => [
{
event: 'keypress',
event_handler: -> (event_listener) {
-> (event) {
event.singleton_class.define_method(:character) do
which || key_code
end
event_listener.call(event)
}
}
},
{
event: 'keydown',
event_handler: -> (event_listener) {
-> (event) {
event.singleton_class.define_method(:character) do
which || key_code
end
event_listener.call(event) if event.key_code != 13 && (event.key_code == 127 || event.key_code <= 31)
}
}
}
]
}
end
|
#path ⇒ Object
14
15
16
|
# File 'lib/glimmer/swt/display_proxy.rb', line 14
def path
"html body"
end
|
#render ⇒ Object
31
32
33
|
# File 'lib/glimmer/swt/display_proxy.rb', line 31
def render
end
|
#shells ⇒ Object
27
28
29
|
# File 'lib/glimmer/swt/display_proxy.rb', line 27
def shells
@shells ||= []
end
|