Class: Glimmer::SWT::DisplayProxy

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

Constant Summary

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

Class Attribute Summary collapse

Attributes inherited from WidgetProxy

#args, #background, #children, #cursor, #disposed?, #enabled, #focus, #font, #foreground, #menu, #menu_requested, #menu_x, #menu_y, #parent, #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, #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_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, 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

#initializeDisplayProxy

Returns a new instance of DisplayProxy.



16
17
18
# File 'lib/glimmer/swt/display_proxy.rb', line 16

def initialize
  # Do not call super
end

Dynamic Method Handling

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

Class Attribute Details

.open_custom_shells_in_current_windowObject Also known as: open_custom_shells_in_current_window?

Returns the value of attribute open_custom_shells_in_current_window.



12
13
14
# File 'lib/glimmer/swt/display_proxy.rb', line 12

def open_custom_shells_in_current_window
  @open_custom_shells_in_current_window
end

Class Method Details

.instanceObject



8
9
10
# File 'lib/glimmer/swt/display_proxy.rb', line 8

def instance
  @instance ||= new
end

Instance Method Details

#async_exec(proc_tracker = nil, &block) ⇒ Object Also known as: sync_exec



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/glimmer/swt/display_proxy.rb', line 73

def async_exec(proc_tracker = nil, &block)
  block = proc_tracker unless proc_tracker.nil?
  queue = nil # general queue
  if !proc_tracker.nil? && proc_tracker.invoked_from.to_s == 'open' && modal_open? &&
     (
       proc_tracker.owner.is_a?(MessageBoxProxy) ||
       (dialog_open? && proc_tracker.owner.is_a?(DialogProxy) && opened_dialogs.last == WidgetProxy.widget_handling_listener&.dialog_ancestor)
     )
    queue = WidgetProxy.widget_handling_listener
  end
  return block.call if !modal_open?
  schedule_async_exec(block, queue)
end

#beepObject



69
70
71
# File 'lib/glimmer/swt/display_proxy.rb', line 69

def beep
  # TODO (simulate beep from SWT display flashing the screen and making a noise if possible)
end

#dialog_open?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/glimmer/swt/display_proxy.rb', line 53

def dialog_open?
  dialogs.any?(&:open?)
end

#dialogsObject



41
42
43
# File 'lib/glimmer/swt/display_proxy.rb', line 41

def dialogs
  @dialogs ||= []
end

#elementObject

Root element representing widget. Must be overridden by subclasses if different from div



25
26
27
# File 'lib/glimmer/swt/display_proxy.rb', line 25

def element
  'body'
end

#listener_dom_elementObject



29
30
31
# File 'lib/glimmer/swt/display_proxy.rb', line 29

def listener_dom_element
  Document
end

#message_box_open?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/glimmer/swt/display_proxy.rb', line 49

def message_box_open?
  message_boxes.any?(&:open?)
end

#message_boxesObject



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

def message_boxes
  @message_boxes ||= []
end

Returns:

  • (Boolean)


61
62
63
# File 'lib/glimmer/swt/display_proxy.rb', line 61

def modal_open?
  message_box_open? or dialog_open?
end

#modalsObject



45
46
47
# File 'lib/glimmer/swt/display_proxy.rb', line 45

def modals
  message_boxes + dialogs
end

#opened_dialogsObject



57
58
59
# File 'lib/glimmer/swt/display_proxy.rb', line 57

def opened_dialogs
  dialogs.select(&:open?)
end

#pathObject



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

def path
  "html body"
end

#renderObject



65
66
67
# File 'lib/glimmer/swt/display_proxy.rb', line 65

def render
  # No rendering as body is rendered as part of ShellProxy.. this class only serves as an SWT Display utility
end

#shellsObject



33
34
35
# File 'lib/glimmer/swt/display_proxy.rb', line 33

def shells
  @shells ||= []
end