lib/glimmer/swt/button_proxy.rb in glimmer-dsl-opal-0.4.0 vs lib/glimmer/swt/button_proxy.rb in glimmer-dsl-opal-0.5.0
- old
+ new
@@ -1,10 +1,24 @@
require 'glimmer/swt/widget_proxy'
+require 'glimmer/swt/radio_proxy'
+require 'glimmer/swt/checkbox_proxy'
module Glimmer
module SWT
class ButtonProxy < WidgetProxy
+ class << self
+ def create(parent, args)
+ if args.to_a.include?(:radio)
+ RadioProxy.new(parent, args)
+ elsif args.to_a.include?(:check)
+ CheckboxProxy.new(parent, args)
+ else
+ new(parent, args)
+ end
+ end
+ end
+
attr_reader :text
def text=(value)
@text = value
dom_element.html(@text)
@@ -16,10 +30,10 @@
def observation_request_to_event_mapping
{
'on_widget_selected' => {
event: 'click'
- },
+ },
}
end
def dom
input_text = @text