provide installation instructions
[extjs.git] / source / data / StoreMgr.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.StoreMgr\r
11  * @extends Ext.util.MixedCollection\r
12  * The default global group of stores.\r
13  * @singleton\r
14  */\r
15 Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), {\r
16     /**\r
17      * @cfg {Object} listeners @hide\r
18      */\r
19 \r
20     /**\r
21      * Registers one or more Stores with the StoreMgr. You do not normally need to register stores\r
22      * manually.  Any store initialized with a {@link Ext.data.Store#storeId} will be auto-registered. \r
23      * @param {Ext.data.Store} store1 A Store instance\r
24      * @param {Ext.data.Store} store2 (optional)\r
25      * @param {Ext.data.Store} etc... (optional)\r
26      */\r
27     register : function(){\r
28         for(var i = 0, s; s = arguments[i]; i++){\r
29             this.add(s);\r
30         }\r
31     },\r
32 \r
33     /**\r
34      * Unregisters one or more Stores with the StoreMgr\r
35      * @param {String/Object} id1 The id of the Store, or a Store instance\r
36      * @param {String/Object} id2 (optional)\r
37      * @param {String/Object} etc... (optional)\r
38      */\r
39     unregister : function(){\r
40         for(var i = 0, s; s = arguments[i]; i++){\r
41             this.remove(this.lookup(s));\r
42         }\r
43     },\r
44 \r
45     /**\r
46      * Gets a registered Store by id\r
47      * @param {String/Object} id The id of the Store, or a Store instance\r
48      * @return {Ext.data.Store}\r
49      */\r
50     lookup : function(id){\r
51         return typeof id == "object" ? id : this.get(id);\r
52     },\r
53 \r
54     // getKey implementation for MixedCollection\r
55     getKey : function(o){\r
56          return o.storeId || o.id;\r
57     }\r
58 });