Blame | Last modification | View Log | RSS feed
package org.tela_botanica.client.composants.pagination;
import com.extjs.gxt.ui.client.data.BasePagingLoader;
import com.extjs.gxt.ui.client.data.LoadEvent;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class ChargeurListe<D extends PagingLoadResult<?>> extends BasePagingLoader<D> {
private String recherche = "";
@SuppressWarnings("unchecked")
public ChargeurListe(Proxy proxy, TransformateurJSONaModelData reader) {
super(proxy, reader);
}
public boolean load(Object loadConfig, String recherche) {
if (fireEvent(BeforeLoad, new LoadEvent(this, loadConfig))) {
lastConfig = loadConfig;
this.recherche = recherche;
loadData(loadConfig, recherche);
return true;
}
else return false;
}
public boolean load(Object loadConfig) {
if (fireEvent(BeforeLoad, new LoadEvent(this, loadConfig))) {
lastConfig = loadConfig;
loadData(loadConfig, recherche);
return true;
}
return false;
}
public void load(int offset, int limit) {
this.offset = offset;
this.limit = limit;
load();
}
public boolean load() {
Object config = (reuseConfig && lastConfig != null) ? lastConfig : newLoadConfig();
config = prepareLoadConfig(config);
return load(config);
}
@SuppressWarnings("unchecked")
protected void loadData(final Object config, String recherche) {
AsyncCallback<D> callback = new AsyncCallback<D>() {
public void onFailure(Throwable caught) {
onLoadFailure(config, caught);
}
public void onSuccess(D result) {
onLoadSuccess(config, result);
}
};
((Proxy)proxy).load((TransformateurJSONaModelData)reader, config, callback, recherche);
}
}