Class: Glimmer::DSL::Opal::WidgetExpression

Inherits:
Expression
  • Object
show all
Includes:
ParentExpression
Defined in:
lib/glimmer/dsl/opal/widget_expression.rb

Constant Summary collapse

EXCLUDED_KEYWORDS =
%w[shell display]

Instance Method Summary collapse

Instance Method Details

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



23
24
25
26
27
28
29
30
# File 'lib/glimmer/dsl/opal/widget_expression.rb', line 23

def add_content(parent, keyword, *args, &block)
  if parent.rendered? || parent.skip_content_on_render_blocks?
    super(parent, keyword, *args, &block)
    parent.post_add_content
  else
    parent.add_content_on_render(&block)
  end
end

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

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/glimmer/dsl/opal/widget_expression.rb', line 13

def can_interpret?(parent, keyword, *args, &block)
  !EXCLUDED_KEYWORDS.include?(keyword) and
    parent.is_a?(Glimmer::SWT::WidgetProxy) and
    Glimmer::SWT::WidgetProxy.widget_class(keyword)
end

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



19
20
21
# File 'lib/glimmer/dsl/opal/widget_expression.rb', line 19

def interpret(parent, keyword, *args, &block)
  Glimmer::SWT::WidgetProxy.for(keyword, parent, args, block)
end