Class: Lapillus::RemotePanel

Inherits:
Container show all
Defined in:
lib/lapillus/containers.rb

Overview

TODO: whats in a name

Instance Attribute Summary

Attributes inherited from Container

#components

Attributes inherited from Component

#behaviours, #identifier, #model, #property, #visible

Instance Method Summary collapse

Methods inherited from Container

#[], #add, add_component, #component, fileuploadfield, image, #initialize, label, listview, panel, password_textfield, #post, textarea, textfield

Methods inherited from Component

#add_behaviour, #behaviour, #has_behaviour?, #has_model?, #has_parent?, #initialize, #on_render, #parent, #path, #render_component, #response_page=, #session, #value, #visible?, #webpage

Constructor Details

This class inherits a constructor from Lapillus::Container

Instance Method Details

#default_htmlfileObject

duplicate with methods in webpage!



228
229
230
231
# File 'lib/lapillus/containers.rb', line 228

def default_htmlfile
  htmlfile = "html/" + self.class.to_s + ".html"
  File.new( htmlfile ) 
end

#render(html = default_htmlfile) ⇒ Object

NOTE: duplicate between render and render_container



217
218
219
220
221
222
223
224
225
# File 'lib/lapillus/containers.rb', line 217

def render(html=default_htmlfile)
  # @html is al File
  #    html = @html if [email protected]?
  doc = REXML::Document.new html
  root_element = doc.root
  new_element = REXML::Element.new(root_element)   
  render_children(root_element, new_element)
  return doc.doctype.to_s + new_element.to_s
end

#render_container(container_element) ⇒ Object



203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/lapillus/containers.rb', line 203

def render_container(container_element)
  #NOTE: duplicated in Webpage class above
  doc = REXML::Document.new default_htmlfile
  root_node = doc.root
  fragment = REXML::XPath.first( root_node, "//body")
  raise "Body element not found!" if fragment == nil
  new_element = REXML::Element.new(container_element)   
  render_children(fragment, new_element)
  render_to_element(new_element)
  render_behaviours(new_element)
  return new_element
end