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