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, #disposed?, #enabled, #focus, #font, #foreground, #menu, #menu_requested, #parent, #path, #rendered

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WidgetProxy

#add_content_on_render, #add_css_class, #add_css_classes, #add_observer, #apply_property_type_converters, #build_dom, #can_handle_observation_request?, #clear_css_classes, #content, #content_on_render_blocks, #css_classes, #default_observation_request_to_event_mapping, #dispose, #dom_element, #effective_observation_request_to_event_mapping, #event_listener_proxies, for, #get_data, #handle_observation_request, #has_style?, #id, #id=, #initialize, #layout, #listener_dom_element, #listener_path, max_id_number_for, max_id_numbers, #method_missing, #name, next_id_number_for, #observation_requests, #pack, #parent_dom_element, #parent_path, #post_add_content, #post_dispose_child, #post_initialize_child, #property_type_converters, #remove_all_listeners, #remove_css_class, #remove_css_classes, #remove_event_listener_proxies, #render, reset_max_id_numbers!, #selector, #set_attribute, #set_data, #set_focus, #skip_content_on_render_blocks?, #style_element, #swt_widget, 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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::SWT::WidgetProxy

Instance Attribute Details

#textObject

Returns the value of attribute text.



20
21
22
# File 'lib/glimmer/swt/button_proxy.rb', line 20

def text
  @text
end

Class Method Details

.create(keyword, parent, args, block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/glimmer/swt/button_proxy.rb', line 9

def create(keyword, parent, args, block)
  if args.to_a.include?(:radio)
    RadioProxy.new(parent, args, block)
  elsif args.to_a.include?(:check)
    CheckboxProxy.new(parent, args, block)
  else
    new(parent, args, block)
  end
end

Instance Method Details

#domObject



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

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: 32px; min-height: 32px;').merge(input_disabled)) {
      input_text.to_s == '' ? ' ' : input_text
    }
  }.to_s
end

#elementObject



27
28
29
# File 'lib/glimmer/swt/button_proxy.rb', line 27

def element
  'button'
end

#observation_request_to_event_mappingObject



31
32
33
34
35
36
37
# File 'lib/glimmer/swt/button_proxy.rb', line 31

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