o2.widget = o2.widget || {}; o2.require("o2.widget.Tree", null, false); o2.widget.Tree2 = new Class({ Extends: o2.widget.Tree, }); o2.widget.Tree2.Node = new Class({ Implements: [Options, Events], options: { "expand": true, "title": "", "text": "", "action": "", "icon": "folder.png" }, imgs: { "expand": "expand.gif", "collapse":"collapse.gif", "blank": "blank.gif" }, tree: null, level: 0, levelNode:[], initialize: function(tree, options){ this.setOptions(options); if (options.icon=="none") this.options.icon = ""; this.tree = tree; this.levelNode = []; this.children = []; this.parentNode = null; this.previousSibling = null; this.nextSibling = null; this.firstChild = null; this.node = new Element("div",{ "styles": this.tree.css.treeNode }); this.itemNode = new Element("div", { "styles": this.tree.css.treeItemNode }).inject(this.node); this.childrenNode = new Element("div", { "styles": this.tree.css.treeChildrenNode }).inject(this.node); if (!this.options.expand){ this.childrenNode.setStyle("display", "none"); } }, setText: function(value){ var textDivNode = this.textNode.getElement("div"); if (textDivNode) textDivNode.set("text", value); }, setTitle: function(value){ var textDivNode = this.textNode.getElement("div"); if (textDivNode) textDivNode.set("title", value); }, load: function(){ this.nodeTable = new Element("table", { "border": "0", "cellpadding": "0", "cellspacing": "0", "styles": {"width": "fit-content", "table-layout": "fixed"} }).inject(this.itemNode); this.nodeTable.setStyles(this.tree.css.nodeTable); var tbody = new Element("tbody").inject(this.nodeTable); this.nodeArea = new Element("tr").inject(tbody); this.createLevelNode(); this.createOperateNode(); this.createIconNode(); this.createTextNode(); }, createLevelNode: function(){ for (var i=0; i