
com.extjs.gxt.ui.client.data.MemoryProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gxt Show documentation
Show all versions of gxt Show documentation
Rich Internet Application Framework for GWT
/*
* Sencha GXT 2.3.0 - Sencha for GWT
* Copyright(c) 2007-2013, Sencha, Inc.
* [email protected]
*
* http://www.sencha.com/products/gxt/license/
*/
package com.extjs.gxt.ui.client.data;
import java.util.ArrayList;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* A DataProxy
implementation that simply passes the data specified
* in the constructor to the reader when its load method is called.
*
* @param the data type being returned by the proxy
*/
public class MemoryProxy implements DataProxy {
protected Object data;
/**
* Creates new memory proxy.
*
* @param data the local data
*/
public MemoryProxy(Object data) {
this.data = data;
}
/**
* Returns the proxy data.
*
* @return the data
*/
public Object getData() {
return data;
}
@SuppressWarnings({"unchecked", "rawtypes"})
public void load(DataReader reader, Object loadConfig, AsyncCallback callback) {
try {
D d = null;
if (reader != null) {
d = reader.read(loadConfig, data);
} else {
d = (D) data;
if (d instanceof List) {
d = (D) new ArrayList((List) d);
}
}
callback.onSuccess(d);
} catch (Exception e) {
callback.onFailure(e);
}
}
/**
* Sets the proxy data.
*
* @param data the data
*/
public void setData(Object data) {
this.data = data;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy