class Glimmer::SWT::ComboProxy
Attributes
items[R]
text[R]
Public Class Methods
new(parent, args, block)
click to toggle source
Calls superclass method
# File lib/glimmer/swt/combo_proxy.rb, line 11 def initialize(parent, args, block) super(parent, args, block) @items = [] end
Public Instance Methods
dom()
click to toggle source
# File lib/glimmer/swt/combo_proxy.rb, line 61 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
element()
click to toggle source
# File lib/glimmer/swt/combo_proxy.rb, line 16 def element 'select' end
items=(the_items)
click to toggle source
# File lib/glimmer/swt/combo_proxy.rb, line 33 def items=(the_items) @items = the_items items_dom = items.to_a.map do |item| option_hash = {value: item} option_hash[:selected] = 'selected' if @text == item html { option(option_hash) { item } }.to_s end dom_element.html(items_dom) end
observation_request_to_event_mapping()
click to toggle source
# File lib/glimmer/swt/combo_proxy.rb, line 47 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
selection()
click to toggle source
# File lib/glimmer/swt/combo_proxy.rb, line 25 def selection text end
selection=(value)
click to toggle source
# File lib/glimmer/swt/combo_proxy.rb, line 29 def selection=(value) self.text = value end
text=(value)
click to toggle source
# File lib/glimmer/swt/combo_proxy.rb, line 20 def text=(value) @text = value dom_element.val(value) end