Class: Glimmer::DSL::Opal::RadioGroupSelectionDataBindingExpression
- Inherits:
-
Expression
- Object
- Expression
- Glimmer::DSL::Opal::RadioGroupSelectionDataBindingExpression
- Defined in:
- lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb
Instance Method Summary collapse
- #can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
- #interpret(parent, keyword, *args, &block) ⇒ Object
Instance Method Details
#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
31 32 33 34 35 36 37 38 |
# File 'lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb', line 31 def can_interpret?(parent, keyword, *args, &block) keyword == 'selection' and block.nil? and (parent.is_a?(Glimmer::SWT::Custom::RadioGroup) or (parent.is_a?(Glimmer::UI::CustomWidget) and parent.body_root.is_a?(Glimmer::SWT::Custom::RadioGroup)) ) and args.size == 1 and args[0].is_a?(DataBinding::ModelBinding) and args[0]..is_a?(Array) end |
#interpret(parent, keyword, *args, &block) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb', line 40 def interpret(parent, keyword, *args, &block) model_binding = args[0] #TODO make this options observer dependent and all similar observers in widget specific data binding handlers # TODO consider delegating some of this work = DataBinding::ElementBinding.new(parent, 'items') .call(model_binding.) model = model_binding.base_model .observe(model, model_binding.) = DataBinding::ElementBinding.new(parent, 'selection') .call(model_binding.evaluate_property) .observe(model, model_binding.property_name_expression) parent. do model_binding.call(.evaluate_property) end end |