Class: Glimmer::SWT::MessageBoxProxy
- Inherits:
-
Object
- Object
- Glimmer::SWT::MessageBoxProxy
- Defined in:
- lib/glimmer/swt/message_box_proxy.rb
Overview
Proxy for org.eclipse.swt.widgets.Shell
Follows the Proxy Design Pattern
Instance Attribute Summary collapse
-
#swt_widget ⇒ Object
readonly
Returns the value of attribute swt_widget.
Instance Method Summary collapse
- #attribute_getter(attribute_name) ⇒ Object
-
#attribute_setter(attribute_name) ⇒ Object
TODO refactor the following methods to put in a JavaBean mixin or somethin (perhaps contribute to OSS project too).
- #get_attribute(attribute_name) ⇒ Object
- #has_attribute?(attribute_name, *args) ⇒ Boolean
-
#initialize(parent, style) ⇒ MessageBoxProxy
constructor
A new instance of MessageBoxProxy.
- #open ⇒ Object
- #set_attribute(attribute_name, *args) ⇒ Object
Constructor Details
#initialize(parent, style) ⇒ MessageBoxProxy
Returns a new instance of MessageBoxProxy.
16 17 18 19 20 |
# File 'lib/glimmer/swt/message_box_proxy.rb', line 16 def initialize(parent, style) parent = parent. if parent.respond_to?(:swt_widget) && parent..is_a?(Shell) @temporary_parent = parent = Glimmer::SWT::ShellProxy.new. if parent.nil? = MessageBox.new(parent, style) end |
Instance Attribute Details
#swt_widget ⇒ Object (readonly)
Returns the value of attribute swt_widget.
14 15 16 |
# File 'lib/glimmer/swt/message_box_proxy.rb', line 14 def end |
Instance Method Details
#attribute_getter(attribute_name) ⇒ Object
33 34 35 |
# File 'lib/glimmer/swt/message_box_proxy.rb', line 33 def attribute_getter(attribute_name) "get#{attribute_name.to_s.camelcase(:upper)}" end |
#attribute_setter(attribute_name) ⇒ Object
TODO refactor the following methods to put in a JavaBean mixin or somethin (perhaps contribute to OSS project too)
29 30 31 |
# File 'lib/glimmer/swt/message_box_proxy.rb', line 29 def attribute_setter(attribute_name) "set#{attribute_name.to_s.camelcase(:upper)}" end |
#get_attribute(attribute_name) ⇒ Object
45 46 47 |
# File 'lib/glimmer/swt/message_box_proxy.rb', line 45 def get_attribute(attribute_name) .send(attribute_getter(attribute_name)) end |
#has_attribute?(attribute_name, *args) ⇒ Boolean
37 38 39 |
# File 'lib/glimmer/swt/message_box_proxy.rb', line 37 def has_attribute?(attribute_name, *args) .respond_to?(attribute_setter(attribute_name), args) end |
#open ⇒ Object
22 23 24 25 |
# File 'lib/glimmer/swt/message_box_proxy.rb', line 22 def open .open @temporary_parent&.dispose end |
#set_attribute(attribute_name, *args) ⇒ Object
41 42 43 |
# File 'lib/glimmer/swt/message_box_proxy.rb', line 41 def set_attribute(attribute_name, *args) .send(attribute_setter(attribute_name), *args) unless .send(attribute_getter(attribute_name)) == args.first end |