Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / source / TreeSelectionModel.html
diff --git a/docs/source/TreeSelectionModel.html b/docs/source/TreeSelectionModel.html
deleted file mode 100644 (file)
index 7dd0738..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-<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
- * @class Ext.tree.DefaultSelectionModel\r
- * @extends Ext.util.Observable\r
- * The default single selection for a TreePanel.\r
- */\r
-Ext.tree.DefaultSelectionModel = function(config){\r
-   this.selNode = null;\r
-   \r
-   this.addEvents(\r
-       <div id="event-Ext.tree.DefaultSelectionModel-selectionchange"></div>/**\r
-        * @event selectionchange\r
-        * Fires when the selected node changes\r
-        * @param {DefaultSelectionModel} this\r
-        * @param {TreeNode} node the new selection\r
-        */\r
-       "selectionchange",\r
-\r
-       <div id="event-Ext.tree.DefaultSelectionModel-beforeselect"></div>/**\r
-        * @event beforeselect\r
-        * Fires before the selected node changes, return false to cancel the change\r
-        * @param {DefaultSelectionModel} this\r
-        * @param {TreeNode} node the new selection\r
-        * @param {TreeNode} node the old selection\r
-        */\r
-       "beforeselect"\r
-   );\r
-\r
-    Ext.apply(this, config);\r
-    Ext.tree.DefaultSelectionModel.superclass.constructor.call(this);\r
-};\r
-\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.on("click", this.onNodeClick, this);\r
-    },\r
-    \r
-    onNodeClick : function(node, e){\r
-        this.select(node);\r
-    },\r
-    \r
-    <div id="method-Ext.tree.DefaultSelectionModel-select"></div>/**\r
-     * Select a node.\r
-     * @param {TreeNode} node The node to select\r
-     * @return {TreeNode} The selected node\r
-     */\r
-    select : function(node){\r
-        var last = this.selNode;\r
-        if(node == last){\r
-            node.ui.onSelectedChange(true);\r
-        }else if(this.fireEvent('beforeselect', this, node, last) !== false){\r
-            if(last){\r
-                last.ui.onSelectedChange(false);\r
-            }\r
-            this.selNode = node;\r
-            node.ui.onSelectedChange(true);\r
-            this.fireEvent("selectionchange", this, node, last);\r
-        }\r
-        return node;\r
-    },\r
-    \r
-    <div id="method-Ext.tree.DefaultSelectionModel-unselect"></div>/**\r
-     * Deselect a node.\r
-     * @param {TreeNode} node The node to unselect\r
-     */\r
-    unselect : function(node){\r
-        if(this.selNode == node){\r
-            this.clearSelections();\r
-        }    \r
-    },\r
-    \r
-    <div id="method-Ext.tree.DefaultSelectionModel-clearSelections"></div>/**\r
-     * Clear all selections\r
-     */\r
-    clearSelections : function(){\r
-        var n = this.selNode;\r
-        if(n){\r
-            n.ui.onSelectedChange(false);\r
-            this.selNode = null;\r
-            this.fireEvent("selectionchange", this, null);\r
-        }\r
-        return n;\r
-    },\r
-    \r
-    <div id="method-Ext.tree.DefaultSelectionModel-getSelectedNode"></div>/**\r
-     * Get the selected node\r
-     * @return {TreeNode} The selected node\r
-     */\r
-    getSelectedNode : function(){\r
-        return this.selNode;    \r
-    },\r
-    \r
-    <div id="method-Ext.tree.DefaultSelectionModel-isSelected"></div>/**\r
-     * Returns true if the node is selected\r
-     * @param {TreeNode} node The node to check\r
-     * @return {Boolean}\r
-     */\r
-    isSelected : function(node){\r
-        return this.selNode == node;  \r
-    },\r
-\r
-    <div id="method-Ext.tree.DefaultSelectionModel-selectPrevious"></div>/**\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
-            return null;\r
-        }\r
-        var ps = s.previousSibling;\r
-        if(ps){\r
-            if(!ps.isExpanded() || ps.childNodes.length < 1){\r
-                return this.select(ps);\r
-            } else{\r
-                var lc = ps.lastChild;\r
-                while(lc && lc.isExpanded() && lc.childNodes.length > 0){\r
-                    lc = lc.lastChild;\r
-                }\r
-                return this.select(lc);\r
-            }\r
-        } else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){\r
-            return this.select(s.parentNode);\r
-        }\r
-        return null;\r
-    },\r
-\r
-    <div id="method-Ext.tree.DefaultSelectionModel-selectNext"></div>/**\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
-            return null;\r
-        }\r
-        if(s.firstChild && s.isExpanded()){\r
-             return this.select(s.firstChild);\r
-         }else if(s.nextSibling){\r
-             return this.select(s.nextSibling);\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
-                    return false;\r
-                }\r
-            });\r
-            return newS;\r
-         }\r
-        return null;\r
-    },\r
-\r
-    onKeyDown : function(e){\r
-        var s = this.selNode || this.lastSelNode;\r
-        // undesirable, but required\r
-        var sm = this;\r
-        if(!s){\r
-            return;\r
-        }\r
-        var k = e.getKey();\r
-        switch(k){\r
-             case e.DOWN:\r
-                 e.stopEvent();\r
-                 this.selectNext();\r
-             break;\r
-             case e.UP:\r
-                 e.stopEvent();\r
-                 this.selectPrevious();\r
-             break;\r
-             case e.RIGHT:\r
-                 e.preventDefault();\r
-                 if(s.hasChildNodes()){\r
-                     if(!s.isExpanded()){\r
-                         s.expand();\r
-                     }else if(s.firstChild){\r
-                         this.select(s.firstChild, e);\r
-                     }\r
-                 }\r
-             break;\r
-             case e.LEFT:\r
-                 e.preventDefault();\r
-                 if(s.hasChildNodes() && s.isExpanded()){\r
-                     s.collapse();\r
-                 }else if(s.parentNode && (this.tree.rootVisible || s.parentNode != this.tree.getRootNode())){\r
-                     this.select(s.parentNode, e);\r
-                 }\r
-             break;\r
-        };\r
-    }\r
-});\r
-\r
-<div id="cls-Ext.tree.MultiSelectionModel"></div>/**\r
- * @class Ext.tree.MultiSelectionModel\r
- * @extends Ext.util.Observable\r
- * Multi selection for a TreePanel.\r
- */\r
-Ext.tree.MultiSelectionModel = function(config){\r
-   this.selNodes = [];\r
-   this.selMap = {};\r
-   this.addEvents(\r
-       <div id="event-Ext.tree.MultiSelectionModel-selectionchange"></div>/**\r
-        * @event selectionchange\r
-        * Fires when the selected nodes change\r
-        * @param {MultiSelectionModel} this\r
-        * @param {Array} nodes Array of the selected nodes\r
-        */\r
-       "selectionchange"\r
-   );\r
-    Ext.apply(this, config);\r
-    Ext.tree.MultiSelectionModel.superclass.constructor.call(this);\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.on("click", this.onNodeClick, this);\r
-    },\r
-    \r
-    onNodeClick : function(node, e){\r
-        if(e.ctrlKey && this.isSelected(node)){\r
-            this.unselect(node);\r
-        }else{\r
-            this.select(node, e, e.ctrlKey);\r
-        }\r
-    },\r
-    \r
-    <div id="method-Ext.tree.MultiSelectionModel-select"></div>/**\r
-     * Select a node.\r
-     * @param {TreeNode} node The node to select\r
-     * @param {EventObject} e (optional) An event associated with the selection\r
-     * @param {Boolean} keepExisting True to retain existing selections\r
-     * @return {TreeNode} The selected node\r
-     */\r
-    select : function(node, e, keepExisting){\r
-        if(keepExisting !== true){\r
-            this.clearSelections(true);\r
-        }\r
-        if(this.isSelected(node)){\r
-            this.lastSelNode = node;\r
-            return node;\r
-        }\r
-        this.selNodes.push(node);\r
-        this.selMap[node.id] = node;\r
-        this.lastSelNode = node;\r
-        node.ui.onSelectedChange(true);\r
-        this.fireEvent("selectionchange", this, this.selNodes);\r
-        return node;\r
-    },\r
-    \r
-    <div id="method-Ext.tree.MultiSelectionModel-unselect"></div>/**\r
-     * Deselect a node.\r
-     * @param {TreeNode} node The node to unselect\r
-     */\r
-    unselect : function(node){\r
-        if(this.selMap[node.id]){\r
-            node.ui.onSelectedChange(false);\r
-            var sn = this.selNodes;\r
-            var index = sn.indexOf(node);\r
-            if(index != -1){\r
-                this.selNodes.splice(index, 1);\r
-            }\r
-            delete this.selMap[node.id];\r
-            this.fireEvent("selectionchange", this, this.selNodes);\r
-        }\r
-    },\r
-    \r
-    <div id="method-Ext.tree.MultiSelectionModel-clearSelections"></div>/**\r
-     * Clear all selections\r
-     */\r
-    clearSelections : function(suppressEvent){\r
-        var sn = this.selNodes;\r
-        if(sn.length > 0){\r
-            for(var i = 0, len = sn.length; i < len; i++){\r
-                sn[i].ui.onSelectedChange(false);\r
-            }\r
-            this.selNodes = [];\r
-            this.selMap = {};\r
-            if(suppressEvent !== true){\r
-                this.fireEvent("selectionchange", this, this.selNodes);\r
-            }\r
-        }\r
-    },\r
-    \r
-    <div id="method-Ext.tree.MultiSelectionModel-isSelected"></div>/**\r
-     * Returns true if the node is selected\r
-     * @param {TreeNode} node The node to check\r
-     * @return {Boolean}\r
-     */\r
-    isSelected : function(node){\r
-        return this.selMap[node.id] ? true : false;  \r
-    },\r
-    \r
-    <div id="method-Ext.tree.MultiSelectionModel-getSelectedNodes"></div>/**\r
-     * Returns an array of the selected nodes\r
-     * @return {Array}\r
-     */\r
-    getSelectedNodes : function(){\r
-        return this.selNodes;    \r
-    },\r
-\r
-    onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown,\r
-\r
-    selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext,\r
-\r
-    selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious\r
-});</pre>    \r
-</body>\r
-</html>
\ No newline at end of file