4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
12 * @class Roo.state.Manager
13 * This is the global state manager. By default all components that are "state aware" check this class
14 * for state information if you don't pass them a custom state provider. In order for this class
15 * to be useful, it must be initialized with a provider when your application initializes.
17 // in your initialization function
19 Roo.state.Manager.setProvider(new Roo.state.CookieProvider());
21 // supposed you have a {@link Roo.BorderLayout}
22 var layout = new Roo.BorderLayout(...);
23 layout.restoreState();
24 // or a {Roo.BasicDialog}
25 var dialog = new Roo.BasicDialog(...);
26 dialog.restoreState();
30 Roo.state.Manager = function(){
31 var provider = new Roo.state.Provider();
35 * Configures the default state provider for your application
36 * @param {Provider} stateProvider The state provider to set
38 setProvider : function(stateProvider){
39 provider = stateProvider;
43 * Returns the current value for a key
44 * @param {String} name The key name
45 * @param {Mixed} defaultValue The default value to return if the key lookup does not match
46 * @return {Mixed} The state data
48 get : function(key, defaultValue){
49 return provider.get(key, defaultValue);
53 * Sets the value for a key
54 * @param {String} name The key name
55 * @param {Mixed} value The state data
57 set : function(key, value){
58 provider.set(key, value);
62 * Clears a value from the state
63 * @param {String} name The key name
65 clear : function(key){
70 * Gets the currently configured state provider
71 * @return {Provider} The state provider
73 getProvider : function(){