Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.client.composants.pagination;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.data.BasePagingLoadConfig;
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
import com.extjs.gxt.ui.client.data.DataReader;
import com.extjs.gxt.ui.client.data.MemoryProxy;
import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class ProxyPersonnesAPublication<D> extends Proxy {
String publicationId = null;
public ProxyPersonnesAPublication(Sequenceur sequenceur, String publicationId) {
super(sequenceur);
this.publicationId = publicationId;
}
@Override
public void load(TransformateurJSONaModelData reader, Object loadConfig, AsyncCallback callback, String recherche) {
this.reader = reader;
this.callback = callback;
this.loadConfig = loadConfig;
BasePagingLoadConfig lc = (BasePagingLoadConfig)loadConfig;
mediateur.selectionnerPersonnesAPublication(this, this.publicationId, recherche, lc.getOffset(), lc.getLimit(), sequenceur);
}
public void setPublicationId(String publicationId) {
this.publicationId = publicationId;
}
@Override
@SuppressWarnings("unchecked")
public void rafraichir(Object nouvellesDonnees) {
try
{
data = nouvellesDonnees;
D d = null;
if (reader != null)
{
d = (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);
}
}
}