X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/docs/source/TreeNodeUI.html diff --git a/docs/source/TreeNodeUI.html b/docs/source/TreeNodeUI.html index 160c1a1b..5820fcc9 100644 --- a/docs/source/TreeNodeUI.html +++ b/docs/source/TreeNodeUI.html @@ -1,17 +1,12 @@ - - - The source code - - - - -
/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-
/** + + + + The source code + + + + +
/** * @class Ext.tree.TreeNodeUI * This class provides the default UI implementation for Ext TreeNodes. * The TreeNode UI implementation is separate from the @@ -38,7 +33,7 @@ Ext.tree.TreeNodeUI.prototype = { removeChild : function(node){ if(this.rendered){ this.ctNode.removeChild(node.ui.getEl()); - } + } }, // private @@ -61,14 +56,14 @@ Ext.tree.TreeNodeUI.prototype = { // private onDisableChange : function(node, state){ this.disabled = state; - if (this.checkbox) { - this.checkbox.disabled = state; - } + if (this.checkbox) { + this.checkbox.disabled = state; + } if(state){ this.addClass("x-tree-node-disabled"); }else{ this.removeClass("x-tree-node-disabled"); - } + } }, // private @@ -119,7 +114,7 @@ Ext.tree.TreeNodeUI.prototype = { */ removeClass : function(cls){ if(this.elNode){ - Ext.fly(this.elNode).removeClass(cls); + Ext.fly(this.elNode).removeClass(cls); } }, @@ -128,12 +123,12 @@ Ext.tree.TreeNodeUI.prototype = { if(this.rendered){ this.holder = document.createElement("div"); this.holder.appendChild(this.wrap); - } + } }, // private fireEvent : function(){ - return this.node.fireEvent.apply(this.node, arguments); + return this.node.fireEvent.apply(this.node, arguments); }, // private @@ -141,7 +136,7 @@ Ext.tree.TreeNodeUI.prototype = { this.node.on("move", this.onMove, this); if(this.node.disabled){ - this.onDisableChange(this.node, true); + this.onDisableChange(this.node, true); } if(this.node.hidden){ this.hide(); @@ -179,7 +174,7 @@ Ext.tree.TreeNodeUI.prototype = { this.node.hidden = false; if(this.wrap){ this.wrap.style.display = ""; - } + } }, // private @@ -248,8 +243,8 @@ Ext.tree.TreeNodeUI.prototype = { // private onCheckChange : function(){ var checked = this.checkbox.checked; - // fix for IE6 - this.checkbox.defaultChecked = checked; + // fix for IE6 + this.checkbox.defaultChecked = checked; this.node.attributes.checked = checked; this.fireEvent('checkchange', this.node, checked); }, @@ -265,12 +260,12 @@ Ext.tree.TreeNodeUI.prototype = { startDrop : function(){ this.dropping = true; }, - + // delayed drop so the click event doesn't get fired on a drop - endDrop : function(){ + endDrop : function(){ setTimeout(function(){ this.dropping = false; - }.createDelegate(this), 50); + }.createDelegate(this), 50); }, // private @@ -311,7 +306,7 @@ Ext.tree.TreeNodeUI.prototype = { blur : function(){ try{ this.anchor.blur(); - }catch(e){} + }catch(e){} }, // private @@ -326,7 +321,7 @@ Ext.tree.TreeNodeUI.prototype = { } this.animating = true; this.updateExpandIcon(); - + ct.slideIn('t', { callback : function(){ this.animating = false; @@ -373,12 +368,15 @@ Ext.tree.TreeNodeUI.prototype = { // private getContainer : function(){ - return this.ctNode; + return this.ctNode; }, - // private +
/** + * Returns the element which encapsulates this node. + * @return {HtmlElement} The DOM element. The default implementation uses a <li>. + */ getEl : function(){ - return this.wrap; + return this.wrap; }, // private @@ -393,15 +391,15 @@ Ext.tree.TreeNodeUI.prototype = { // private onRender : function(){ - this.render(); + this.render(); }, // private render : function(bulkRender){ var n = this.node, a = n.attributes; - var targetNode = n.parentNode ? + var targetNode = n.parentNode ? n.parentNode.ui.getContainer() : n.ownerTree.innerCt.dom; - + if(!this.rendered){ this.rendered = true; @@ -418,7 +416,7 @@ Ext.tree.TreeNodeUI.prototype = { if(a.qtipTitle){ this.textNode.setAttribute("ext:qtitle", a.qtipTitle); } - } + } }else if(a.qtipCfg){ a.qtipCfg.target = Ext.id(this.textNode); Ext.QuickTips.register(a.qtipCfg); @@ -439,10 +437,10 @@ Ext.tree.TreeNodeUI.prototype = { // add some indent caching, this helps performance when rendering a large tree this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : ''; - var cb = typeof a.checked == 'boolean'; - - var href = a.href ? a.href : Ext.isGecko ? "" : "#"; - var buf = ['
  • ', + var cb = Ext.isBoolean(a.checked), + nel, + href = a.href ? a.href : Ext.isGecko ? "" : "#", + buf = ['
  • ', '',this.indentMarkup,"", '', '', @@ -452,13 +450,12 @@ Ext.tree.TreeNodeUI.prototype = { '', "
  • "].join(''); - var nel; if(bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())){ this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf); }else{ this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf); } - + this.elNode = this.wrap.childNodes[0]; this.ctNode = this.wrap.childNodes[1]; var cs = this.elNode.childNodes; @@ -468,8 +465,8 @@ Ext.tree.TreeNodeUI.prototype = { var index = 3; if(cb){ this.checkbox = cs[3]; - // fix for IE6 - this.checkbox.defaultChecked = this.checkbox.checked; + // fix for IE6 + this.checkbox.defaultChecked = this.checkbox.checked; index++; } this.anchor = cs[index]; @@ -483,7 +480,7 @@ Ext.tree.TreeNodeUI.prototype = { getAnchor : function(){ return this.anchor; }, - +
    /** * Returns the text node. * @return {HtmlNode} The DOM text node. @@ -491,7 +488,7 @@ Ext.tree.TreeNodeUI.prototype = { getTextEl : function(){ return this.textNode; }, - +
    /** * Returns the icon <img> element. * @return {HtmlElement} The DOM image element. @@ -506,15 +503,17 @@ Ext.tree.TreeNodeUI.prototype = { * @return {Boolean} The checked flag. */ isChecked : function(){ - return this.checkbox ? this.checkbox.checked : false; + return this.checkbox ? this.checkbox.checked : false; }, // private updateExpandIcon : function(){ if(this.rendered){ - var n = this.node, c1, c2; - var cls = n.isLast() ? "x-tree-elbow-end" : "x-tree-elbow"; - var hasChild = n.hasChildNodes(); + var n = this.node, + c1, + c2, + cls = n.isLast() ? "x-tree-elbow-end" : "x-tree-elbow", + hasChild = n.hasChildNodes(); if(hasChild || n.attributes.expandable){ if(n.expanded){ cls += "-minus"; @@ -535,7 +534,7 @@ Ext.tree.TreeNodeUI.prototype = { } }else{ if(!this.wasLeaf){ - Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-leaf"); + Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-collapsed"); delete this.c1; delete this.c2; this.wasLeaf = true; @@ -548,7 +547,7 @@ Ext.tree.TreeNodeUI.prototype = { } } }, - + // private onIdChange: function(id){ if(this.rendered){ @@ -559,8 +558,8 @@ Ext.tree.TreeNodeUI.prototype = { // private getChildIndent : function(){ if(!this.childIndent){ - var buf = []; - var p = this.node; + var buf = [], + p = this.node; while(p){ if(!p.isRoot || (p.isRoot && p.ownerTree.rootVisible)){ if(!p.isLast()) { @@ -579,8 +578,8 @@ Ext.tree.TreeNodeUI.prototype = { // private renderIndent : function(){ if(this.rendered){ - var indent = ""; - var p = this.node.parentNode; + var indent = "", + p = this.node.parentNode; if(p){ indent = p.ui.getChildIndent(); } @@ -596,23 +595,14 @@ Ext.tree.TreeNodeUI.prototype = { if(this.elNode){ Ext.dd.Registry.unregister(this.elNode.id); } - delete this.elNode; - delete this.ctNode; - delete this.indentNode; - delete this.ecNode; - delete this.iconNode; - delete this.checkbox; - delete this.anchor; - delete this.textNode; - - if (this.holder){ - delete this.wrap; - Ext.removeNode(this.holder); - delete this.holder; - }else{ - Ext.removeNode(this.wrap); - delete this.wrap; - } + + Ext.each(['textnode', 'anchor', 'checkbox', 'indentNode', 'ecNode', 'iconNode', 'elNode', 'ctNode', 'wrap', 'holder'], function(el){ + if(this[el]){ + Ext.fly(this[el]).remove(); + delete this[el]; + } + }, this); + delete this.node; } }; @@ -636,6 +626,6 @@ Ext.tree.RootTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { }, collapse : Ext.emptyFn, expand : Ext.emptyFn -});
    - +});
    + \ No newline at end of file