this.fireEvent("click",this.node,e);}else {e.stopEvent();}},onDblClick:function(e){e.preventDefault();if(this.disabled){return;}if(this.checkbox){this.toggleCheck();}if(!this.animating&&this.node.hasChildNodes()){this.node.toggle();}
this.fireEvent("dblclick",this.node,e);},onCheckChange:function(){var A=this.checkbox.checked;this.node.attributes.checked=A;this.fireEvent('checkchange',this.node,A);},ecClick:function(e){if(!this.animating&&this.node.hasChildNodes()){this.node.toggle();}},startDrop:function(){this.dropping=true;},endDrop:function(){setTimeout(function(){this.dropping=false;}.createDelegate(this),50);},expand:function(){this.updateExpandIcon();this.ctNode.style.display="";},focus:function(){if(!this.node.preventHScroll){try{this.anchor.focus();}catch(e){}}else if(!Roo.isIE){try{var A=this.node.getOwnerTree().getTreeEl().dom;var l=A.scrollLeft;this.anchor.focus();A.scrollLeft=l;}catch(e){}}},toggleCheck:function(A){var cb=this.checkbox;if(cb){cb.checked=(A===undefined?!cb.checked:A);}},blur:function(){try{this.anchor.blur();}catch(e){}},animExpand:function(A){var ct=Roo.get(this.ctNode);ct.stopFx();if(!this.node.hasChildNodes()){this.updateExpandIcon();this.ctNode.style.display="";Roo.callback(A);return;}
this.animating=true;this.updateExpandIcon();ct.slideIn('t',{callback:function(){this.animating=false;Roo.callback(A);},scope:this,duration:this.node.ownerTree.duration||.25});},highlight:function(){var A=this.node.getOwnerTree();Roo.fly(this.wrap).highlight(A.hlColor||"C3DAF9",{endColor:A.hlBaseColor});},collapse:function(){this.updateExpandIcon();this.ctNode.style.display="none";},animCollapse:function(A){var ct=Roo.get(this.ctNode);ct.enableDisplayMode('block');ct.stopFx();this.animating=true;this.updateExpandIcon();ct.slideOut('t',{callback:function(){this.animating=false;Roo.callback(A);},scope:this,duration:this.node.ownerTree.duration||.25});},getContainer:function(){return this.ctNode;},getEl:function(){return this.wrap;},appendDDGhost:function(A){A.appendChild(this.elNode.cloneNode(true));},getDDRepairXY:function(){return Roo.lib.Dom.getXY(this.iconNode);},onRender:function(){this.render();},render:function(A){var n=this.node,a=n.attributes;var B=n.parentNode?n.parentNode.ui.getContainer():n.ownerTree.innerCt.dom;if(!this.rendered){this.rendered=true;this.renderElements(n,a,B,A);if(a.qtip){if(this.textNode.setAttributeNS){this.textNode.setAttributeNS("ext","qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttributeNS("ext","qtitle",a.qtipTitle);}}else {this.textNode.setAttribute("ext:qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttribute("ext:qtitle",a.qtipTitle);}}}else if(a.qtipCfg){a.qtipCfg.target=Roo.id(this.textNode);Roo.QuickTips.register(a.qtipCfg);}
-this.initEvents();if(!this.node.expanded){this.updateExpandIcon();}}else {if(A===true){B.appendChild(this.wrap);}}},renderElements:function(n,a,A,B){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';var t=n.getOwnerTree();var C=t.renderer?t.renderer(n.attributes):Roo.util.Format.htmlEncode(n.text);var D=t.rendererTip?t.rendererTip(n.attributes):C;var cb=typeof a.checked=='boolean';var E=a.href?a.href:Roo.isGecko?"":"#";var F=['<li class="x-tree-node"><div class="x-tree-node-el ',a.cls,'">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-ec-icon" />','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),'" unselectable="on" />',cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':' />')):'','<a hidefocus="on" href="',E,'" tabIndex="1" ',a.hrefTarget?' target="'+a.hrefTarget+'"':"",'><span unselectable="on" qtip="',D,'">',C,"</span></a></div>",'<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>"];if(B!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Roo.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),F.join(""));}else {this.wrap=Roo.DomHelper.insertHtml("beforeEnd",A,F.join(""));}
+this.initEvents();if(!this.node.expanded){this.updateExpandIcon();}}else {if(A===true){B.appendChild(this.wrap);}}},renderElements:function(n,a,A,B){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';var t=n.getOwnerTree();var C=t.renderer?t.renderer(n.attributes):Roo.util.Format.htmlEncode(n.text);if(typeof(n.attributes.html)!='undefined'){C=n.attributes.html;}var D=t.rendererTip?t.rendererTip(n.attributes):C;var cb=typeof a.checked=='boolean';var E=a.href?a.href:Roo.isGecko?"":"#";var F=['<li class="x-tree-node"><div class="x-tree-node-el ',a.cls,'">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-ec-icon" />','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),'" unselectable="on" />',cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':' />')):'','<a hidefocus="on" href="',E,'" tabIndex="1" ',a.hrefTarget?' target="'+a.hrefTarget+'"':"",'><span unselectable="on" qtip="',D,'">',C,"</span></a></div>",'<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>"];if(B!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Roo.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),F.join(""));}else {this.wrap=Roo.DomHelper.insertHtml("beforeEnd",A,F.join(""));}
this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var cs=this.elNode.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];var G=3;if(cb){this.checkbox=cs[3];G++;}
this.anchor=cs[G];this.textNode=cs[G].firstChild;},getAnchor:function(){return this.anchor;},getTextEl:function(){return this.textNode;},getIconEl:function(){return this.iconNode;},isChecked:function(){return this.checkbox?this.checkbox.checked:false;},updateExpandIcon:function(){if(this.rendered){var n=this.node,c1,c2;var A=n.isLast()?"x-tree-elbow-end":"x-tree-elbow";var B=n.hasChildNodes();if(B){if(n.expanded){A+="-minus";c1="x-tree-node-collapsed";c2="x-tree-node-expanded";}else {A+="-plus";c1="x-tree-node-expanded";c2="x-tree-node-collapsed";}if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false;}if(this.c1!=c1||this.c2!=c2){Roo.fly(this.elNode).replaceClass(c1,c2);this.c1=c1;this.c2=c2;}}else {if(!this.wasLeaf){Roo.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-leaf");delete this.c1;delete this.c2;this.wasLeaf=true;}}var C="x-tree-ec-icon "+A;if(this.ecc!=C){this.ecNode.className=C;this.ecc=C;}}},getChildIndent:function(){if(!this.childIndent){var A=[];var p=this.node;while(p){if(!p.isRoot||(p.isRoot&&p.ownerTree.rootVisible)){if(!p.isLast()){A.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');}else {A.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');}}
p=p.parentNode;}
}
};
-// private
+/** @private */
Roo.Component.AUTO_ID = 1000;
Roo.extend(Roo.Component, Roo.util.Observable, {
/**
- * @property {Boolean} hidden
+ * @scope Roo.Component.prototype
+ * @type {Boolean}
* true if this component is hidden. Read-only.
*/
hidden : false,
/**
+ * @type {Boolean}
* true if this component is disabled. Read-only.
*/
disabled : false,
/**
+ * @type {Boolean}
* true if this component has been rendered. Read-only.
*/
rendered : false,
*/
hideMode: 'display',
- // private
+ /** @private */
ctype : "Roo.Component",
- /** @cfg {String} actionMode
+ /**
+ * @cfg {String} actionMode
* which property holds the element that used for hide() / show() / disable() / enable()
* default is 'el'
*/
actionMode : "el",
- // private
+ /** @private */
getActionEl : function(){
return this[this.actionMode];
},
return this;
},
- // private
+ /** @private */
// default function is not really useful
onRender : function(ct, position){
if(this.el){
}
},
- // private
+ /** @private */
getAutoCreate : function(){
var cfg = typeof this.autoCreate == "object" ?
this.autoCreate : Roo.apply({}, this.defaultAutoCreate);
return cfg;
},
- // private
+ /** @private */
afterRender : Roo.emptyFn,
/**
}
},
- // private
+ /** @private */
beforeDestroy : function(){
},
- // private
+ /** @private */
onDestroy : function(){
},
return this;
},
- // private
+ /** @private */
blur : function(){
if(this.rendered){
this.el.blur();
* @cfg {Boolean} selModel A tree selection model to use with this TreePanel (defaults to a {@link Roo.tree.DefaultSelectionModel})
* @cfg {Boolean} loader A TreeLoader for use with this TreePanel
* @cfg {String} pathSeparator The token used to separate sub-paths in path strings (defaults to '/')
- * @cfg {Function} renderer Sets the rendering (formatting) function for the nodes. to return HTML markup for the tree view. The render function is called with the following parameters:<ul><li>The {Object} The data for the node.</li></ul>
- * @cfg {Function} rendererTip Sets the rendering (formatting) function for the nodes hovertip to return HTML markup for the tree view. The render function is called with the following parameters:<ul><li>The {Object} The data for the node.</li></ul>
+ * @cfg {Function} renderer DEPRECIATED - use TreeLoader:create event / Sets the rendering (formatting) function for the nodes. to return HTML markup for the tree view. The render function is called with the following parameters:<ul><li>The {Object} The data for the node.</li></ul>
+ * @cfg {Function} rendererTip DEPRECIATED - use TreeLoader:create event / Sets the rendering (formatting) function for the nodes hovertip to return HTML markup for the tree view. The render function is called with the following parameters:<ul><li>The {Object} The data for the node.</li></ul>
*
* @constructor
* @param {String/HTMLElement/Element} el The container element
* @param {Node} node The node
*/
"beforechildrenrendered":true,
+ /**
+ * @event startdrag
+ * Fires when a node starts being dragged
+ * @param {Roo.tree.TreePanel} this
+ * @param {Roo.tree.TreeNode} node
+ * @param {event} e The raw browser event
+ */
+ "startdrag" : true,
/**
- * @event startdrag
- * Fires when a node starts being dragged
- * @param {Roo.tree.TreePanel} this
- * @param {Roo.tree.TreeNode} node
- * @param {event} e The raw browser event
- */
- "startdrag" : true,
- /**
- * @event enddrag
- * Fires when a drag operation is complete
- * @param {Roo.tree.TreePanel} this
- * @param {Roo.tree.TreeNode} node
- * @param {event} e The raw browser event
- */
- "enddrag" : true,
- /**
- * @event dragdrop
- * Fires when a dragged node is dropped on a valid DD target
- * @param {Roo.tree.TreePanel} this
- * @param {Roo.tree.TreeNode} node
- * @param {DD} dd The dd it was dropped on
- * @param {event} e The raw browser event
- */
- "dragdrop" : true,
- /**
- * @event beforenodedrop
- * Fires when a DD object is dropped on a node in this tree for preprocessing. Return false to cancel the drop. The dropEvent
- * passed to handlers has the following properties:<br />
- * <ul style="padding:5px;padding-left:16px;">
- * <li>tree - The TreePanel</li>
- * <li>target - The node being targeted for the drop</li>
- * <li>data - The drag data from the drag source</li>
- * <li>point - The point of the drop - append, above or below</li>
- * <li>source - The drag source</li>
- * <li>rawEvent - Raw mouse event</li>
- * <li>dropNode - Drop node(s) provided by the source <b>OR</b> you can supply node(s)
- * to be inserted by setting them on this object.</li>
- * <li>cancel - Set this to true to cancel the drop.</li>
- * </ul>
- * @param {Object} dropEvent
- */
- "beforenodedrop" : true,
- /**
- * @event nodedrop
- * Fires after a DD object is dropped on a node in this tree. The dropEvent
- * passed to handlers has the following properties:<br />
- * <ul style="padding:5px;padding-left:16px;">
- * <li>tree - The TreePanel</li>
- * <li>target - The node being targeted for the drop</li>
- * <li>data - The drag data from the drag source</li>
- * <li>point - The point of the drop - append, above or below</li>
- * <li>source - The drag source</li>
- * <li>rawEvent - Raw mouse event</li>
- * <li>dropNode - Dropped node(s).</li>
- * </ul>
- * @param {Object} dropEvent
- */
- "nodedrop" : true,
- /**
- * @event nodedragover
- * Fires when a tree node is being targeted for a drag drop, return false to signal drop not allowed. The dragOverEvent
- * passed to handlers has the following properties:<br />
- * <ul style="padding:5px;padding-left:16px;">
- * <li>tree - The TreePanel</li>
- * <li>target - The node being targeted for the drop</li>
- * <li>data - The drag data from the drag source</li>
- * <li>point - The point of the drop - append, above or below</li>
- * <li>source - The drag source</li>
- * <li>rawEvent - Raw mouse event</li>
- * <li>dropNode - Drop node(s) provided by the source.</li>
- * <li>cancel - Set this to true to signal drop not allowed.</li>
- * </ul>
- * @param {Object} dragOverEvent
- */
- "nodedragover" : true
+ * @event enddrag
+ * Fires when a drag operation is complete
+ * @param {Roo.tree.TreePanel} this
+ * @param {Roo.tree.TreeNode} node
+ * @param {event} e The raw browser event
+ */
+ "enddrag" : true,
+ /**
+ * @event dragdrop
+ * Fires when a dragged node is dropped on a valid DD target
+ * @param {Roo.tree.TreePanel} this
+ * @param {Roo.tree.TreeNode} node
+ * @param {DD} dd The dd it was dropped on
+ * @param {event} e The raw browser event
+ */
+ "dragdrop" : true,
+ /**
+ * @event beforenodedrop
+ * Fires when a DD object is dropped on a node in this tree for preprocessing. Return false to cancel the drop. The dropEvent
+ * passed to handlers has the following properties:<br />
+ * <ul style="padding:5px;padding-left:16px;">
+ * <li>tree - The TreePanel</li>
+ * <li>target - The node being targeted for the drop</li>
+ * <li>data - The drag data from the drag source</li>
+ * <li>point - The point of the drop - append, above or below</li>
+ * <li>source - The drag source</li>
+ * <li>rawEvent - Raw mouse event</li>
+ * <li>dropNode - Drop node(s) provided by the source <b>OR</b> you can supply node(s)
+ * to be inserted by setting them on this object.</li>
+ * <li>cancel - Set this to true to cancel the drop.</li>
+ * </ul>
+ * @param {Object} dropEvent
+ */
+ "beforenodedrop" : true,
+ /**
+ * @event nodedrop
+ * Fires after a DD object is dropped on a node in this tree. The dropEvent
+ * passed to handlers has the following properties:<br />
+ * <ul style="padding:5px;padding-left:16px;">
+ * <li>tree - The TreePanel</li>
+ * <li>target - The node being targeted for the drop</li>
+ * <li>data - The drag data from the drag source</li>
+ * <li>point - The point of the drop - append, above or below</li>
+ * <li>source - The drag source</li>
+ * <li>rawEvent - Raw mouse event</li>
+ * <li>dropNode - Dropped node(s).</li>
+ * </ul>
+ * @param {Object} dropEvent
+ */
+ "nodedrop" : true,
+ /**
+ * @event nodedragover
+ * Fires when a tree node is being targeted for a drag drop, return false to signal drop not allowed. The dragOverEvent
+ * passed to handlers has the following properties:<br />
+ * <ul style="padding:5px;padding-left:16px;">
+ * <li>tree - The TreePanel</li>
+ * <li>target - The node being targeted for the drop</li>
+ * <li>data - The drag data from the drag source</li>
+ * <li>point - The point of the drop - append, above or below</li>
+ * <li>source - The drag source</li>
+ * <li>rawEvent - Raw mouse event</li>
+ * <li>dropNode - Drop node(s) provided by the source.</li>
+ * <li>cancel - Set this to true to signal drop not allowed.</li>
+ * </ul>
+ * @param {Object} dragOverEvent
+ */
+ "nodedragover" : true
});
if(this.singleExpand){
}
},
- renderElements : function(n, a, targetNode, bulkRender){
+ renderElements : function(n, a, targetNode, bulkRender)
+ {
// add some indent caching, this helps performance when rendering a large tree
this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
var t = n.getOwnerTree();
var txt = t.renderer ? t.renderer(n.attributes) : Roo.util.Format.htmlEncode(n.text);
+ if (typeof(n.attributes.html) != 'undefined') {
+ txt = n.attributes.html;
+ }
var tip = t.rendererTip ? t.rendererTip(n.attributes) : txt;
var cb = typeof a.checked == 'boolean';
var href = a.href ? a.href : Roo.isGecko ? "" : "#";
{
// basically accepts a pannel...
// can accept a layout region..!?!?
- // console.log('BorderLayout add ' + cfg.xtype)
+ //Roo.log('Roo.BorderLayout add ' + cfg.xtype)
if (!cfg.xtype.match(/Panel$/)) {
return false;