4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-state-Manager'>/**
19 </span> * @class Ext.state.Manager
20 * This is the global state manager. By default all components that are "state aware" check this class
21 * for state information if you don't pass them a custom state provider. In order for this class
22 * to be useful, it must be initialized with a provider when your application initializes. Example usage:
23 <pre><code>
24 // in your initialization function
26 Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
27 var win = new Window(...);
30 </code></pre>
31 * This class passes on calls from components to the underlying {@link Ext.state.Provider} so that
32 * there is a common interface that can be used without needing to refer to a specific provider instance
35 * @docauthor Evan Trimboli <evan@sencha.com>
37 Ext.define('Ext.state.Manager', {
39 requires: ['Ext.state.Provider'],
40 constructor: function() {
41 this.provider = Ext.create('Ext.state.Provider');
45 <span id='Ext-state-Manager-method-setProvider'> /**
46 </span> * Configures the default state provider for your application
47 * @param {Provider} stateProvider The state provider to set
49 setProvider : function(stateProvider){
50 this.provider = stateProvider;
53 <span id='Ext-state-Manager-method-get'> /**
54 </span> * Returns the current value for a key
55 * @param {String} name The key name
56 * @param {Mixed} defaultValue The default value to return if the key lookup does not match
57 * @return {Mixed} The state data
59 get : function(key, defaultValue){
60 return this.provider.get(key, defaultValue);
63 <span id='Ext-state-Manager-method-set'> /**
64 </span> * Sets the value for a key
65 * @param {String} name The key name
66 * @param {Mixed} value The state data
68 set : function(key, value){
69 this.provider.set(key, value);
72 <span id='Ext-state-Manager-method-clear'> /**
73 </span> * Clears a value from the state
74 * @param {String} name The key name
76 clear : function(key){
77 this.provider.clear(key);
80 <span id='Ext-state-Manager-method-getProvider'> /**
81 </span> * Gets the currently configured state provider
82 * @return {Provider} The state provider
84 getProvider : function(){