Print Friendly

# Class YAHOO.ext.state.Manager

Package: | YAHOO.ext.state
Class: | Manager
Extends: | Object
Defined In: | State.js

This is the global state manager. By default all components that are "state aware" 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.

    // in your initialization function
    init : function(){
       YAHOO.ext.state.Manager.setProvider(new YAHOO.ext.state.CookieProvider());
       ...
       // supposed you have a YAHOO.ext.BorderLayout
       var layout = new YAHOO.ext.BorderLayout(...);
       layout.restoreState();
       // or a {YAHOO.ext.BasicDialog}
       var dialog = new YAHOO.ext.BasicDialog(...);
       dialog.restoreState();

This class is a singleton and cannot be created directly.

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| clear() : void | Manager
Clear a value from the state.
| get(`String name`, `Mixed defaultValue`) : Mixed | Manager
Get the current value for a key.
| getProvider() : Provider | Manager
Gets the currently configured provider.
| set(`String name`, `Mixed value`) : void | Manager
Set the value for a key.
| setProvider(`Provider stateProvider`) : void | Manager
Configures the default provider for your application.

## Public Events

This class has no public events.

## Method Details

### clear

`public function clear()`
Clear a value from the state.
Parameters:

- None.

Returns:

- `void`

This method is defined by Manager.

### get

`public function get(`String name`, `Mixed defaultValue`)`
Get the current value for a key.
Parameters:

- `name` : String
- `defaultValue` : Mixed

Returns:

- `Mixed`

This method is defined by Manager.

### getProvider

`public function getProvider()`
Gets the currently configured provider.
Parameters:

- None.

Returns:

- `Provider`

This method is defined by Manager.

### set

`public function set(`String name`, `Mixed value`)`
Set the value for a key.
Parameters:

- `name` : String
- `value` : Mixed

Returns:

- `void`

This method is defined by Manager.

### setProvider

`public function setProvider(`Provider stateProvider`)`
Configures the default provider for your application.
Parameters:

- `stateProvider` : Provider

Returns:

- `void`

This method is defined by Manager.

Copyright © 2006 Jack Slocum. All rights reserved.