~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/ext/source/state/StateManager.js

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Ext JS Library 2.2
 
3
 * Copyright(c) 2006-2008, 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
 
16
init : 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
 */
 
24
Ext.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
}();
 
 
b'\\ No newline at end of file'