-<html>\r
-<head>\r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js"><div id="cls-Ext.tree.DefaultSelectionModel"></div>/**\r
+<html>
+<head>
+ <title>The source code</title>
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body onload="prettyPrint();">
+ <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.0.3
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+<div id="cls-Ext.tree.DefaultSelectionModel"></div>/**\r
* @class Ext.tree.DefaultSelectionModel\r
* @extends Ext.util.Observable\r
* The default single selection for a TreePanel.\r
Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {\r
init : function(tree){\r
this.tree = tree;\r
- tree.getTreeEl().on("keydown", this.onKeyDown, this);\r
+ tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this);\r
tree.on("click", this.onNodeClick, this);\r
},\r
\r
* @param {TreeNode} node The node to select\r
* @return {TreeNode} The selected node\r
*/\r
- select : function(node){\r
+ select : function(node, /* private*/ selectNextNode){\r
+ // If node is hidden, select the next node in whatever direction was being moved in.\r
+ if (!Ext.fly(node.ui.wrap).isVisible() && selectNextNode) {\r
+ return selectNextNode.call(this, node);\r
+ }\r
var last = this.selNode;\r
if(node == last){\r
node.ui.onSelectedChange(true);\r
* Selects the node above the selected node in the tree, intelligently walking the nodes\r
* @return TreeNode The new selection\r
*/\r
- selectPrevious : function(){\r
- var s = this.selNode || this.lastSelNode;\r
- if(!s){\r
+ selectPrevious : function(/* private */ s){\r
+ if(!(s = s || this.selNode || this.lastSelNode)){\r
return null;\r
}\r
+ // Here we pass in the current function to select to indicate the direction we're moving\r
var ps = s.previousSibling;\r
if(ps){\r
if(!ps.isExpanded() || ps.childNodes.length < 1){\r
- return this.select(ps);\r
+ return this.select(ps, this.selectPrevious);\r
} else{\r
var lc = ps.lastChild;\r
- while(lc && lc.isExpanded() && lc.childNodes.length > 0){\r
+ while(lc && lc.isExpanded() && Ext.fly(lc.ui.wrap).isVisible() && lc.childNodes.length > 0){\r
lc = lc.lastChild;\r
}\r
- return this.select(lc);\r
+ return this.select(lc, this.selectPrevious);\r
}\r
} else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){\r
- return this.select(s.parentNode);\r
+ return this.select(s.parentNode, this.selectPrevious);\r
}\r
return null;\r
},\r
* Selects the node above the selected node in the tree, intelligently walking the nodes\r
* @return TreeNode The new selection\r
*/\r
- selectNext : function(){\r
- var s = this.selNode || this.lastSelNode;\r
- if(!s){\r
+ selectNext : function(/* private */ s){\r
+ if(!(s = s || this.selNode || this.lastSelNode)){\r
return null;\r
}\r
- if(s.firstChild && s.isExpanded()){\r
- return this.select(s.firstChild);\r
+ // Here we pass in the current function to select to indicate the direction we're moving\r
+ if(s.firstChild && s.isExpanded() && Ext.fly(s.ui.wrap).isVisible()){\r
+ return this.select(s.firstChild, this.selectNext);\r
}else if(s.nextSibling){\r
- return this.select(s.nextSibling);\r
+ return this.select(s.nextSibling, this.selectNext);\r
}else if(s.parentNode){\r
var newS = null;\r
s.parentNode.bubble(function(){\r
if(this.nextSibling){\r
- newS = this.getOwnerTree().selModel.select(this.nextSibling);\r
+ newS = this.getOwnerTree().selModel.select(this.nextSibling, this.selectNext);\r
return false;\r
}\r
});\r
Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {\r
init : function(tree){\r
this.tree = tree;\r
- tree.getTreeEl().on("keydown", this.onKeyDown, this);\r
+ tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this);\r
tree.on("click", this.onNodeClick, this);\r
},\r
\r
selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext,\r
\r
selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious\r
-});</pre> \r
-</body>\r
+});</pre>
+</body>
</html>
\ No newline at end of file