Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1943 → Rev 1944

/tags/v1.11-okuzgozu/src/org/tela_botanica/client/composants/pagination/ProxyPersonnesAPublication.java
New file
0,0 → 1,63
package org.tela_botanica.client.composants.pagination;
 
import java.util.ArrayList;
import java.util.List;
 
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Log;
import org.tela_botanica.client.util.UtilString;
 
import com.extjs.gxt.ui.client.data.BasePagingLoadConfig;
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;
if (!UtilString.isEmpty(this.publicationId)) {
mediateur.selectionnerPersonnesAPublication(this, this.publicationId, recherche, lc.getOffset(), lc.getLimit(), sequenceur);
} else {
this.rafraichir(null);
}
}
public void setPublicationId(String publicationId) {
this.publicationId = publicationId;
}
 
@Override
@SuppressWarnings("unchecked")
public void rafraichir(Object nouvellesDonnees) {
try {
D donneesRetour = null;
if (nouvellesDonnees != null) {
data = nouvellesDonnees;
if (reader != null) {
donneesRetour = (D) reader.read(loadConfig, data);
} else {
donneesRetour = (D) data;
if (donneesRetour instanceof List) {
donneesRetour = (D) new ArrayList((List) donneesRetour);
}
}
}
Log.debug("Dans Proxy : "+donneesRetour.toString());
callback.onSuccess(donneesRetour);
} catch (Exception e) {
callback.onFailure(e);
}
}
 
}