commit extjs-2.2.1
[extjs.git] / source / widgets / tree / TreePanel.js
1 /*\r
2  * Ext JS Library 2.2.1\r
3  * Copyright(c) 2006-2009, Ext JS, LLC.\r
4  * licensing@extjs.com\r
5  * \r
6  * http://extjs.com/license\r
7  */\r
8 \r
9 /**\r
10  * @class Ext.tree.TreePanel\r
11  * <p>The TreePanel provides tree-structured UI representation of tree-structured data.</p>\r
12  * <p>{@link Ext.tree.TreeNode TreeNode}s added to the TreePanel may each contain metadata\r
13  * used by your application in their {@link Ext.tree.TreeNode#attributes attributes} property.</p>\r
14  * <p><b>A TreePanel must have a {@link #root} node before it is rendered.</b> This may either be\r
15  * specified using the {@link #root} config option, or using the {@link #setRootNode} method.\r
16  * @extends Ext.Panel\r
17 \r
18  * @cfg {Ext.tree.TreeNode} root The root node for the tree.\r
19  * @cfg {Boolean} rootVisible false to hide the root node (defaults to true)\r
20  * @cfg {Boolean} lines false to disable tree lines (defaults to true)\r
21  * @cfg {Boolean} enableDD true to enable drag and drop\r
22  * @cfg {Boolean} enableDrag true to enable just drag\r
23  * @cfg {Boolean} enableDrop true to enable just drop\r
24  * @cfg {Object} dragConfig Custom config to pass to the {@link Ext.tree.TreeDragZone} instance\r
25  * @cfg {Object} dropConfig Custom config to pass to the {@link Ext.tree.TreeDropZone} instance\r
26  * @cfg {String} ddGroup The DD group this TreePanel belongs to\r
27  * @cfg {String} ddAppendOnly True if the tree should only allow append drops (use for trees which are sorted)\r
28  * @cfg {Boolean} ddScroll true to enable body scrolling\r
29  * @cfg {Boolean} containerScroll true to register this container with ScrollManager\r
30  * @cfg {Boolean} hlDrop false to disable node highlight on drop (defaults to the value of Ext.enableFx)\r
31  * @cfg {String} hlColor The color of the node highlight (defaults to C3DAF9)\r
32  * @cfg {Boolean} animate true to enable animated expand/collapse (defaults to the value of Ext.enableFx)\r
33  * @cfg {Boolean} singleExpand true if only 1 node per branch may be expanded\r
34  * @cfg {Boolean} selModel A tree selection model to use with this TreePanel (defaults to a {@link Ext.tree.DefaultSelectionModel})\r
35  * @cfg {Boolean} trackMouseOver False to disable mouse over highlighting \r
36  * @cfg {Ext.tree.TreeLoader} loader A {@link Ext.tree.TreeLoader} for use with this TreePanel\r
37  * @cfg {String} pathSeparator The token used to separate sub-paths in path strings (defaults to '/')\r
38  * @cfg {Boolean} useArrows True to use Vista-style arrows in the tree (defaults to false)\r
39  *\r
40  * @constructor\r
41  * @param {Object} config\r
42  */\r
43 Ext.tree.TreePanel = Ext.extend(Ext.Panel, {\r
44     rootVisible : true,\r
45     animate: Ext.enableFx,\r
46     lines : true,\r
47     enableDD : false,\r
48     hlDrop : Ext.enableFx,\r
49     pathSeparator: "/",\r
50 \r
51     initComponent : function(){\r
52         Ext.tree.TreePanel.superclass.initComponent.call(this);\r
53 \r
54         if(!this.eventModel){\r
55             this.eventModel = new Ext.tree.TreeEventModel(this);\r
56         }\r
57         \r
58         // initialize the loader\r
59         var l = this.loader;\r
60         if(!l){\r
61             l = new Ext.tree.TreeLoader({\r
62                 dataUrl: this.dataUrl\r
63             });\r
64         }else if(typeof l == 'object' && !l.load){\r
65             l = new Ext.tree.TreeLoader(l);\r
66         }\r
67         this.loader = l;\r
68         \r
69         this.nodeHash = {};\r
70 \r
71         /**\r
72         * The root node of this tree.\r
73         * @type Ext.tree.TreeNode\r
74         * @property root\r
75         */\r
76         if(this.root){\r
77            this.setRootNode(this.root);\r
78         }\r
79 \r
80         this.addEvents(\r
81 \r
82             /**\r
83             * @event append\r
84             * Fires when a new child node is appended to a node in this tree.\r
85             * @param {Tree} tree The owner tree\r
86             * @param {Node} parent The parent node\r
87             * @param {Node} node The newly appended node\r
88             * @param {Number} index The index of the newly appended node\r
89             */\r
90            "append",\r
91            /**\r
92             * @event remove\r
93             * Fires when a child node is removed from a node in this tree.\r
94             * @param {Tree} tree The owner tree\r
95             * @param {Node} parent The parent node\r
96             * @param {Node} node The child node removed\r
97             */\r
98            "remove",\r
99            /**\r
100             * @event movenode\r
101             * Fires when a node is moved to a new location in the tree\r
102             * @param {Tree} tree The owner tree\r
103             * @param {Node} node The node moved\r
104             * @param {Node} oldParent The old parent of this node\r
105             * @param {Node} newParent The new parent of this node\r
106             * @param {Number} index The index it was moved to\r
107             */\r
108            "movenode",\r
109            /**\r
110             * @event insert\r
111             * Fires when a new child node is inserted in a node in this tree.\r
112             * @param {Tree} tree The owner tree\r
113             * @param {Node} parent The parent node\r
114             * @param {Node} node The child node inserted\r
115             * @param {Node} refNode The child node the node was inserted before\r
116             */\r
117            "insert",\r
118            /**\r
119             * @event beforeappend\r
120             * Fires before a new child is appended to a node in this tree, return false to cancel the append.\r
121             * @param {Tree} tree The owner tree\r
122             * @param {Node} parent The parent node\r
123             * @param {Node} node The child node to be appended\r
124             */\r
125            "beforeappend",\r
126            /**\r
127             * @event beforeremove\r
128             * Fires before a child is removed from a node in this tree, return false to cancel the remove.\r
129             * @param {Tree} tree The owner tree\r
130             * @param {Node} parent The parent node\r
131             * @param {Node} node The child node to be removed\r
132             */\r
133            "beforeremove",\r
134            /**\r
135             * @event beforemovenode\r
136             * Fires before a node is moved to a new location in the tree. Return false to cancel the move.\r
137             * @param {Tree} tree The owner tree\r
138             * @param {Node} node The node being moved\r
139             * @param {Node} oldParent The parent of the node\r
140             * @param {Node} newParent The new parent the node is moving to\r
141             * @param {Number} index The index it is being moved to\r
142             */\r
143            "beforemovenode",\r
144            /**\r
145             * @event beforeinsert\r
146             * Fires before a new child is inserted in a node in this tree, return false to cancel the insert.\r
147             * @param {Tree} tree The owner tree\r
148             * @param {Node} parent The parent node\r
149             * @param {Node} node The child node to be inserted\r
150             * @param {Node} refNode The child node the node is being inserted before\r
151             */\r
152             "beforeinsert",\r
153 \r
154             /**\r
155             * @event beforeload\r
156             * Fires before a node is loaded, return false to cancel\r
157             * @param {Node} node The node being loaded\r
158             */\r
159             "beforeload",\r
160             /**\r
161             * @event load\r
162             * Fires when a node is loaded\r
163             * @param {Node} node The node that was loaded\r
164             */\r
165             "load",\r
166             /**\r
167             * @event textchange\r
168             * Fires when the text for a node is changed\r
169             * @param {Node} node The node\r
170             * @param {String} text The new text\r
171             * @param {String} oldText The old text\r
172             */\r
173             "textchange",\r
174             /**\r
175             * @event beforeexpandnode\r
176             * Fires before a node is expanded, return false to cancel.\r
177             * @param {Node} node The node\r
178             * @param {Boolean} deep\r
179             * @param {Boolean} anim\r
180             */\r
181             "beforeexpandnode",\r
182             /**\r
183             * @event beforecollapsenode\r
184             * Fires before a node is collapsed, return false to cancel.\r
185             * @param {Node} node The node\r
186             * @param {Boolean} deep\r
187             * @param {Boolean} anim\r
188             */\r
189             "beforecollapsenode",\r
190             /**\r
191             * @event expandnode\r
192             * Fires when a node is expanded\r
193             * @param {Node} node The node\r
194             */\r
195             "expandnode",\r
196             /**\r
197             * @event disabledchange\r
198             * Fires when the disabled status of a node changes\r
199             * @param {Node} node The node\r
200             * @param {Boolean} disabled\r
201             */\r
202             "disabledchange",\r
203             /**\r
204             * @event collapsenode\r
205             * Fires when a node is collapsed\r
206             * @param {Node} node The node\r
207             */\r
208             "collapsenode",\r
209             /**\r
210             * @event beforeclick\r
211             * Fires before click processing on a node. Return false to cancel the default action.\r
212             * @param {Node} node The node\r
213             * @param {Ext.EventObject} e The event object\r
214             */\r
215             "beforeclick",\r
216             /**\r
217             * @event click\r
218             * Fires when a node is clicked\r
219             * @param {Node} node The node\r
220             * @param {Ext.EventObject} e The event object\r
221             */\r
222             "click",\r
223             /**\r
224             * @event checkchange\r
225             * Fires when a node with a checkbox's checked property changes\r
226             * @param {Node} this This node\r
227             * @param {Boolean} checked\r
228             */\r
229             "checkchange",\r
230             /**\r
231             * @event dblclick\r
232             * Fires when a node is double clicked\r
233             * @param {Node} node The node\r
234             * @param {Ext.EventObject} e The event object\r
235             */\r
236             "dblclick",\r
237             /**\r
238             * @event contextmenu\r
239             * Fires when a node is right clicked. To display a context menu in response to this\r
240             * event, first create a Menu object (see {@link Ext.menu.Menu} for details), then add\r
241             * a handler for this event:<code><pre>\r
242 new Ext.tree.TreePanel({\r
243     title: 'My TreePanel',\r
244     root: new Ext.tree.AsyncTreeNode({\r
245         text: 'The Root',\r
246         children: [\r
247             { text: 'Child node 1', leaf: true },\r
248             { text: 'Child node 2', leaf: true }\r
249         ]\r
250     }),\r
251     contextMenu: new Ext.menu.Menu({\r
252         items: [{\r
253             id: 'delete-node',\r
254             text: 'Delete Node'\r
255         }],\r
256         listeners: {\r
257             itemclick: function(item) {\r
258                 switch (item.id) {\r
259                     case 'delete-node':\r
260                         var n = item.parentMenu.contextNode;\r
261                         if (n.parentNode) {\r
262                             n.remove();\r
263                         }\r
264                         break;\r
265                 }\r
266             }\r
267         }\r
268     }),\r
269     listeners: {\r
270         contextmenu: function(node, e) {\r
271 //          Register the context node with the menu so that a Menu Item's handler function can access\r
272 //          it via its {@link Ext.menu.BaseItem#parentMenu parentMenu} property.\r
273             node.select();\r
274             var c = node.getOwnerTree().contextMenu;\r
275             c.contextNode = node;\r
276             c.showAt(e.getXY());\r
277         }\r
278     }\r
279 });\r
280 </pre></code>\r
281             * @param {Node} node The node\r
282             * @param {Ext.EventObject} e The event object\r
283             */\r
284             "contextmenu",\r
285             /**\r
286             * @event beforechildrenrendered\r
287             * Fires right before the child nodes for a node are rendered\r
288             * @param {Node} node The node\r
289             */\r
290             "beforechildrenrendered",\r
291            /**\r
292              * @event startdrag\r
293              * Fires when a node starts being dragged\r
294              * @param {Ext.tree.TreePanel} this\r
295              * @param {Ext.tree.TreeNode} node\r
296              * @param {event} e The raw browser event\r
297              */\r
298             "startdrag",\r
299             /**\r
300              * @event enddrag\r
301              * Fires when a drag operation is complete\r
302              * @param {Ext.tree.TreePanel} this\r
303              * @param {Ext.tree.TreeNode} node\r
304              * @param {event} e The raw browser event\r
305              */\r
306             "enddrag",\r
307             /**\r
308              * @event dragdrop\r
309              * Fires when a dragged node is dropped on a valid DD target\r
310              * @param {Ext.tree.TreePanel} this\r
311              * @param {Ext.tree.TreeNode} node\r
312              * @param {DD} dd The dd it was dropped on\r
313              * @param {event} e The raw browser event\r
314              */\r
315             "dragdrop",\r
316             /**\r
317              * @event beforenodedrop\r
318              * Fires when a DD object is dropped on a node in this tree for preprocessing. Return false to cancel the drop. The dropEvent\r
319              * passed to handlers has the following properties:<br />\r
320              * <ul style="padding:5px;padding-left:16px;">\r
321              * <li>tree - The TreePanel</li>\r
322              * <li>target - The node being targeted for the drop</li>\r
323              * <li>data - The drag data from the drag source</li>\r
324              * <li>point - The point of the drop - append, above or below</li>\r
325              * <li>source - The drag source</li>\r
326              * <li>rawEvent - Raw mouse event</li>\r
327              * <li>dropNode - Drop node(s) provided by the source <b>OR</b> you can supply node(s)\r
328              * to be inserted by setting them on this object.</li>\r
329              * <li>cancel - Set this to true to cancel the drop.</li>\r
330              * <li>dropStatus - If the default drop action is cancelled but the drop is valid, setting this to true\r
331              * will prevent the animated "repair" from appearing.</li>\r
332              * </ul>\r
333              * @param {Object} dropEvent\r
334              */\r
335             "beforenodedrop",\r
336             /**\r
337              * @event nodedrop\r
338              * Fires after a DD object is dropped on a node in this tree. The dropEvent\r
339              * passed to handlers has the following properties:<br />\r
340              * <ul style="padding:5px;padding-left:16px;">\r
341              * <li>tree - The TreePanel</li>\r
342              * <li>target - The node being targeted for the drop</li>\r
343              * <li>data - The drag data from the drag source</li>\r
344              * <li>point - The point of the drop - append, above or below</li>\r
345              * <li>source - The drag source</li>\r
346              * <li>rawEvent - Raw mouse event</li>\r
347              * <li>dropNode - Dropped node(s).</li>\r
348              * </ul>\r
349              * @param {Object} dropEvent\r
350              */\r
351             "nodedrop",\r
352              /**\r
353              * @event nodedragover\r
354              * Fires when a tree node is being targeted for a drag drop, return false to signal drop not allowed. The dragOverEvent\r
355              * passed to handlers has the following properties:<br />\r
356              * <ul style="padding:5px;padding-left:16px;">\r
357              * <li>tree - The TreePanel</li>\r
358              * <li>target - The node being targeted for the drop</li>\r
359              * <li>data - The drag data from the drag source</li>\r
360              * <li>point - The point of the drop - append, above or below</li>\r
361              * <li>source - The drag source</li>\r
362              * <li>rawEvent - Raw mouse event</li>\r
363              * <li>dropNode - Drop node(s) provided by the source.</li>\r
364              * <li>cancel - Set this to true to signal drop not allowed.</li>\r
365              * </ul>\r
366              * @param {Object} dragOverEvent\r
367              */\r
368             "nodedragover"\r
369         );\r
370         if(this.singleExpand){\r
371             this.on("beforeexpandnode", this.restrictExpand, this);\r
372         }\r
373     },\r
374 \r
375     // private\r
376     proxyNodeEvent : function(ename, a1, a2, a3, a4, a5, a6){\r
377         if(ename == 'collapse' || ename == 'expand' || ename == 'beforecollapse' || ename == 'beforeexpand' || ename == 'move' || ename == 'beforemove'){\r
378             ename = ename+'node';\r
379         }\r
380         // args inline for performance while bubbling events\r
381         return this.fireEvent(ename, a1, a2, a3, a4, a5, a6);\r
382     },\r
383 \r
384 \r
385     /**\r
386      * Returns this root node for this tree\r
387      * @return {Node}\r
388      */\r
389     getRootNode : function(){\r
390         return this.root;\r
391     },\r
392 \r
393     /**\r
394      * Sets the root node for this tree during initialization. \r
395      * @param {Node} node\r
396      * @return {Node}\r
397      */\r
398     setRootNode : function(node){\r
399         if(!node.render){ // attributes passed\r
400             node = this.loader.createNode(node);\r
401         }\r
402         this.root = node;\r
403         node.ownerTree = this;\r
404         node.isRoot = true;\r
405         this.registerNode(node);\r
406         if(!this.rootVisible){\r
407                 var uiP = node.attributes.uiProvider;\r
408                 node.ui = uiP ? new uiP(node) : new Ext.tree.RootTreeNodeUI(node); \r
409         }\r
410         return node;\r
411     },\r
412 \r
413     /**\r
414      * Gets a node in this tree by its id\r
415      * @param {String} id\r
416      * @return {Node}\r
417      */\r
418     getNodeById : function(id){\r
419         return this.nodeHash[id];\r
420     },\r
421 \r
422     // private\r
423     registerNode : function(node){\r
424         this.nodeHash[node.id] = node;\r
425     },\r
426 \r
427     // private\r
428     unregisterNode : function(node){\r
429         delete this.nodeHash[node.id];\r
430     },\r
431 \r
432     // private\r
433     toString : function(){\r
434         return "[Tree"+(this.id?" "+this.id:"")+"]";\r
435     },\r
436 \r
437     // private\r
438     restrictExpand : function(node){\r
439         var p = node.parentNode;\r
440         if(p){\r
441             if(p.expandedChild && p.expandedChild.parentNode == p){\r
442                 p.expandedChild.collapse();\r
443             }\r
444             p.expandedChild = node;\r
445         }\r
446     },\r
447 \r
448     /**\r
449      * Retrieve an array of checked nodes, or an array of a specific attribute of checked nodes (e.g. "id")\r
450      * @param {String} attribute (optional) Defaults to null (return the actual nodes)\r
451      * @param {TreeNode} startNode (optional) The node to start from, defaults to the root\r
452      * @return {Array}\r
453      */\r
454     getChecked : function(a, startNode){\r
455         startNode = startNode || this.root;\r
456         var r = [];\r
457         var f = function(){\r
458             if(this.attributes.checked){\r
459                 r.push(!a ? this : (a == 'id' ? this.id : this.attributes[a]));\r
460             }\r
461         }\r
462         startNode.cascade(f);\r
463         return r;\r
464     },\r
465 \r
466     /**\r
467      * Returns the container element for this TreePanel.\r
468      * @return {Element} The container element for this TreePanel.\r
469      */\r
470     getEl : function(){\r
471         return this.el;\r
472     },\r
473 \r
474     /**\r
475      * Returns the default {@link Ext.tree.TreeLoader} for this TreePanel.\r
476      * @return {Ext.tree.TreeLoader} The TreeLoader for this TreePanel.\r
477      */\r
478     getLoader : function(){\r
479         return this.loader;\r
480     },\r
481 \r
482     /**\r
483      * Expand all nodes\r
484      */\r
485     expandAll : function(){\r
486         this.root.expand(true);\r
487     },\r
488 \r
489     /**\r
490      * Collapse all nodes\r
491      */\r
492     collapseAll : function(){\r
493         this.root.collapse(true);\r
494     },\r
495 \r
496     /**\r
497      * Returns the selection model used by this TreePanel.\r
498      * @return {TreeSelectionModel} The selection model used by this TreePanel\r
499      */\r
500     getSelectionModel : function(){\r
501         if(!this.selModel){\r
502             this.selModel = new Ext.tree.DefaultSelectionModel();\r
503         }\r
504         return this.selModel;\r
505     },\r
506 \r
507     /**\r
508      * Expands a specified path in this TreePanel. A path can be retrieved from a node with {@link Ext.data.Node#getPath}\r
509      * @param {String} path\r
510      * @param {String} attr (optional) The attribute used in the path (see {@link Ext.data.Node#getPath} for more info)\r
511      * @param {Function} callback (optional) The callback to call when the expand is complete. The callback will be called with\r
512      * (bSuccess, oLastNode) where bSuccess is if the expand was successful and oLastNode is the last node that was expanded.\r
513      */\r
514     expandPath : function(path, attr, callback){\r
515         attr = attr || "id";\r
516         var keys = path.split(this.pathSeparator);\r
517         var curNode = this.root;\r
518         if(curNode.attributes[attr] != keys[1]){ // invalid root\r
519             if(callback){\r
520                 callback(false, null);\r
521             }\r
522             return;\r
523         }\r
524         var index = 1;\r
525         var f = function(){\r
526             if(++index == keys.length){\r
527                 if(callback){\r
528                     callback(true, curNode);\r
529                 }\r
530                 return;\r
531             }\r
532             var c = curNode.findChild(attr, keys[index]);\r
533             if(!c){\r
534                 if(callback){\r
535                     callback(false, curNode);\r
536                 }\r
537                 return;\r
538             }\r
539             curNode = c;\r
540             c.expand(false, false, f);\r
541         };\r
542         curNode.expand(false, false, f);\r
543     },\r
544 \r
545     /**\r
546      * Selects the node in this tree at the specified path. A path can be retrieved from a node with {@link Ext.data.Node#getPath}\r
547      * @param {String} path\r
548      * @param {String} attr (optional) The attribute used in the path (see {@link Ext.data.Node#getPath} for more info)\r
549      * @param {Function} callback (optional) The callback to call when the selection is complete. The callback will be called with\r
550      * (bSuccess, oSelNode) where bSuccess is if the selection was successful and oSelNode is the selected node.\r
551      */\r
552     selectPath : function(path, attr, callback){\r
553         attr = attr || "id";\r
554         var keys = path.split(this.pathSeparator);\r
555         var v = keys.pop();\r
556         if(keys.length > 0){\r
557             var f = function(success, node){\r
558                 if(success && node){\r
559                     var n = node.findChild(attr, v);\r
560                     if(n){\r
561                         n.select();\r
562                         if(callback){\r
563                             callback(true, n);\r
564                         }\r
565                     }else if(callback){\r
566                         callback(false, n);\r
567                     }\r
568                 }else{\r
569                     if(callback){\r
570                         callback(false, n);\r
571                     }\r
572                 }\r
573             };\r
574             this.expandPath(keys.join(this.pathSeparator), attr, f);\r
575         }else{\r
576             this.root.select();\r
577             if(callback){\r
578                 callback(true, this.root);\r
579             }\r
580         }\r
581     },\r
582 \r
583     /**\r
584      * Returns the underlying Element for this tree\r
585      * @return {Ext.Element} The Element\r
586      */\r
587     getTreeEl : function(){\r
588         return this.body;\r
589     },\r
590 \r
591     // private\r
592     onRender : function(ct, position){\r
593         Ext.tree.TreePanel.superclass.onRender.call(this, ct, position);\r
594         this.el.addClass('x-tree');\r
595         this.innerCt = this.body.createChild({tag:"ul",\r
596                cls:"x-tree-root-ct " +\r
597                (this.useArrows ? 'x-tree-arrows' : this.lines ? "x-tree-lines" : "x-tree-no-lines")});\r
598     },\r
599 \r
600     // private\r
601     initEvents : function(){\r
602         Ext.tree.TreePanel.superclass.initEvents.call(this);\r
603 \r
604         if(this.containerScroll){\r
605             Ext.dd.ScrollManager.register(this.body);\r
606         }\r
607         if((this.enableDD || this.enableDrop) && !this.dropZone){\r
608            /**\r
609             * The dropZone used by this tree if drop is enabled\r
610             * @type Ext.tree.TreeDropZone\r
611             */\r
612              this.dropZone = new Ext.tree.TreeDropZone(this, this.dropConfig || {\r
613                ddGroup: this.ddGroup || "TreeDD", appendOnly: this.ddAppendOnly === true\r
614            });\r
615         }\r
616         if((this.enableDD || this.enableDrag) && !this.dragZone){\r
617            /**\r
618             * The dragZone used by this tree if drag is enabled\r
619             * @type Ext.tree.TreeDragZone\r
620             */\r
621             this.dragZone = new Ext.tree.TreeDragZone(this, this.dragConfig || {\r
622                ddGroup: this.ddGroup || "TreeDD",\r
623                scroll: this.ddScroll\r
624            });\r
625         }\r
626         this.getSelectionModel().init(this);\r
627     },\r
628 \r
629     // private\r
630     afterRender : function(){\r
631         Ext.tree.TreePanel.superclass.afterRender.call(this);\r
632         this.root.render();\r
633         if(!this.rootVisible){\r
634             this.root.renderChildren();\r
635         }\r
636     },\r
637 \r
638     onDestroy : function(){\r
639         if(this.rendered){\r
640             this.body.removeAllListeners();\r
641             Ext.dd.ScrollManager.unregister(this.body);\r
642             if(this.dropZone){\r
643                 this.dropZone.unreg();\r
644             }\r
645             if(this.dragZone){\r
646                this.dragZone.unreg();\r
647             }\r
648         }\r
649         this.root.destroy();\r
650         this.nodeHash = null;\r
651         Ext.tree.TreePanel.superclass.onDestroy.call(this);\r
652     }\r
653     \r
654     /** \r
655      * @cfg {String/Number} activeItem \r
656      * @hide \r
657      */\r
658     /** \r
659      * @cfg {Boolean} autoDestroy \r
660      * @hide \r
661      */\r
662     /** \r
663      * @cfg {Object/String/Function} autoLoad \r
664      * @hide \r
665      */\r
666     /** \r
667      * @cfg {Boolean} autoWidth \r
668      * @hide \r
669      */\r
670     /** \r
671      * @cfg {Boolean/Number} bufferResize \r
672      * @hide \r
673      */\r
674     /** \r
675      * @cfg {String} defaultType \r
676      * @hide \r
677      */\r
678     /** \r
679      * @cfg {Object} defaults \r
680      * @hide \r
681      */\r
682     /** \r
683      * @cfg {Boolean} hideBorders \r
684      * @hide \r
685      */\r
686     /** \r
687      * @cfg {Mixed} items \r
688      * @hide \r
689      */\r
690     /** \r
691      * @cfg {String} layout \r
692      * @hide \r
693      */\r
694     /** \r
695      * @cfg {Object} layoutConfig \r
696      * @hide \r
697      */\r
698     /** \r
699      * @cfg {Boolean} monitorResize \r
700      * @hide \r
701      */\r
702     /** \r
703      * @property items \r
704      * @hide \r
705      */\r
706     /** \r
707      * @method add \r
708      * @hide \r
709      */\r
710     /** \r
711      * @method cascade \r
712      * @hide \r
713      */\r
714     /** \r
715      * @method doLayout \r
716      * @hide \r
717      */\r
718     /** \r
719      * @method find \r
720      * @hide \r
721      */\r
722     /** \r
723      * @method findBy \r
724      * @hide \r
725      */\r
726     /** \r
727      * @method findById \r
728      * @hide \r
729      */\r
730     /** \r
731      * @method findByType \r
732      * @hide \r
733      */\r
734     /** \r
735      * @method getComponent \r
736      * @hide \r
737      */\r
738     /** \r
739      * @method getLayout \r
740      * @hide \r
741      */\r
742     /** \r
743      * @method getUpdater \r
744      * @hide \r
745      */\r
746     /** \r
747      * @method insert \r
748      * @hide \r
749      */\r
750     /** \r
751      * @method load \r
752      * @hide \r
753      */\r
754     /** \r
755      * @method remove \r
756      * @hide \r
757      */\r
758     /** \r
759      * @event add \r
760      * @hide \r
761      */\r
762     /** \r
763      * @event afterLayout \r
764      * @hide \r
765      */\r
766     /** \r
767      * @event beforeadd \r
768      * @hide \r
769      */\r
770     /** \r
771      * @event beforeremove \r
772      * @hide \r
773      */\r
774     /** \r
775      * @event remove \r
776      * @hide \r
777      */\r
778 \r
779 \r
780 \r
781     /**\r
782      * @cfg {String} allowDomMove  @hide\r
783      */\r
784     /**\r
785      * @cfg {String} autoEl @hide\r
786      */\r
787     /**\r
788      * @cfg {String} applyTo  @hide\r
789      */\r
790     /**\r
791      * @cfg {String} contentEl  @hide\r
792      */\r
793     /**\r
794      * @cfg {String} disabledClass  @hide\r
795      */\r
796     /**\r
797      * @cfg {String} elements  @hide\r
798      */\r
799     /**\r
800      * @cfg {String} html  @hide\r
801      */\r
802     /**\r
803      * @property disabled\r
804      * @hide\r
805      */\r
806     /**\r
807      * @method applyToMarkup\r
808      * @hide\r
809      */\r
810     /**\r
811      * @method enable\r
812      * @hide\r
813      */\r
814     /**\r
815      * @method disable\r
816      * @hide\r
817      */\r
818     /**\r
819      * @method setDisabled\r
820      * @hide\r
821      */\r
822 });\r
823 \r
824 Ext.tree.TreePanel.nodeTypes = {};\r
825 \r
826 Ext.reg('treepanel', Ext.tree.TreePanel);