01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08:
09: package com.gwtext.client.state;
10:
11: import com.gwtext.client.core.JsObject;
12:
13: /**
14: * Abstract base class for state provider implementations.
15: */
16: public abstract class Provider extends JsObject {
17:
18: /**
19: * Clears a value from the state.
20: *
21: * @param name the key name
22: */
23: public native void clear(String name) /*-{
24: var provider = this.@com.gwtext.client.core.JsObject::getJsObj()();
25: provider.clear(name);
26: }-*/;
27:
28: //todo add get and set
29: /**
30: * Returns the current value for a key
31: *
32: * @param name the key name
33: * @return the key valeu as String
34: */
35: public native String getAsString(String name) /*-{
36: var provider = this.@com.gwtext.client.core.JsObject::getJsObj()();
37: var val = provider.get(name);
38: return val === undefined ? null : val.toString();
39: }-*/;
40:
41: /**
42: * Sets the value for a key.
43: *
44: * @param name the key name
45: * @param value the key value
46: */
47: public native void set(String name, String value) /*-{
48: var provider = this.@com.gwtext.client.core.JsObject::getJsObj()();
49: provider.set(name, value);
50: }-*/;
51: }
|