Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / source / Manager4.html
diff --git a/docs/source/Manager4.html b/docs/source/Manager4.html
new file mode 100644 (file)
index 0000000..234250e
--- /dev/null
@@ -0,0 +1,70 @@
+<!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-state.Manager'>/**
+</span> * @class Ext.state.Manager
+ * This is the global state manager. By default all components that are &quot;state aware&quot; check this class
+ * for state information if you don't pass them a custom state provider. In order for this class
+ * to be useful, it must be initialized with a provider when your application initializes. Example usage:
+ &lt;pre&gt;&lt;code&gt;
+// in your initialization function
+init : function(){
+   Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+   var win = new Window(...);
+   win.restoreState();
+}
+ &lt;/code&gt;&lt;/pre&gt;
+ * This class passes on calls from components to the underlying {@link Ext.state.Provider} so that
+ * there is a common interface that can be used without needing to refer to a specific provider instance
+ * in every component.
+ * @singleton
+ * @docauthor Evan Trimboli &lt;evan@sencha.com&gt;
+ */
+Ext.define('Ext.state.Manager', {
+    singleton: true,
+    requires: ['Ext.state.Provider'],
+    constructor: function() {
+        this.provider = Ext.create('Ext.state.Provider');
+    },
+    
+    
+<span id='Ext-state.Manager-method-setProvider'>    /**
+</span>     * Configures the default state provider for your application
+     * @param {Provider} stateProvider The state provider to set
+     */
+    setProvider : function(stateProvider){
+        this.provider = stateProvider;
+    },
+
+<span id='Ext-state.Manager-method-get'>    /**
+</span>     * Returns the current value for a key
+     * @param {String} name The key name
+     * @param {Mixed} defaultValue The default value to return if the key lookup does not match
+     * @return {Mixed} The state data
+     */
+    get : function(key, defaultValue){
+        return this.provider.get(key, defaultValue);
+    },
+
+<span id='Ext-state.Manager-method-set'>    /**
+</span>     * Sets the value for a key
+     * @param {String} name The key name
+     * @param {Mixed} value The state data
+     */
+     set : function(key, value){
+        this.provider.set(key, value);
+    },
+
+<span id='Ext-state.Manager-method-clear'>    /**
+</span>     * Clears a value from the state
+     * @param {String} name The key name
+     */
+    clear : function(key){
+        this.provider.clear(key);
+    },
+
+<span id='Ext-state.Manager-method-getProvider'>    /**
+</span>     * Gets the currently configured state provider
+     * @return {Provider} The state provider
+     */
+    getProvider : function(){
+        return this.provider;
+    }
+});</pre></pre></body></html>
\ No newline at end of file