Class: Glimmer::SWT::ProgressBarProxy

Inherits:
WidgetProxy show all
Defined in:
lib/glimmer/swt/progress_bar_proxy.rb

Constant Summary collapse

STYLE =
<<~CSS
  .ui-progressbar.vertical {
    transform: rotate(-180deg);
    height: 140px;
    width: 28px;
    margin-left: auto;
    margin-right: auto;
  }
CSS

Constants inherited from WidgetProxy

WidgetProxy::DEFAULT_INITIALIZERS, WidgetProxy::JS_KEY_CODE_TO_SWT_KEY_CODE_MAP, WidgetProxy::JS_LOCATION_TO_SWT_KEY_LOCATION_MAP, WidgetProxy::SWT_CURSOR_TO_CSS_CURSOR_MAP

Instance Attribute Summary collapse

Attributes inherited from WidgetProxy

#args, #background, #children, #cursor, #disposed?, #enabled, #focus, #font, #foreground, #menu, #menu_requested, #menu_x, #menu_y, #parent, #path, #rendered

Instance Method Summary collapse

Methods inherited from WidgetProxy

#add_content_on_render, #add_css_class, #add_css_classes, #add_observer, #apply_property_type_converters, #attach, #build_dom, #can_handle_observation_request?, #clear_css_classes, #content, #content_on_render_blocks, #css_classes, #default_observation_request_to_event_mapping, #dialog_ancestor, #dispose, #dom_element, #effective_observation_request_to_event_mapping, #event_handling_suspended?, #event_listener_proxies, for, #get_data, #handle_javascript_observation_request, #handle_observation_request, #has_style?, #id, #id=, #listener_dom_element, #listener_path, #listeners, #listeners_for, max_id_number_for, max_id_numbers, #method_missing, #name, next_id_number_for, #observation_request_to_event_mapping, #observation_requests, #parent_dom_element, #parent_path, #parents, #post_add_content, #post_dispose_child, #post_initialize_child, #print, #property_type_converters, #reattach, #remove_all_listeners, #remove_css_class, #remove_css_classes, #remove_event_listener_proxies, #render, reset_max_id_numbers!, #resume_event_handling, #selector, #set_attribute, #set_data, #set_focus, #shell, #skip_content_on_render_blocks?, #style_element, #suspend_event_handling, #swt_data, #swt_widget, underscored_widget_name, widget_class, widget_exists?, widget_handling_listener, #widget_property_listener_installers

Methods included from PropertyOwner

#attribute_getter, #attribute_setter, #get_attribute, #set_attribute

Constructor Details

#initialize(parent, args, block) ⇒ ProgressBarProxy

Returns a new instance of ProgressBarProxy.



42
43
44
45
46
47
48
49
50
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 42

def initialize(parent, args, block)
  @vertical = args.detect { |arg| SWTProxy[arg] == SWTProxy[:vertical] }
  @indeterminate = args.detect { |arg| SWTProxy[arg] == SWTProxy[:indeterminate] }
  super(parent, args, block)
  # initialize manually if vertical
  dom_element.progressbar if horizontal?
  self.minimum = 0
  self.selection = false if indeterminate?
end

Dynamic Method Handling

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

Instance Attribute Details

#indeterminateObject (readonly) Also known as: indeterminate?

Returns the value of attribute indeterminate.



37
38
39
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 37

def indeterminate
  @indeterminate
end

#maximumObject

Returns the value of attribute maximum.



37
38
39
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 37

def maximum
  @maximum
end

#minimumObject

ignored, only there for API compatibility



38
39
40
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 38

def minimum
  @minimum
end

#selectionObject

Returns the value of attribute selection.



37
38
39
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 37

def selection
  @selection
end

#stateObject

ignored, only there for API compatibility



38
39
40
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 38

def state
  @state
end

#verticalObject (readonly) Also known as: vertical?

Returns the value of attribute vertical.



37
38
39
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 37

def vertical
  @vertical
end

Instance Method Details

#domObject



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 90

def dom
  progress_bar_id = id
  progress_bar_class = name
  progress_bar_class += ' vertical ui-progressbar ui-corner-all ui-widget ui-widget-content' if vertical?
  progress_bar_class += ' indeterminate' if indeterminate?
  @dom ||= html {
    div(id: progress_bar_id, class: progress_bar_class) {
      if vertical?
        div(class: 'ui-progressbar-value ui-corner-left ui-widget-header', style: 'height: 0%;')
      end
    }
  }.to_s
end

#elementObject



82
83
84
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 82

def element
  'div'
end

#horizontalObject Also known as: horizontal?



52
53
54
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 52

def horizontal
  !vertical
end

#selection_dom_elementObject



86
87
88
# File 'lib/glimmer/swt/progress_bar_proxy.rb', line 86

def selection_dom_element
  dom_element.find('.ui-progressbar-value')
end