Class: Glimmer::SWT::TabItemProxy
- Inherits:
-
CompositeProxy
- Object
- WidgetProxy
- CompositeProxy
- Glimmer::SWT::TabItemProxy
- Includes:
- Glimmer
- Defined in:
- lib/glimmer/swt/tab_item_proxy.rb
Constant Summary
Constants inherited from WidgetProxy
WidgetProxy::DEFAULT_INITIALIZERS
Instance Attribute Summary collapse
-
#content_visible ⇒ Object
readonly
Returns the value of attribute content_visible.
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from CompositeProxy
Attributes inherited from WidgetProxy
#args, #background, #children, #enabled, #font, #foreground, #parent, #path
Instance Method Summary collapse
-
#dom ⇒ Object
This contains the tab content.
- #hide ⇒ Object
-
#initialize(parent, args) ⇒ TabItemProxy
constructor
A new instance of TabItemProxy.
- #listener_path ⇒ Object
- #observation_request_to_event_mapping ⇒ Object
- #selector ⇒ Object
- #show ⇒ Object
-
#tab_dom ⇒ Object
This contains the clickable tab area with tab names.
- #tab_dom_element ⇒ Object
- #tab_id ⇒ Object
- #tab_path ⇒ Object
Methods inherited from WidgetProxy
#add_child, #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, #element, for, #handle_observation_request, #has_style?, #id, #id=, #listener_dom_element, max_id_number_for, max_id_numbers, #name, next_id_number_for, #parent_dom_element, #parent_path, #property_type_converters, #remove_css_class, #remove_css_classes, #render, reset_max_id_numbers!, #set_attribute, #style_element, underscored_widget_name, widget_class, widget_exists?, #widget_property_listener_installers
Methods included from PropertyOwner
#attribute_getter, #attribute_setter, #get_attribute, #set_attribute
Constructor Details
#initialize(parent, args) ⇒ TabItemProxy
Returns a new instance of TabItemProxy.
9 10 11 12 13 14 15 16 17 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 9 def initialize(parent, args) super(parent, args) content { { @parent.hide_all_tab_content show } } end |
Instance Attribute Details
#content_visible ⇒ Object (readonly)
Returns the value of attribute content_visible.
7 8 9 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 7 def content_visible @content_visible end |
#text ⇒ Object
Returns the value of attribute text.
7 8 9 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 7 def text @text end |
Instance Method Details
#dom ⇒ Object
This contains the tab content
74 75 76 77 78 79 80 81 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 74 def dom tab_item_id = id tab_item_class_string = [name, 'hide'].join(' ') @dom ||= html { div(id: tab_item_id, class: tab_item_class_string) { } }.to_s end |
#hide ⇒ Object
25 26 27 28 29 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 25 def hide @content_visible = false dom_element.add_class('hide') tab_dom_element.remove_class('selected') end |
#listener_path ⇒ Object
48 49 50 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 48 def listener_path tab_path end |
#observation_request_to_event_mapping ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 40 def observation_request_to_event_mapping { 'on_widget_selected' => { event: 'click' }, } end |
#selector ⇒ Object
36 37 38 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 36 def selector super + '-tab' end |
#show ⇒ Object
19 20 21 22 23 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 19 def show @content_visible = true dom_element.remove_class('hide') tab_dom_element.add_class('selected') end |
#tab_dom ⇒ Object
This contains the clickable tab area with tab names
65 66 67 68 69 70 71 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 65 def tab_dom @tab_dom ||= html { (id: tab_id, class: "tab") { @text } }.to_s end |
#tab_dom_element ⇒ Object
56 57 58 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 56 def tab_dom_element Document.find(tab_path) end |
#tab_id ⇒ Object
60 61 62 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 60 def tab_id id + '-tab' end |
#tab_path ⇒ Object
52 53 54 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 52 def tab_path "#{parent.tabs_path} > ##{tab_id}" end |