Class: HtmlGrid::NamedComponent

Inherits:
Component show all
Defined in:
lib/htmlgrid/namedcomponent.rb

Constant Summary

Constants inherited from Component

Component::CSS_CLASS, Component::CSS_ID, Component::HTML_ATTRIBUTES, Component::HTTP_HEADERS, Component::LABEL

Instance Attribute Summary collapse

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_dynamic_html, #dojo_parse_on_load, #dojo_tag, #dojo_title=, #dynamic_html, #escape, #escape_symbols, #formname, #http_headers, #label=, #label?, #onclick=, #onload=, #onsubmit=, #set_attribute, #tabindex=, #to_html

Constructor Details

#initialize(name, model, session, container = nil) ⇒ NamedComponent

Returns a new instance of NamedComponent.



32
33
34
35
36
# File 'lib/htmlgrid/namedcomponent.rb', line 32

def initialize(name, model, session, container=nil)
	@name = name
	super(model, session, container)
	@attributes['name'] = @name.to_s
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



31
32
33
# File 'lib/htmlgrid/namedcomponent.rb', line 31

def name
  @name
end

Instance Method Details

#data_originObject



41
42
43
44
45
# File 'lib/htmlgrid/namedcomponent.rb', line 41

def data_origin
	if(@model.respond_to?(:data_origin))
		@model.data_origin(@name)
	end
end

#error?Boolean

Returns:

  • (Boolean)


46
47
48
49
50
# File 'lib/htmlgrid/namedcomponent.rb', line 46

def error?
	if(@model.respond_to?(:error?))
		@model.error?(@name)
	end
end

#initObject



37
38
39
40
# File 'lib/htmlgrid/namedcomponent.rb', line 37

def init
	super
	@attributes.update(@lookandfeel.attributes(@name)) if @lookandfeel
end