webgui/www/extras/extjs/docs/output/Ext.state.CookieProvider.html

314 lines
No EOL
16 KiB
HTML

<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Ext.state.CookieProvider</title>
<link rel="stylesheet" type="text/css" href="../resources/reset.css"/>
<link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="../resources/print.css" media="print">
<!-- GC -->
</head>
<body>
<div class="body-wrap">
<div class="top-tools">
<img src="../resources/print.gif" width="16" height="16" align="absmiddle">&nbsp;<a href="Ext.state.CookieProvider.html" target="_blank">Print Friendly</a><br/>
</div>
<h1>Class Ext.state.CookieProvider</h1>
<table cellspacing="0">
<tr><td class="label">Package:</td><td>Ext.state</td></tr>
<tr><td class="label">Class:</td><td>CookieProvider</td></tr>
<tr><td class="label">Extends:</td><td><a href="Ext.state.Provider.html">Provider</a></td></tr>
<tr><td class="label">Defined In:</td><td><a href="State.jss.html">State.js</a></td></tr>
</table>
<div class="description">
The default Provider implementation which saves state via cookies.
<br />Usage:
<pre class="highlighted"><code>var cp = <b>new</b> Ext.state.CookieProvider({
path: "/cgi-bin/",
expires: <b>new</b> Date(<b>new</b> Date().getTime()+(1000*60*60*24*30)); <i>//30 days</i>
domain: "extjs.com"
})
Ext.state.Manager.setProvider(cp);</code></pre> </div>
<br />
<a href="#properties">Properties</a>
&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#methods">Methods</a>
&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#events">Events</a>
&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#configs">Config Options</a>
<hr />
<a name="properties"></a>
<h2>Public Properties</h2>
<div class="no-members">This class has no public properties.</div> <a name="methods"></a>
<h2>Public Methods</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Method</th>
<th class="msource-header">Defined By</th>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#CookieProvider">CookieProvider</a>(<code>Object config</code>)</td>
<td class="msource" rowspan="2">CookieProvider</td>
</tr>
<tr>
<td class="mdesc">Create a new CookieProvider</td>
</tr>
<tr class="alt">
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#clear">clear</a>(<code>String name</code>) : void</td>
<td class="msource" rowspan="2"><a href="Ext.state.Provider.html#clear">Provider</a></td>
</tr>
<tr class="alt">
<td class="mdesc">Clears a value from the state</td>
</tr>
<tr>
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#decodeValue">decodeValue</a>(<code>String value</code>) : Mixed</td>
<td class="msource" rowspan="2"><a href="Ext.state.Provider.html#decodeValue">Provider</a></td>
</tr>
<tr>
<td class="mdesc">Decodes a string previously encoded with <a href="#encodeValue">encodeValue</a>.</td>
</tr>
<tr class="alt">
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#encodeValue">encodeValue</a>(<code>Mixed value</code>) : String</td>
<td class="msource" rowspan="2"><a href="Ext.state.Provider.html#encodeValue">Provider</a></td>
</tr>
<tr class="alt">
<td class="mdesc">Encodes a value including type information. Decode with <a href="#decodeValue">decodeValue</a>.</td>
</tr>
<tr>
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#get">get</a>(<code>String name</code>, <code>Mixed defaultValue</code>) : Mixed</td>
<td class="msource" rowspan="2"><a href="Ext.state.Provider.html#get">Provider</a></td>
</tr>
<tr>
<td class="mdesc">Returns the current value for a key</td>
</tr>
<tr class="alt">
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#set">set</a>(<code>String name</code>, <code>Mixed value</code>) : void</td>
<td class="msource" rowspan="2"><a href="Ext.state.Provider.html#set">Provider</a></td>
</tr>
<tr class="alt">
<td class="mdesc">Sets the value for a key</td>
</tr>
</table>
<a name="events"></a>
<h2>Public Events</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Event</th>
<th class="msource-header">Defined By</th>
</tr>
<tr>
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#event-statechange">statechange</a> : (<code>Provider this</code>, <code>String key</code>, <code>String value</code>)</td>
<td class="msource" rowspan="2"><a href="Ext.state.Provider.html#event-statechange">Provider</a></td>
</tr>
<tr>
<td class="mdesc">Fires when a state change occurs.</td>
</tr>
</table>
<a name="configs"></a>
<h2>Config Options</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Config Options</th>
<th class="msource-header">Defined By</th>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-domain">domain</a> : String</td>
<td class="msource" rowspan="2">CookieProvider</td>
</tr>
<tr>
<td class="mdesc">The domain to save the cookie for. Note that you cannot specify a different domain than your page is on, but you can ...</td>
</tr>
<tr class="alt">
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-expires">expires</a> : Date</td>
<td class="msource" rowspan="2">CookieProvider</td>
</tr>
<tr class="alt">
<td class="mdesc">The cookie expiration date (defaults to 7 days from now)</td>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-path">path</a> : String</td>
<td class="msource" rowspan="2">CookieProvider</td>
</tr>
<tr>
<td class="mdesc">The path for which the cookie is active (defaults to root '/' which makes it active for all pages in the site)</td>
</tr>
<tr class="alt">
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-secure">secure</a> : Boolean</td>
<td class="msource" rowspan="2">CookieProvider</td>
</tr>
<tr class="alt">
<td class="mdesc">True if the site is using SSL (defaults to false)</td>
</tr>
</table>
<a name="CookieProvider"></a>
<h2 class="mdetail-head">Constructor Details</h2>
<div class="detail-wrap">
<div class="mdetail">
<h3>CookieProvider</i></h3>
<code>public function CookieProvider(<code>Object config</code>)</code>
<div class="mdetail-desc">
Create a new CookieProvider <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>config</code> : Object<div class="sub-desc">The configuration object</div></li> </ul>
</div>
</div>
</div>
</div>
<h2 class="mdetail-head">Method Details</h2>
<div class="detail-wrap">
<a name="clear"></a>
<div class="mdetail">
<h3>clear</i></h3>
<code>public function clear(<code>String name</code>)</code>
<div class="mdetail-desc">
Clears a value from the state
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>name</code> : String<div class="sub-desc">The key name</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.state.Provider.html#clear">Provider</a>.</div>
</div>
<a name="decodeValue"></a>
<div class="mdetail alt">
<h3>decodeValue</i></h3>
<code>public function decodeValue(<code>String value</code>)</code>
<div class="mdetail-desc">
Decodes a string previously encoded with <a href="#encodeValue">encodeValue</a>.
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>value</code> : String<div class="sub-desc">The value to decode</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Mixed</code><div class="sub-desc">The decoded value</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.state.Provider.html#decodeValue">Provider</a>.</div>
</div>
<a name="encodeValue"></a>
<div class="mdetail">
<h3>encodeValue</i></h3>
<code>public function encodeValue(<code>Mixed value</code>)</code>
<div class="mdetail-desc">
Encodes a value including type information. Decode with <a href="#decodeValue">decodeValue</a>.
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>value</code> : Mixed<div class="sub-desc">The value to encode</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>String</code><div class="sub-desc">The encoded value</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.state.Provider.html#encodeValue">Provider</a>.</div>
</div>
<a name="get"></a>
<div class="mdetail alt">
<h3>get</i></h3>
<code>public function get(<code>String name</code>, <code>Mixed defaultValue</code>)</code>
<div class="mdetail-desc">
Returns the current value for a key
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>name</code> : String<div class="sub-desc">The key name</div></li><li><code>defaultValue</code> : Mixed<div class="sub-desc">A default value to return if the key's value is not found</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Mixed</code><div class="sub-desc">The state data</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.state.Provider.html#get">Provider</a>.</div>
</div>
<a name="set"></a>
<div class="mdetail">
<h3>set</i></h3>
<code>public function set(<code>String name</code>, <code>Mixed value</code>)</code>
<div class="mdetail-desc">
Sets the value for a key
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>name</code> : String<div class="sub-desc">The key name</div></li><li><code>value</code> : Mixed<div class="sub-desc">The value to set</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.state.Provider.html#set">Provider</a>.</div>
</div>
</div>
<h2 class="mdetail-head">Event Details</h2>
<div class="detail-wrap">
<a name="event-statechange"></a>
<div class="mdetail">
<h3>statechange</i></h3>
<code>public event statechange</code>
<div class="mdetail-desc">
Fires when a state change occurs.
<div class="mdetail-params">
<strong style="font-weight:normal;">Subscribers will be called with the following parameters:</strong>
<ul><li><code>this</code> : Provider<div class="sub-desc">This state provider</div></li><li><code>key</code> : String<div class="sub-desc">The state key which was changed</div></li><li><code>value</code> : String<div class="sub-desc">The encoded value for the state</div></li> </ul>
</div>
</div>
<div class="mdetail-def">This event is defined by <a href="Ext.state.Provider.html#event-statechange">Provider</a>.</div>
</div>
</div>
<h2 class="mdetail-head">Config Details</h2>
<div class="detail-wrap">
<a name="config-domain"></a>
<div class="mdetail">
<h3>domain</i></h3>
<code>domain : String</code>
<div class="mdetail-desc">
The domain to save the cookie for. Note that you cannot specify a different domain than your page is on, but you can specify a sub-domain, or simply the domain itself like 'extjs.com' to include all sub-domains if you need to access cookies across different sub-domains (defaults to null which uses the same domain the page is running on including the 'www' like 'www.extjs.com') </div>
<div class="mdetail-def">This config option is defined by CookieProvider.</div>
</div>
<a name="config-expires"></a>
<div class="mdetail alt">
<h3>expires</i></h3>
<code>expires : Date</code>
<div class="mdetail-desc">
The cookie expiration date (defaults to 7 days from now) </div>
<div class="mdetail-def">This config option is defined by CookieProvider.</div>
</div>
<a name="config-path"></a>
<div class="mdetail">
<h3>path</i></h3>
<code>path : String</code>
<div class="mdetail-desc">
The path for which the cookie is active (defaults to root '/' which makes it active for all pages in the site) </div>
<div class="mdetail-def">This config option is defined by CookieProvider.</div>
</div>
<a name="config-secure"></a>
<div class="mdetail alt">
<h3>secure</i></h3>
<code>secure : Boolean</code>
<div class="mdetail-desc">
True if the site is using SSL (defaults to false) </div>
<div class="mdetail-def">This config option is defined by CookieProvider.</div>
</div>
</div>
</div>
<hr>
<div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright &copy; 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
</body>
</html>