| Line 6... |
Line 6... |
| 6 |
import org.tela_botanica.client.RegistreId;
|
6 |
import org.tela_botanica.client.RegistreId;
|
| 7 |
import org.tela_botanica.client.http.JsonRestRequestBuilder;
|
7 |
import org.tela_botanica.client.http.JsonRestRequestBuilder;
|
| 8 |
import org.tela_botanica.client.http.JsonRestRequestCallback;
|
8 |
import org.tela_botanica.client.http.JsonRestRequestCallback;
|
| 9 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
9 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 10 |
import org.tela_botanica.client.modeles.Information;
|
10 |
import org.tela_botanica.client.modeles.Information;
|
| - |
|
11 |
import org.tela_botanica.client.util.Debug;
|
| 11 |
import org.tela_botanica.client.util.UtilDAO;
|
12 |
import org.tela_botanica.client.util.UtilDAO;
|
| 12 |
import com.extjs.gxt.ui.client.Registry;
|
13 |
import com.extjs.gxt.ui.client.Registry;
|
| 13 |
import com.google.gwt.core.client.GWT;
|
14 |
import com.google.gwt.core.client.GWT;
|
| 14 |
import com.google.gwt.json.client.JSONArray;
|
15 |
import com.google.gwt.json.client.JSONArray;
|
| 15 |
import com.google.gwt.json.client.JSONValue;
|
16 |
import com.google.gwt.json.client.JSONValue;
|
| Line 24... |
Line 25... |
| 24 |
vueARafraichir = vue;
|
25 |
vueARafraichir = vue;
|
| 25 |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
|
26 |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
|
| 26 |
}
|
27 |
}
|
| Line 27... |
Line 28... |
| 27 |
|
28 |
|
| 28 |
public void selectionner(String personneId, String projetId, String nomComplet, final int pageCourante, final int nbElements) {
|
- |
|
| - |
|
29 |
public void selectionner(String personneId, String projetId, String nomComplet, final int pageCourante, final int nbElements) {
|
| 29 |
System.out.println(pageCourante +" " + nbElements);
|
30 |
|
| Line 30... |
Line 31... |
| 30 |
String[] parametres = {personneId, projetId, nomComplet};
|
31 |
String[] parametres = {personneId, projetId, nomComplet};
|
| 31 |
|
32 |
|
| - |
|
33 |
HashMap<String, String> restrictions = new HashMap<String, String>();
|
| 32 |
HashMap<String, String> restrictions = new HashMap<String, String>();
|
34 |
restrictions.put("start", String.valueOf(pageCourante*nbElements));
|
| 33 |
restrictions.put("start", String.valueOf(pageCourante*nbElements));
|
35 |
|
| 34 |
if (nbElements != -1) {
|
36 |
if (nbElements != -1) {
|
| Line 35... |
Line 37... |
| 35 |
restrictions.put("limit", String.valueOf(nbElements));
|
37 |
restrictions.put("limit", String.valueOf(nbElements));
|
| Line 48... |
Line 50... |
| 48 |
PersonneListe personnes;
|
50 |
PersonneListe personnes;
|
| 49 |
if (reponse.get(0).isArray() != null) {
|
51 |
if (reponse.get(0).isArray() != null) {
|
| 50 |
personnes = new PersonneListe(reponse);
|
52 |
personnes = new PersonneListe(reponse);
|
| 51 |
} else {
|
53 |
} else {
|
| 52 |
personnes = new PersonneListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir);
|
54 |
personnes = new PersonneListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir);
|
| 53 |
}
|
55 |
}
|
| - |
|
56 |
|
| 54 |
personnes.setTaillePage(nbElements);
|
57 |
personnes.setTaillePage(nbElements);
|
| 55 |
personnes.setPageCourante(pageCourante);
|
58 |
personnes.setPageCourante(pageCourante);
|
| 56 |
info.setDonnee(0, personnes);
|
59 |
info.setDonnee(0, personnes);
|
| Line 57... |
Line 60... |
| 57 |
|
60 |
|
| Line 63... |
Line 66... |
| 63 |
}
|
66 |
}
|
| 64 |
});
|
67 |
});
|
| 65 |
}
|
68 |
}
|
| Line 66... |
Line 69... |
| 66 |
|
69 |
|
| - |
|
70 |
public void ajouter(Personne personne) {
|
| 67 |
public void ajouter(Personne personne) {
|
71 |
|
| 68 |
String postDonneesEncodees = personne.obtenirChainePOST();
|
72 |
String postDonneesEncodees = personne.obtenirChainePOST();
|
| 69 |
postDonneesEncodees += "&cmhl_ce_modifier_par=" + utilisateurId;
|
73 |
postDonneesEncodees += "&cmhl_ce_modifier_par=" + utilisateurId;
|
| 70 |
|
74 |
|
| 71 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
|
75 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
|
| 72 |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
|
76 |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
|
| 73 |
@Override
|
77 |
@Override
|
| 74 |
public void surReponse(JSONValue responseValue) {
|
78 |
public void surReponse(JSONValue responseValue) {
|
| Line 83... |
Line 87... |
| 83 |
vueARafraichir.rafraichir(info);
|
87 |
vueARafraichir.rafraichir(info);
|
| 84 |
} else {
|
88 |
} else {
|
| 85 |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
89 |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
| 86 |
}
|
90 |
}
|
| 87 |
}
|
91 |
}
|
| 88 |
});
|
92 |
});
|
| 89 |
}
|
93 |
}
|
| Line 90... |
Line 94... |
| 90 |
|
94 |
|
| 91 |
public void modifier(Personne personne) {
|
95 |
public void modifier(Personne personne) {
|
| 92 |
String postDonneesEncodees = personne.obtenirChainePOST();
|
96 |
String postDonneesEncodees = personne.obtenirChainePOST();
|
| Line 107... |
Line 111... |
| 107 |
}
|
111 |
}
|
| 108 |
}
|
112 |
}
|
| 109 |
});
|
113 |
});
|
| 110 |
}
|
114 |
}
|
| Line 111... |
Line 115... |
| 111 |
|
115 |
|
| 112 |
public void supprimer(String personnesId) {
|
116 |
public void supprimer(String personnesId) {
|
| 113 |
String[] parametres = {utilisateurId, personnesId};
|
117 |
String[] parametres = {utilisateurId, personnesId};
|
| 114 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
|
118 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
|
| 115 |
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() {
|
119 |
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() {
|
| 116 |
@Override
|
120 |
@Override
|