Class: Glimmer::SWT::WidgetListenerProxy
- Inherits:
-
Object
- Object
- Glimmer::SWT::WidgetListenerProxy
- Defined in:
- lib/glimmer/swt/widget_listener_proxy.rb
Overview
Proxy for widget listeners
Follows the Proxy Design Pattern
Instance Attribute Summary collapse
-
#event_type ⇒ Object
readonly
Returns the value of attribute event_type.
-
#swt_constant ⇒ Object
readonly
Returns the value of attribute swt_constant.
-
#swt_display ⇒ Object
readonly
Returns the value of attribute swt_display.
-
#swt_listener ⇒ Object
readonly
Returns the value of attribute swt_listener.
-
#swt_listener_class ⇒ Object
readonly
Returns the value of attribute swt_listener_class.
-
#swt_listener_method ⇒ Object
readonly
Returns the value of attribute swt_listener_method.
-
#swt_widget ⇒ Object
readonly
Returns the value of attribute swt_widget.
-
#widget_add_listener_method ⇒ Object
readonly
Returns the value of attribute widget_add_listener_method.
Instance Method Summary collapse
- #deregister ⇒ Object (also: #unregister)
-
#initialize(swt_widget: nil, swt_display: nil, swt_listener:, widget_add_listener_method: nil, swt_listener_class: nil, swt_listener_method: nil, event_type: nil, swt_constant: nil, filter: false) ⇒ WidgetListenerProxy
constructor
A new instance of WidgetListenerProxy.
- #widget_remove_listener_method ⇒ Object
Constructor Details
#initialize(swt_widget: nil, swt_display: nil, swt_listener:, widget_add_listener_method: nil, swt_listener_class: nil, swt_listener_method: nil, event_type: nil, swt_constant: nil, filter: false) ⇒ WidgetListenerProxy
Returns a new instance of WidgetListenerProxy.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 31 def initialize(swt_widget:nil, swt_display:nil, swt_listener:, widget_add_listener_method: nil, swt_listener_class: nil, swt_listener_method: nil, event_type: nil, swt_constant: nil, filter: false) @swt_widget = @swt_display = swt_display @filter = filter @swt_listener = swt_listener @widget_add_listener_method = @swt_listener_class = swt_listener_class @swt_listener_method = swt_listener_method @event_type = event_type @swt_constant = swt_constant end |
Instance Attribute Details
#event_type ⇒ Object (readonly)
Returns the value of attribute event_type.
29 30 31 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 29 def event_type @event_type end |
#swt_constant ⇒ Object (readonly)
Returns the value of attribute swt_constant.
29 30 31 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 29 def swt_constant @swt_constant end |
#swt_display ⇒ Object (readonly)
Returns the value of attribute swt_display.
29 30 31 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 29 def swt_display @swt_display end |
#swt_listener ⇒ Object (readonly)
Returns the value of attribute swt_listener.
29 30 31 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 29 def swt_listener @swt_listener end |
#swt_listener_class ⇒ Object (readonly)
Returns the value of attribute swt_listener_class.
29 30 31 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 29 def swt_listener_class @swt_listener_class end |
#swt_listener_method ⇒ Object (readonly)
Returns the value of attribute swt_listener_method.
29 30 31 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 29 def swt_listener_method @swt_listener_method end |
#swt_widget ⇒ Object (readonly)
Returns the value of attribute swt_widget.
29 30 31 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 29 def @swt_widget end |
#widget_add_listener_method ⇒ Object (readonly)
Returns the value of attribute widget_add_listener_method.
29 30 31 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 29 def @widget_add_listener_method end |
Instance Method Details
#deregister ⇒ Object Also known as: unregister
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 47 def deregister return if @swt_widget&.is_disposed || @swt_display&.is_disposed if @swt_display if @filter @swt_display.removeFilter(@event_type, @swt_listener) else @swt_display.removeListener(@event_type, @swt_listener) end elsif @event_type DisplayProxy.instance.auto_exec do @swt_widget.removeListener(@event_type, @swt_listener) end else DisplayProxy.instance.auto_exec do @swt_widget.send(, @swt_listener) end end end |
#widget_remove_listener_method ⇒ Object
43 44 45 |
# File 'lib/glimmer/swt/widget_listener_proxy.rb', line 43 def @widget_add_listener_method.sub('add', 'remove') end |