Package com.sencha.gxt.state.client
Class StateManager
- java.lang.Object
-
- com.sencha.gxt.state.client.StateManager
-
public abstract class StateManager extends Object
This is the global state manager. In order for this class to be useful, it must be initialized with a provider when your application initializes. By default, GXT initializes the StateManager with a CookieProvider. The provider can be replaced as needed. The Provider is treated as an asynchronous String persistence mechanism, as to be compatible with RPC, RequestFactory, Cookies, and HTML5 storage. The StateManager then has tools to map these strings to and from bean-like interfaces, using AutoBeans.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(String name)
Clears the state bean.static StateManager
get()
Returns the singleton instance.<T> void
get(String name, Class<T> stateBeanType, com.google.gwt.core.client.Callback<T,Throwable> callback)
Returns a state bean.<S> S
getDefaultStateInstance(Class<S> stateType)
Returns the default state instance.Provider
getProvider()
Returns the manager's state provider.<T> void
set(String name, T stateBean)
Sets a state bean.void
setProvider(Provider stateProvider)
Sets the manager's state provider.
-
-
-
Method Detail
-
get
public static StateManager get()
Returns the singleton instance.- Returns:
- the state manager
-
clear
public void clear(String name)
Clears the state bean.- Parameters:
name
- the bean name
-
get
public <T> void get(String name, Class<T> stateBeanType, com.google.gwt.core.client.Callback<T,Throwable> callback)
Returns a state bean. In order to support server side calls, the method returns its value asynchronously via a callback.- Type Parameters:
T
- the state bean type- Parameters:
name
- the bean namestateBeanType
- the state bean classcallback
- the callback
-
getDefaultStateInstance
public <S> S getDefaultStateInstance(Class<S> stateType)
Returns the default state instance.- Type Parameters:
S
- the state type- Parameters:
stateType
- the state class- Returns:
- the state bean
-
getProvider
public Provider getProvider()
Returns the manager's state provider.- Returns:
- the provider
-
set
public <T> void set(String name, T stateBean)
Sets a state bean.- Type Parameters:
T
- the state bean type- Parameters:
name
- the bean namestateBean
- the state bean
-
setProvider
public void setProvider(Provider stateProvider)
Sets the manager's state provider.- Parameters:
stateProvider
- the provider
-
-