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.data;
10:
11: import com.google.gwt.core.client.JavaScriptObject;
12: import com.gwtext.client.util.JavaScriptObjectHelper;
13:
14: /**
15: * An implementation of DataProxy that simply passes the data specified in its constructor to the Reader when its load method is called.
16: * <p/>
17: * <pre>
18: * <code>
19: * <p/>
20: * Object[][] states = new Object[][]{
21: * new Object[]{"AL", "Alabama"},
22: * new Object[]{"AK", "Alaska"},
23: * new Object[]{"AZ", "Arizona"},
24: * new Object[]{"AR", "Arkansas"},
25: * new Object[]{"CA", "California"}};
26: * <p/>
27: * Reader reader = new ArrayReader(new RecordDef(
28: * new FieldDef[]{
29: * new StringFieldDef("abbr"),
30: * new StringFieldDef("state")
31: * }));
32: * <p/>
33: * Store store = new Store(proxy, reader);
34: * </code>
35: * </pre>
36: */
37: public class MemoryProxy extends DataProxy {
38:
39: /**
40: * Create s new memory proxy using the passed array data.
41: *
42: * @param data the array data
43: */
44: public MemoryProxy(Object[][] data) {
45: jsObj = create(JavaScriptObjectHelper
46: .convertToJavaScriptArray(data));
47: }
48:
49: native JavaScriptObject create(JavaScriptObject data) /*-{
50: return new $wnd.Ext.data.MemoryProxy(data);
51: }-*/;
52: }
|