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 58cc22b..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-<html>\r
-<head>\r
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \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.mon(tree.getTreeEl(), '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, /* 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
-        }else if(this.fireEvent('beforeselect', this, node, last) !== false){\r
-            if(last && last.ui){\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
-     * @param {Boolean} silent True to stop the selectionchange event from firing.\r
-     */\r
-    unselect : function(node, silent){\r
-        if(this.selNode == node){\r
-            this.clearSelections(silent);\r
-        }    \r
-    },\r
-    \r
-    <div id="method-Ext.tree.DefaultSelectionModel-clearSelections"></div>/**\r
-     * Clear all selections\r
-     * @param {Boolean} silent True to stop the selectionchange event from firing.\r
-     */\r
-    clearSelections : function(silent){\r
-        var n = this.selNode;\r
-        if(n){\r
-            n.ui.onSelectedChange(false);\r
-            this.selNode = null;\r
-            if(silent !== true){\r
-                this.fireEvent('selectionchange', this, null);\r
-            }\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(/* 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, this.selectPrevious);\r
-            } else{\r
-                var lc = ps.lastChild;\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, this.selectPrevious);\r
-            }\r
-        } else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){\r
-            return this.select(s.parentNode, this.selectPrevious);\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(/* 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
-        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, 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, this.selectNext);\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.mon(tree.getTreeEl(), '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