Class: Glimmer::DSL::SWT::ListSelectionDataBindingExpression
- Inherits:
-
Expression
- Object
- Expression
- Glimmer::DSL::SWT::ListSelectionDataBindingExpression
- Defined in:
- lib/glimmer/dsl/swt/list_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
33 34 35 36 37 38 39 40 41 |
# File 'lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb', line 33 def can_interpret?(parent, keyword, *args, &block) keyword == 'selection' and block.nil? and parent.respond_to?(:swt_widget) and parent..is_a?(List) and args.size == 1 and args[0].is_a?(DataBinding::ModelBinding) and args[0]..is_a?(Array) end |
#interpret(parent, keyword, *args, &block) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb', line 43 def interpret(parent, keyword, *args, &block) model_binding = args[0] = DataBinding::WidgetBinding.new(parent, 'items') .call(model_binding.) model = model_binding.base_model #TODO make this options observer dependent and all similar observers in widget specific data binding interpretrs .observe(model, model_binding.) property_type = :string property_type = :array if parent.has_style?(:multi) list_selection_binding = DataBinding::ListSelectionBinding.new(parent, property_type) list_selection_binding.call(model_binding.evaluate_property) #TODO check if nested data binding works for list widget and other widgets that need custom data binding list_selection_binding.observe(model, model_binding.property_name_expression) parent. do model_binding.call(list_selection_binding.evaluate_property) end end |