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, #label, #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?, #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



43
44
45
46
47
# File 'lib/htmlgrid/namedcomponent.rb', line 43

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

#error?Boolean

Returns:

  • (Boolean)


49
50
51
52
53
# File 'lib/htmlgrid/namedcomponent.rb', line 49

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

#initObject



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

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