Class: Glimmer::SWT::TabFolderProxy

Inherits:
WidgetProxy show all
Defined in:
lib/glimmer/swt/tab_folder_proxy.rb

Constant Summary

Constants inherited from WidgetProxy

WidgetProxy::DEFAULT_INITIALIZERS

Instance Attribute Summary collapse

Attributes inherited from WidgetProxy

#args, #background, #children, #enabled, #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, #content, #css_classes, #dispose, #dom_element, #element, for, #handle_observation_request, #has_style?, #id, #id=, #listener_dom_element, #listener_path, max_id_number_for, max_id_numbers, #name, next_id_number_for, #observation_request_to_event_mapping, #parent_dom_element, #parent_path, #property_type_converters, #remove_css_class, #remove_css_classes, #render, reset_max_id_numbers!, #selector, #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) ⇒ TabFolderProxy

Returns a new instance of TabFolderProxy.



8
9
10
11
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 8

def initialize(parent, args)
  super(parent, args)
  @tabs = []
end

Instance Attribute Details

#tabsObject (readonly)

Returns the value of attribute tabs.



6
7
8
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 6

def tabs
  @tabs
end

Instance Method Details

#add_child(child) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 13

def add_child(child)
  unless @children.include?(child)
    @children << child 
    tabs_dom_element.append(child.tab_dom)
    child.render
  end
  
  if @children.size == 1
    child.show
  end
end

#domObject



41
42
43
44
45
46
47
48
49
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 41

def dom
  tab_folder_id = id
  tab_folder_id_style = css
  @dom ||= html {
    div(id: tab_folder_id, style: tab_folder_id_style, class: 'tab-folder') {
      div(id: tabs_id, class: 'tabs')
    }
  }.to_s
end

#hide_all_tab_contentObject



25
26
27
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 25

def hide_all_tab_content
  @children.each(&:hide)
end

#tabs_dom_elementObject



37
38
39
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 37

def tabs_dom_element
  Document.find(tabs_path)
end

#tabs_idObject



33
34
35
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 33

def tabs_id
  id + '-tabs'
end

#tabs_pathObject



29
30
31
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 29

def tabs_path
  path + " > ##{tabs_id}"
end