class Glimmer::SWT::CheckboxProxy

Constants

STYLE

TODO add a create method that ensures passing :check style in if not there

Attributes

text[R]

Public Instance Methods

dom() click to toggle source
# File lib/glimmer/swt/checkbox_proxy.rb, line 57
def dom
  check_text = @text
  check_id = id
  check_style = css
  check_class = name
  check_selection = @selection
  options = {type: 'checkbox', id: check_id, name: parent.id, style: check_style, class: check_class, value: check_text, style: 'min-width: 27px;'}
  options[checked: 'checked'] if check_selection
  @dom ||= html {
    span {
      input(options) {
      }
      label(id: label_id, class: label_class, for: check_id) {
        check_text
      }
    }
  }.to_s
end
element() click to toggle source
# File lib/glimmer/swt/checkbox_proxy.rb, line 33
def element
  'input'
end
label_class() click to toggle source
# File lib/glimmer/swt/checkbox_proxy.rb, line 49
def label_class
  "#{name}-label"
end
label_dom_element() click to toggle source
# File lib/glimmer/swt/checkbox_proxy.rb, line 53
def label_dom_element
  Element.find("##{label_id}")
end
label_id() click to toggle source
# File lib/glimmer/swt/checkbox_proxy.rb, line 45
def label_id
  "#{id}-label"
end
observation_request_to_event_mapping() click to toggle source
# File lib/glimmer/swt/checkbox_proxy.rb, line 37
def observation_request_to_event_mapping
  {
    'on_widget_selected' => {
      event: 'change'
    },
  }
end
selection() click to toggle source
# File lib/glimmer/swt/checkbox_proxy.rb, line 24
def selection
  dom_element.prop('checked')
end
selection=(value) click to toggle source
# File lib/glimmer/swt/checkbox_proxy.rb, line 28
def selection=(value)
  @selection = value
  dom_element.prop('checked', @selection)
end
text=(value) click to toggle source
# File lib/glimmer/swt/checkbox_proxy.rb, line 18
def text=(value)
  @text = value
  dom_element.val(@text)
  label_dom_element.html(@text)
end