Class: Glimmer::DSL::TreeItemsDataBindingExpression

Inherits:
Expression
  • Object
show all
Defined in:
lib/glimmer/dsl/tree_items_data_binding_expression.rb

Instance Method Summary collapse

Methods inherited from Expression

#add_content, #textual?, #widget?

Instance Method Details

#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/glimmer/dsl/tree_items_data_binding_expression.rb', line 10

def can_interpret?(parent, keyword, *args, &block)
  keyword == "items" and
    block.nil? and
    widget?(parent) and
    parent.swt_widget.is_a?(Tree) and
    args.size == 2 and
    args[0].is_a?(DataBinding::ModelBinding) and
    !args[0].evaluate_property.is_a?(Array) and
    args[1].is_a?(Array) and
    !args[1].empty? and
    args[1].first.is_a?(Hash)
end

#interpret(parent, keyword, *args, &block) ⇒ Object



23
24
25
26
27
# File 'lib/glimmer/dsl/tree_items_data_binding_expression.rb', line 23

def interpret(parent, keyword, *args, &block)
  model_binding = args[0]
  tree_properties = args[1]
  DataBinding::TreeItemsBinding.new(parent, model_binding, tree_properties)
end