1484 |
cyprien |
1 |
package org.tela_botanica.client.composants.pagination;
|
|
|
2 |
|
|
|
3 |
import java.util.ArrayList;
|
|
|
4 |
import java.util.HashMap;
|
|
|
5 |
import java.util.List;
|
|
|
6 |
|
|
|
7 |
import org.tela_botanica.client.Mediateur;
|
|
|
8 |
import org.tela_botanica.client.RegistreId;
|
|
|
9 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
10 |
import org.tela_botanica.client.modeles.ValeurListe;
|
|
|
11 |
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
|
|
|
12 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
|
|
13 |
import org.tela_botanica.client.util.Debug;
|
1493 |
cyprien |
14 |
import org.tela_botanica.client.util.UtilString;
|
1484 |
cyprien |
15 |
|
|
|
16 |
import com.extjs.gxt.ui.client.Registry;
|
|
|
17 |
import com.extjs.gxt.ui.client.data.BasePagingLoadConfig;
|
|
|
18 |
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
|
|
|
19 |
import com.extjs.gxt.ui.client.data.DataReader;
|
|
|
20 |
import com.extjs.gxt.ui.client.data.MemoryProxy;
|
|
|
21 |
import com.extjs.gxt.ui.client.data.ModelData;
|
|
|
22 |
import com.google.gwt.json.client.JSONObject;
|
|
|
23 |
import com.google.gwt.json.client.JSONString;
|
|
|
24 |
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
25 |
|
|
|
26 |
public class ProxyCollectionACommentaire<D> extends Proxy {
|
|
|
27 |
|
|
|
28 |
String collectionId = null;
|
|
|
29 |
|
|
|
30 |
public ProxyCollectionACommentaire(Sequenceur sequenceur, String collectionId) {
|
|
|
31 |
super(sequenceur);
|
|
|
32 |
|
|
|
33 |
this.collectionId = collectionId;
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
@Override
|
|
|
37 |
public void load(TransformateurJSONaModelData reader, Object loadConfig, AsyncCallback callback, String recherche) {
|
1493 |
cyprien |
38 |
this.reader = reader;
|
|
|
39 |
this.callback = callback;
|
|
|
40 |
this.loadConfig = loadConfig;
|
1484 |
cyprien |
41 |
|
1493 |
cyprien |
42 |
BasePagingLoadConfig lc = (BasePagingLoadConfig)loadConfig;
|
|
|
43 |
if (!UtilString.isEmpty(this.collectionId)) {
|
|
|
44 |
mediateur.selectionnerCollectionACommentaire(this, this.collectionId, recherche, lc.getOffset(), lc.getLimit(), sequenceur);
|
|
|
45 |
}
|
1484 |
cyprien |
46 |
}
|
|
|
47 |
|
|
|
48 |
@Override
|
|
|
49 |
@SuppressWarnings("unchecked")
|
|
|
50 |
public void rafraichir(Object nouvellesDonnees) {
|
|
|
51 |
try
|
|
|
52 |
{
|
1493 |
cyprien |
53 |
D donneesRetour = null;
|
|
|
54 |
if (nouvellesDonnees!=null) {
|
|
|
55 |
data = nouvellesDonnees;
|
|
|
56 |
if (reader != null)
|
|
|
57 |
{
|
|
|
58 |
donneesRetour = (D) reader.read(loadConfig, data);
|
|
|
59 |
}
|
|
|
60 |
else
|
|
|
61 |
{
|
|
|
62 |
donneesRetour = (D) data;
|
|
|
63 |
if (donneesRetour instanceof List)
|
|
|
64 |
{
|
|
|
65 |
donneesRetour = (D) new ArrayList((List) donneesRetour);
|
|
|
66 |
}
|
|
|
67 |
}
|
|
|
68 |
}
|
|
|
69 |
callback.onSuccess(donneesRetour);
|
|
|
70 |
|
1484 |
cyprien |
71 |
}
|
|
|
72 |
catch (Exception e)
|
|
|
73 |
{
|
|
|
74 |
callback.onFailure(e);
|
|
|
75 |
}
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
}
|