Module: Glimmer::SWT::PropertyOwner

Included in:
Custom::Shape, LayoutDataProxy, LayoutProxy, WidgetProxy
Defined in:
lib/glimmer/swt/property_owner.rb

Overview

Adapts Glimmer UI classes to SWT JavaBean property owner classes (which are now adapted to Opal)

Instance Method Summary collapse

Instance Method Details

#attribute_getter(attribute_name) ⇒ Object



19
20
21
# File 'lib/glimmer/swt/property_owner.rb', line 19

def attribute_getter(attribute_name)
  attribute_name.to_s.underscore
end

#attribute_setter(attribute_name) ⇒ Object



15
16
17
# File 'lib/glimmer/swt/property_owner.rb', line 15

def attribute_setter(attribute_name)
  "#{attribute_name.to_s.underscore}="
end

#get_attribute(attribute_name) ⇒ Object

TODO consider adding has_attribute?



7
8
9
# File 'lib/glimmer/swt/property_owner.rb', line 7

def get_attribute(attribute_name)
  send(attribute_getter(attribute_name))
end

#set_attribute(attribute_name, *args) ⇒ Object



11
12
13
# File 'lib/glimmer/swt/property_owner.rb', line 11

def set_attribute(attribute_name, *args)
  send(attribute_setter(attribute_name), *args) unless args.size == 1 && send(attribute_getter(attribute_name)) == args.first
end