Class: Watobo::Gui::XmlTree
- Inherits:
-
FXTreeList
- Object
- FXTreeList
- Watobo::Gui::XmlTree
- Defined in:
- lib/watobo/gui/xml_viewer_frame.rb
Instance Method Summary collapse
- #addTreeElement(parent = nil, element = nil) ⇒ Object
-
#initialize(parent, xml_data = nil) ⇒ XmlTree
constructor
A new instance of XmlTree.
Constructor Details
#initialize(parent, xml_data = nil) ⇒ XmlTree
Returns a new instance of XmlTree.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/watobo/gui/xml_viewer_frame.rb', line 26 def initialize(parent, xml_data=nil) super(parent, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT) @xml_data = REXML::Document.new(xml_data) @root = @xml_data.root # @root.each_recursive { |x| #puts x.name if x.has_text? and x.text == "?" # puts x.name #unless x.has_elements? #} #puts @xml_data.root.methods.sort addTreeElement(nil, @root) end |
Instance Method Details
#addTreeElement(parent = nil, element = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/watobo/gui/xml_viewer_frame.rb', line 13 def addTreeElement(parent=nil, element=nil) node = self.appendItem(parent, element.name) element.elements.each do |e| sn = self.appendItem(node, e.name) if e.has_elements? e.elements.each do |se| self.addTreeElement(sn, se) end end end end |