Class: Glimmer::DSL::Opal::ComboSelectionDataBindingExpression
- Inherits:
-
Expression
- Object
- Expression
- Glimmer::DSL::Opal::ComboSelectionDataBindingExpression
- Defined in:
- lib/glimmer/dsl/opal/combo_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
10 11 12 13 14 15 16 17 |
# File 'lib/glimmer/dsl/opal/combo_selection_data_binding_expression.rb', line 10 def can_interpret?(parent, keyword, *args, &block) keyword == 'selection' and block.nil? and (parent.is_a?(Glimmer::SWT::ComboProxy) || parent.is_a?(Glimmer::SWT::CComboProxy)) and args.size == 1 and args[0].is_a?(DataBinding::ModelBinding) and args[0]..is_a?(Array) end |
#interpret(parent, keyword, *args, &block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/glimmer/dsl/opal/combo_selection_data_binding_expression.rb', line 19 def interpret(parent, keyword, *args, &block) model_binding = args[0] #TODO make this options observer dependent and all similar observers in element specific data binding handlers # TODO consider delegating some of this work element_binding = DataBinding::ElementBinding.new(parent, 'items') element_binding.call(model_binding.) model = model_binding.base_model element_binding.observe(model, model_binding.) element_binding = DataBinding::ElementBinding.new(parent, 'text') element_binding.call(model_binding.evaluate_property) element_binding.observe(model, model_binding.property_name_expression) parent. do model_binding.call(element_binding.evaluate_property) end end |