Sha256: 257c2c14b2bf9847d1ffee54fc4eaddf1b8552be1860fed5fb3d8898931b7a67

Contents?: true

Size: 985 Bytes

Versions: 33

Compression:

Stored size: 985 Bytes

Contents

require 'glimmer/dsl/expression'
require 'glimmer/dsl/parent_expression'
require 'glimmer/swt/widget_proxy'

module Glimmer
  module DSL
    module Opal
      class WidgetExpression < Expression
        include ParentExpression
        
        EXCLUDED_KEYWORDS = %w[shell display]
  
        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

        def interpret(parent, keyword, *args, &block)
          Glimmer::SWT::WidgetProxy.for(keyword, parent, args, block)
        end
        
        def add_content(parent, keyword, *args, &block)
          if parent.rendered? || parent.skip_content_on_render_blocks?
            super(parent, &block)
            parent.post_add_content
          else
            parent.add_content_on_render(&block)
          end
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
glimmer-dsl-opal-0.28.3 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.28.2 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.28.1 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.28.0 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.27.0 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.26.3 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.26.2 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.26.1 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.26.0 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.25.4 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.25.3 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.25.2 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.25.1 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.25.0 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.24.0 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.23.0 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.22.1 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.22.0 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.21.0 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.20.1 lib/glimmer/dsl/opal/widget_expression.rb