Class: Glimmer::SWT::RadioProxy
Constant Summary
collapse
- STYLE =
TODO add a create method that ensures passing :radio style in if not there
<<~CSS
.radio {
display: inline;
}
.radio-label {
display: inline;
}
.radio-container {
}
CSS
Constants inherited
from WidgetProxy
WidgetProxy::DEFAULT_INITIALIZERS
Instance Attribute Summary
Attributes inherited from WidgetProxy
#args, #background, #children, #disposed?, #enabled, #focus, #font, #foreground, #parent, #path, #rendered
Instance Method Summary
collapse
Methods inherited from WidgetProxy
#add_content_on_render, #add_css_class, #add_css_classes, #add_observer, #apply_property_type_converters, #build_dom, #can_handle_observation_request?, #clear_css_classes, #content, #content_on_render_blocks, #css_classes, #default_observation_request_to_event_mapping, #dispose, #dom_element, #effective_observation_request_to_event_mapping, for, #get_data, #handle_observation_request, #has_style?, #id, #id=, #initialize, #listener_dom_element, #listener_path, max_id_number_for, max_id_numbers, #method_missing, #name, next_id_number_for, #observation_requests, #parent_dom_element, #parent_path, #post_add_content, #post_dispose_child, #post_initialize_child, #property_type_converters, #remove_all_listeners, #remove_css_class, #remove_css_classes, #render, reset_max_id_numbers!, #selector, #set_attribute, #set_data, #set_focus, #style_element, underscored_widget_name, widget_class, widget_exists?, #widget_property_listener_installers
#attribute_getter, #attribute_setter, #get_attribute, #set_attribute
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Glimmer::SWT::WidgetProxy
Instance Method Details
#container_id ⇒ Object
54
55
56
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 54
def container_id
"#{id}-container"
end
|
#container_name ⇒ Object
58
59
60
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 58
def container_name
"#{name}-container"
end
|
#dom ⇒ Object
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 70
def dom
@dom ||= html {
span(id: container_id, class: container_name) {
input(type: 'radio', id: id, class: name, name: parent&.id)
label(id: label_id, class: label_name, for: id) {
text
}
}
}.to_s
end
|
#element ⇒ Object
34
35
36
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 34
def element
'input'
end
|
#label_dom_element ⇒ Object
50
51
52
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 50
def label_dom_element
Document.find(label_path)
end
|
#label_id ⇒ Object
38
39
40
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 38
def label_id
"#{id}-label"
end
|
#label_name ⇒ Object
42
43
44
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 42
def label_name
"#{name}-label"
end
|
#label_path ⇒ Object
46
47
48
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 46
def label_path
"#{parent_path} ##{label_id}"
end
|
#observation_request_to_event_mapping ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 62
def observation_request_to_event_mapping
{
'on_widget_selected' => {
event: 'change'
},
}
end
|
#selection ⇒ Object
26
27
28
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 26
def selection
dom_element.prop('checked')
end
|
#selection=(value) ⇒ Object
30
31
32
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 30
def selection=(value)
dom_element.prop('checked', value)
end
|
#text ⇒ Object
18
19
20
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 18
def text
label_dom_element.html
end
|
#text=(value) ⇒ Object
22
23
24
|
# File 'lib/glimmer/swt/radio_proxy.rb', line 22
def text=(value)
label_dom_element.html(value)
end
|