source: trunk/web/addons/job_monarch/lib/extjs/source/state/StateManager.js @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 2.1 KB
Line 
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.state.Manager
11 * This is the global state manager. By default all components that are "state aware" check this class
12 * for state information if you don't pass them a custom state provider. In order for this class
13 * to be useful, it must be initialized with a provider when your application initializes. Example usage:
14 <pre><code>
15// in your initialization function
16init : function(){
17   Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
18   var win = new Window(...);
19   win.restoreState();
20}
21 </code></pre>
22 * @singleton
23 */
24Ext.state.Manager = function(){
25    var provider = new Ext.state.Provider();
26
27    return {
28        /**
29         * Configures the default state provider for your application
30         * @param {Provider} stateProvider The state provider to set
31         */
32        setProvider : function(stateProvider){
33            provider = stateProvider;
34        },
35
36        /**
37         * Returns the current value for a key
38         * @param {String} name The key name
39         * @param {Mixed} defaultValue The default value to return if the key lookup does not match
40         * @return {Mixed} The state data
41         */
42        get : function(key, defaultValue){
43            return provider.get(key, defaultValue);
44        },
45
46        /**
47         * Sets the value for a key
48         * @param {String} name The key name
49         * @param {Mixed} value The state data
50         */
51         set : function(key, value){
52            provider.set(key, value);
53        },
54
55        /**
56         * Clears a value from the state
57         * @param {String} name The key name
58         */
59        clear : function(key){
60            provider.clear(key);
61        },
62
63        /**
64         * Gets the currently configured state provider
65         * @return {Provider} The state provider
66         */
67        getProvider : function(){
68            return provider;
69        }
70    };
71}();
Note: See TracBrowser for help on using the repository browser.