2015-08-20 14:48:45 +02:00
|
|
|
require "element_view"
|
|
|
|
|
|
|
|
class ListView < ElementView
|
|
|
|
|
2015-08-20 19:40:47 +02:00
|
|
|
def initialize children
|
|
|
|
@children = children
|
2015-08-20 16:07:44 +02:00
|
|
|
@elements = []
|
2015-08-20 19:40:47 +02:00
|
|
|
@container_element = nil
|
2015-08-20 14:48:45 +02:00
|
|
|
end
|
|
|
|
|
2015-08-21 19:07:02 +02:00
|
|
|
def root
|
|
|
|
"div"
|
|
|
|
end
|
|
|
|
|
2015-08-20 19:40:47 +02:00
|
|
|
def draw on
|
2015-08-21 19:07:02 +02:00
|
|
|
@container_element = create_element(self.root)
|
2015-08-20 19:40:47 +02:00
|
|
|
@elements = @children.collect do | c |
|
|
|
|
elem = c.draw(@container_element)
|
|
|
|
elem.append_to(@container_element)
|
|
|
|
elem
|
|
|
|
end
|
|
|
|
@container_element
|
|
|
|
end
|
2015-08-21 19:07:02 +02:00
|
|
|
|
2015-08-20 14:48:45 +02:00
|
|
|
end
|