Class: HtmlGrid::AbstractComposite

Inherits:
Component
  • Object
show all
Defined in:
lib/htmlgrid/composite.rb

Direct Known Subclasses

Composite, TagComposite

Constant Summary collapse

LABELS =
false
LEGACY_INTERFACE =
true
SYMBOL_MAP =
{}
CSS_MAP =
{}
CSS_ID_MAP =
{}
CSS_STYLE_MAP =
{}
CSS_CLASS =
nil
CSS_ID =
nil
DEFAULT_CLASS =
Value
LOOKANDFEEL_MAP =
{}

Constants inherited from Component

Component::HTML_ATTRIBUTES, Component::HTTP_HEADERS, Component::LABEL

Instance Attribute Summary

Attributes inherited from Component

#attributes, #dojo_tooltip, #model, #value

Instance Method Summary collapse

Methods inherited from Component

#_to_html, #autofill?, #css_class, #css_class=, #css_id, #css_id=, #dojo_9?, #dojo_dynamic_html, #dojo_parse_widgets, #dojo_tag, #dojo_title=, #dynamic_html, #escape, #escape_symbols, #formname, #http_headers, #initialize, #label=, #label?, #onclick=, #onload=, #onsubmit=, #set_attribute, #tabindex=, #to_html

Constructor Details

This class inherits a constructor from HtmlGrid::Component

Instance Method Details

#create(component, model = @model) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/htmlgrid/composite.rb', line 57

def create(component, model=@model)
	if(component.is_a? Class)
		component.new(model, @session, self)
	elsif(component.is_a? Symbol)
		if(self.respond_to?(component, true))
			args = [model]
			if(self::class::LEGACY_INTERFACE)
				args.push(@session)
			end
			self.send(component, *args)
		elsif(klass = symbol_map[component])
			klass.new(component, model, @session, self)
		else
			self::class::DEFAULT_CLASS.new(component, model, @session, self)
		end
	elsif(component.is_a? String)
		val = @lookandfeel.lookup(component) { component.to_s }
      val.gsub(@@nl2br_ptrn, '<br>')
	end
rescue StandardError => exc
	exc.backtrace.push(sprintf("%s::COMPONENTS[%s] in create(%s)", 
		self.class, components.key(component).inspect, component))
	raise exc
end

#initObject



52
53
54
55
56
# File 'lib/htmlgrid/composite.rb', line 52

def init
	super
	setup_grid()
	compose()
end