Class: Glimmer::SWT::CComboProxy

Inherits:
ComboProxy show all
Defined in:
lib/glimmer/swt/c_combo_proxy.rb

Constant Summary

Constants inherited from WidgetProxy

WidgetProxy::DEFAULT_INITIALIZERS, WidgetProxy::JS_KEY_CODE_TO_SWT_KEY_CODE_MAP, WidgetProxy::JS_LOCATION_TO_SWT_KEY_LOCATION_MAP, WidgetProxy::SWT_CURSOR_TO_CSS_CURSOR_MAP

Instance Attribute Summary

Attributes inherited from ComboProxy

#items, #text

Attributes inherited from WidgetProxy

#args, #background, #children, #cursor, #disposed?, #enabled, #focus, #font, #foreground, #menu, #menu_requested, #menu_x, #menu_y, #parent, #path, #rendered

Instance Method Summary collapse

Methods inherited from ComboProxy

#dom, #element, #initialize, #selection, #selection=

Methods included from DataBinding::ObservableElement

#method_missing

Methods inherited from WidgetProxy

#add_content_on_render, #add_css_class, #add_css_classes, #add_observer, #apply_property_type_converters, #attach, #build_dom, #can_handle_observation_request?, #clear_css_classes, #content, #content_on_render_blocks, #css_classes, #default_observation_request_to_event_mapping, #dialog_ancestor, #dispose, #dom_element, #effective_observation_request_to_event_mapping, #element, #event_handling_suspended?, #event_listener_proxies, for, #get_data, #handle_javascript_observation_request, #handle_observation_request, #has_style?, #id, #id=, #initialize, #listener_dom_element, #listener_path, #listeners, #listeners_for, max_id_number_for, max_id_numbers, #method_missing, #name, next_id_number_for, #observation_requests, #parent_dom_element, #parent_path, #parents, #post_dispose_child, #post_initialize_child, #print, #property_type_converters, #reattach, #remove_all_listeners, #remove_css_class, #remove_css_classes, #remove_event_listener_proxies, #render, reset_max_id_numbers!, #resume_event_handling, #selector, #set_attribute, #set_data, #set_focus, #shell, #skip_content_on_render_blocks?, #style_element, #suspend_event_handling, #swt_data, #swt_widget, underscored_widget_name, widget_class, widget_exists?, widget_handling_listener, #widget_property_listener_installers

Methods included from PropertyOwner

#attribute_getter, #attribute_setter, #get_attribute, #set_attribute

Constructor Details

This class inherits a constructor from Glimmer::SWT::ComboProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::DataBinding::ObservableElement

Instance Method Details

#c_combo_dom_elementObject



50
51
52
# File 'lib/glimmer/swt/c_combo_proxy.rb', line 50

def c_combo_dom_element
  Document.find(c_combo_path)
end

#c_combo_pathObject



46
47
48
# File 'lib/glimmer/swt/c_combo_proxy.rb', line 46

def c_combo_path
  "##{id}-button"
end

#c_combo_text_elementObject



58
59
60
# File 'lib/glimmer/swt/c_combo_proxy.rb', line 58

def c_combo_text_element
  Document.find(c_combo_text_path)
end

#c_combo_text_pathObject



54
55
56
# File 'lib/glimmer/swt/c_combo_proxy.rb', line 54

def c_combo_text_path
  c_combo_path + ' .ui-selectmenu-text'
end

#font=(value) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/glimmer/swt/c_combo_proxy.rb', line 33

def font=(value)
  @font = value.is_a?(FontProxy) ? value : FontProxy.new(self, value)
  c_combo_dom_element.css('font-family', @font.name) unless @font.nil?
  c_combo_dom_element.css('font-style', 'italic') if @font&.style == :italic
  c_combo_dom_element.css('font-weight', 'bold') if @font&.style == :bold
  c_combo_dom_element.css('font-size', "#{@font.height}px") unless @font.nil?
end

#observation_request_to_event_mappingObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/glimmer/swt/c_combo_proxy.rb', line 62

def observation_request_to_event_mapping
  super.merge(
    'on_widget_selected' => [
      {
        event: 'selectmenuchange',
        event_handler: -> (event_listener) {
          -> (event) {
            self.text = event.target.value
            event_listener.call(event)
          }
        }
      },
    ],
  )
end

#post_add_contentObject



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

def post_add_content
  dom_element.selectmenu
  c_combo_dom_element.css('width', 'initial')
end

#text=(value) ⇒ Object



41
42
43
44
# File 'lib/glimmer/swt/c_combo_proxy.rb', line 41

def text=(value)
  super(value)
  c_combo_text_element.text(value)
end