<@doc hierarchy="GMLDOM"> Base class for manage models dialog nodes (c) SAP AG 2003-2006. All rights reserved. #INCLUDE[lib:defs.inc] Class TNode inherit gml:Object; property id = ''; property serverid = ''; property name = ''; property parent = ''; //the id of the parent property parentnode = null; //the parent node //optional properties property hint = ''; property size = 1; property icon = ''; property icon2 = ''; //this property relevant only for ModelNode and represents the state of the resource property mode = '';//#[TREEVIEW_NORMAL]; //enum TREEVIEW_NORMAL, TREEVIEW_CHECKת TREEVIEW_RADIO, TREEVIEW_CASCADE property check = false; property isFolder = false; property isPublicUnit = false; property isVirtual = false; // Node childs are cached and not contructed in toggle node property scanned = false; property childs = []; property error = ''; //use getter and setter below property gmlType = ''; property compSize = 0; //child components constructor(id, name, hint, size, mode, check, icon, gmlType) this.init(id, name, hint, size, mode, check, icon, gmlType); end method init(id, name, hint, size, mode, check, icon, gmlType) this.id = id; //TODO - modify this id, must be unique in tree this.serverid = id; this.name = name; if (undefined == size) size = 1; //default is 1 this.size = size; this.hint = hint || ''; this.mode = mode || ''; this.check = check || false; this.icon = icon || ''; this.isFolder = false; this.isPublicUnit = false; this.scanned = false; this.childs = []; if (gmlType) this.gmlType = gmlType; end method setParent(parentnode) this.parent = parentnode.id; this.parentnode = parentnode; this.calcId(); end method addChild(childnode) this.childs.push(childnode); childnode.setParent(this); end method setIcon() end method getHint() return this.hint; end method setHint(status, size) var s = size ? ("#TEXT[XFLD_MMP_SIZE]: " + size + " " + (size==1 ? "#TEXT[XFLD_MMP_COMPONENT]" : "#TEXT[XFLD_MMP_COMPONENTS]")) : null; var stat = status ? ("#TEXT[XFLD_MMP_STATUS]: " + status) : null; this.hint = (stat && s) ? (stat + '\n' + s) : (!s ? (!stat ? '' : stat) : s); end method getDescription() return this.hint || ''; end method calcId() var id_parts = []; var n = this; do { id_parts.unshift(n.getServerid()); n = n.parentnode; } while (n) //bugfix: remove dot in the beginning //id_parts[0] = "dir"; this.id = id_parts.join('.'); end method getChildNodes(channel, exclude_expr, scope ,childs) if (this.scanned && !childs) return this.childs; this.scanned = true; this.compSize = 0; // Reset size before scan this.setErrorMessage(''); channel.error = ''; var res = this.getChildren(channel, scope, childs); if ((!res || res.length == 0) && channel.error) { this.setErrorMessage(this.name + ": " + channel.error); this.scanned = false; } // childs are added also in other methods (i.e. buildServicesNode) this.compSize += (COUNT(res) - (this.vFolders ? COUNT(this.vFolders) : 0)); this.childs = []; for (var i=0, len=res.length; iCall this method to set properties of the node that reflect its state and affect its icon. method setAttributes(attributes) for (var k in attributes) if (!(this[k] == undefined)) this[k] = attributes[k]; this.setIcon(); end <@doc>Get the node's server id - can be overridden. method getServerid() return this.serverid; end method getErrorMessage() return this.error; end method setErrorMessage(errorMessage) this.error = errorMessage; end <@doc> Gets the node object / cached node object cached node : {_cacheObj:boolean, parentNode:TNode, id:s} node id method getChild(childID, searchDeep) var childs = this.childs; if (ISEMPTY(childs) && this.sChilds) childs = this.sChilds; for (var i=0, len=childs.length; i