X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6a7e4474cba9d8be4b2ec445e10f1691f7277c50..b37ceabb82336ee82757cd32efe353cfab8ec267:/pkgs/pkg-tree-debug.js diff --git a/pkgs/pkg-tree-debug.js b/pkgs/pkg-tree-debug.js index de0ce193..e1913ca6 100644 --- a/pkgs/pkg-tree-debug.js +++ b/pkgs/pkg-tree-debug.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.2.0 + * Ext JS Library 3.2.2 * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license @@ -638,6 +638,12 @@ new Ext.tree.TreePanel({ * (bSuccess, oLastNode) where bSuccess is if the expand was successful and oLastNode is the last node that was expanded. */ expandPath : function(path, attr, callback){ + if(Ext.isEmpty(path)){ + if(callback){ + callback(false, undefined); + } + return; + } attr = attr || 'id'; var keys = path.split(this.pathSeparator); var curNode = this.root; @@ -676,6 +682,12 @@ new Ext.tree.TreePanel({ * (bSuccess, oSelNode) where bSuccess is if the selection was successful and oSelNode is the selected node. */ selectPath : function(path, attr, callback){ + if(Ext.isEmpty(path)){ + if(callback){ + callback(false, undefined); + } + return; + } attr = attr || 'id'; var keys = path.split(this.pathSeparator), v = keys.pop(); @@ -1162,33 +1174,34 @@ Ext.tree.TreeEventModel.prototype = { * @extends Ext.util.Observable * The default single selection for a TreePanel. */ -Ext.tree.DefaultSelectionModel = function(config){ - this.selNode = null; +Ext.tree.DefaultSelectionModel = Ext.extend(Ext.util.Observable, { + + constructor : function(config){ + this.selNode = null; - this.addEvents( - /** - * @event selectionchange - * Fires when the selected node changes - * @param {DefaultSelectionModel} this - * @param {TreeNode} node the new selection - */ - 'selectionchange', - - /** - * @event beforeselect - * Fires before the selected node changes, return false to cancel the change - * @param {DefaultSelectionModel} this - * @param {TreeNode} node the new selection - * @param {TreeNode} node the old selection - */ - 'beforeselect' - ); + this.addEvents( + /** + * @event selectionchange + * Fires when the selected node changes + * @param {DefaultSelectionModel} this + * @param {TreeNode} node the new selection + */ + 'selectionchange', - Ext.apply(this, config); - Ext.tree.DefaultSelectionModel.superclass.constructor.call(this); -}; + /** + * @event beforeselect + * Fires before the selected node changes, return false to cancel the change + * @param {DefaultSelectionModel} this + * @param {TreeNode} node the new selection + * @param {TreeNode} node the old selection + */ + 'beforeselect' + ); -Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, { + Ext.apply(this, config); + Ext.tree.DefaultSelectionModel.superclass.constructor.call(this); + }, + init : function(tree){ this.tree = tree; tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this); @@ -1363,23 +1376,24 @@ Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, { * @extends Ext.util.Observable * Multi selection for a TreePanel. */ -Ext.tree.MultiSelectionModel = function(config){ - this.selNodes = []; - this.selMap = {}; - this.addEvents( - /** - * @event selectionchange - * Fires when the selected nodes change - * @param {MultiSelectionModel} this - * @param {Array} nodes Array of the selected nodes - */ - 'selectionchange' - ); - Ext.apply(this, config); - Ext.tree.MultiSelectionModel.superclass.constructor.call(this); -}; - -Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, { +Ext.tree.MultiSelectionModel = Ext.extend(Ext.util.Observable, { + + constructor : function(config){ + this.selNodes = []; + this.selMap = {}; + this.addEvents( + /** + * @event selectionchange + * Fires when the selected nodes change + * @param {MultiSelectionModel} this + * @param {Array} nodes Array of the selected nodes + */ + 'selectionchange' + ); + Ext.apply(this, config); + Ext.tree.MultiSelectionModel.superclass.constructor.call(this); + }, + init : function(tree){ this.tree = tree; tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this); @@ -1465,7 +1479,7 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, { * @return {Array} */ getSelectedNodes : function(){ - return this.selNodes; + return this.selNodes.concat([]); }, onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown,