日期:2014-05-16 浏览次数:20390 次
// JavaScript Document
//部分扩展函数
var $C = function(_tag){return document.createElement(_tag);}
var $ = function(_id){return document.getElementById(_id);}
String.prototype.trim = function(value,icase){return this.replace(/(^\s+)|(\s+$)/g,"");}
Array.prototype.indexOf = function(value){for(var i=0,l=this.length;i <l;i++)if(this[i]==value)return i;return -1;}
Array.prototype.Remove = function(value){for(var i=0,l=this.length;i <l;i++)if(this[i]==value){return this.splice(i,1);}}
Array.prototype.Replace = function(value,source){for(var i=0,l=this.length;i <l;i++)if(this[i]==value){this[i]=source;break;}}
Array.prototype.ReplaceAll = function(value,source){for(var i=0,l=this.length;i <l;i++)if(this[i]==value){this[i]=source;}}
Array.prototype.Clear = function(){this.splice(0,this.length);}
var System = {};
System.UI = {}
System.UI.ntreeNode = SYSTEM_UI_NTREENODE;
//树结点类
function SYSTEM_UI_NTREENODE()
{
classType = "SYSTEM_UI_NTREENODE";
this.initialize.apply(this,arguments);
}
SYSTEM_UI_NTREENODE.prototype = {
initialize:function(_parent,_text)//初始化类 _parent是父节点 _text是本节点的文本
{
this.top = _parent.top;
this.parent = _parent;
this._text = _text;
this._expand = false;
this.children = [];
this.initElement();
this.setElement();
this.initEvent();
this.text(_text);
this.parent.children.push(this);
this.resizeBar();
},
initElement:function()//初始化元素
{
this.mainObj = $C("table");//节点主载体
var otbody = $C("tbody");//tablebody
var otr = $C("tr");//tr
this.pikeTd = $C("td");//纵向连结线区域
this.infoTd = $C("td");//内容区域
this.childTd = $C("td");
this.childField = $C("div");//子节点容器
this.infoField = $C("span");//内容区域