Class: Glimmer::SWT::ComboProxy

Inherits:
WidgetProxy show all
Includes:
DataBinding::ObservableElement
Defined in:
lib/glimmer/swt/combo_proxy.rb

Constant Summary

Constants inherited from WidgetProxy

WidgetProxy::DEFAULT_INITIALIZERS

Instance Attribute Summary collapse

Attributes inherited from WidgetProxy

#args, #background, #children, #enabled, #focus, #font, #foreground, #parent, #path

Instance Method Summary collapse

Methods included from DataBinding::ObservableElement

#method_missing

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_dom_element, #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, #render, reset_max_id_numbers!, #selector, #set_attribute, #set_focus, #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, block) ⇒ ComboProxy

Returns a new instance of ComboProxy.



10
11
12
13
# File 'lib/glimmer/swt/combo_proxy.rb', line 10

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

Dynamic Method Handling

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

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



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

def items
  @items
end

#textObject

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#domObject



52
53
54
55
56
57
58
59
60
61
# File 'lib/glimmer/swt/combo_proxy.rb', line 52

def dom
  items = @items
  select_id = id
  select_style = css
  select_class = name
  @dom ||= html {
    select(id: select_id, class: select_class, style: select_style) {
    }
  }.to_s
end

#elementObject



15
16
17
# File 'lib/glimmer/swt/combo_proxy.rb', line 15

def element
  'select'
end

#observation_request_to_event_mappingObject



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/glimmer/swt/combo_proxy.rb', line 38

def observation_request_to_event_mapping
  {
    'on_widget_selected' => {
      event: 'change',
      event_handler: -> (event_listener) {
        -> (event) {
          @text = event.target.value
          event_listener.call(event)
        }
      }
    }
  }
end