Class: Glimmer::SWT::ButtonProxy

Inherits:
WidgetProxy show all
Defined in:
lib/glimmer/swt/button_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_child, #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=, #initialize, #listener_dom_element, #listener_path, max_id_number_for, max_id_numbers, #name, next_id_number_for, #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

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

Instance Attribute Details

#textObject

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#domObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/glimmer/swt/button_proxy.rb', line 25

def dom
  input_text = @text
  input_id = id
  input_style = css
  input_args = {}
  input_disabled = @enabled ? {} : {'disabled': 'disabled'}
  input_args = input_args.merge(type: 'password') if has_style?(:password)
  @dom ||= html {
    button(input_args.merge(id: input_id, class: name, style: input_style, style: 'min-width: 27px; min-height: 27px;').merge(input_disabled)) {
      input_text.to_s == '' ? ' ' : input_text
    }
  }.to_s
end

#elementObject



13
14
15
# File 'lib/glimmer/swt/button_proxy.rb', line 13

def element
  'button'
end

#observation_request_to_event_mappingObject



17
18
19
20
21
22
23
# File 'lib/glimmer/swt/button_proxy.rb', line 17

def observation_request_to_event_mapping
  {
    'on_widget_selected' => {
      event: 'click'
    }, 
  }
end