Subversion Repositories eFlore/Applications.coel

Rev

Rev 1329 | Rev 1369 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1329 Rev 1367
Line 4... Line 4...
4
import org.tela_botanica.client.RegistreId;
4
import org.tela_botanica.client.RegistreId;
5
import org.tela_botanica.client.http.JsonRestRequestBuilder;
5
import org.tela_botanica.client.http.JsonRestRequestBuilder;
6
import org.tela_botanica.client.http.JsonRestRequestCallback;
6
import org.tela_botanica.client.http.JsonRestRequestCallback;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
8
import org.tela_botanica.client.modeles.Information;
8
import org.tela_botanica.client.modeles.Information;
-
 
9
import org.tela_botanica.client.synchronisation.Reponse;
9
import org.tela_botanica.client.util.Debug;
10
import org.tela_botanica.client.util.Debug;
10
import org.tela_botanica.client.util.UtilDAO;
11
import org.tela_botanica.client.util.UtilDAO;
Line 11... Line 12...
11
 
12
 
12
import com.extjs.gxt.ui.client.Registry;
13
import com.extjs.gxt.ui.client.Registry;
Line 22... Line 23...
22
	
23
	
23
	private String utilisateurId = null;
24
	private String utilisateurId = null;
Line 24... Line 25...
24
	private Rafraichissable vueARafraichir = null;
25
	private Rafraichissable vueARafraichir = null;
-
 
26
 
25
 
27
	public CollectionACommentaireAsyncDao(Rafraichissable vueARafraichirCourrante) {
26
	public CollectionACommentaireAsyncDao(Rafraichissable vueARafraichirCourrante) {
28
		if (Mediateur.DEBUG) System.out.println("|| CollectionACommentaireAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString());
27
		vueARafraichir = vueARafraichirCourrante;
29
		vueARafraichir = vueARafraichirCourrante;
Line 28... Line 30...
28
		utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
30
		utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
29
	}
31
	}
Line 30... Line 32...
30
	
32
	
Line 31... Line 33...
31
	public void selectionner(final String collectionId) {
33
	public void selectionner(final String collectionId, final Integer seqId) {
Line 42... Line 44...
42
					if (responseValue.isArray() != null) {
44
					if (responseValue.isArray() != null) {
43
						final JSONArray reponse = responseValue.isArray();
45
						final JSONArray reponse = responseValue.isArray();
44
						// Transformation du tableau JSON réponse en ListCommentaier
46
						// Transformation du tableau JSON réponse en ListCommentaier
45
						CollectionACommentaireListe commentaires = new CollectionACommentaireListe(reponse);
47
						CollectionACommentaireListe commentaires = new CollectionACommentaireListe(reponse);
46
						info.setDonnee(0, commentaires);
48
						info.setDonnee(0, commentaires);
-
 
49
						
47
						// et on met à jour le demandeur des données
50
						// et on met à jour le demandeur des données
-
 
51
						if (seqId != null)	{
-
 
52
							Reponse reponseRequete = new Reponse(info, seqId);
-
 
53
							vueARafraichir.rafraichir(reponseRequete);
-
 
54
						}
-
 
55
						else	{
48
						vueARafraichir.rafraichir(info);
56
							vueARafraichir.rafraichir(info);
-
 
57
						}
49
					} else {
58
					} else {
50
						GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un talbeau JSON et vaut : "+responseValue.toString(), null);
59
						GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un talbeau JSON et vaut : "+responseValue.toString(), null);
51
					}
60
					}
52
				} else {
61
				} else {
53
					if (collectionId == null) {
62
					if (collectionId == null) {
54
						// Dans le cas, où nous demandons toutes les relations Collection à Commentaires et qu'il n'y en a pas, nous retournons un message d'information
63
						// Dans le cas, où nous demandons toutes les relations Collection à Commentaires et qu'il n'y en a pas, nous retournons un message d'information
55
						info.setMessage("Aucune relations entre la collection et les commentaires");
64
						info.setMessage("Aucune relations entre la collection et les commentaires");
-
 
65
						
-
 
66
						if (seqId != null)	{
-
 
67
							Reponse reponseRequete = new Reponse(info, seqId);
-
 
68
							vueARafraichir.rafraichir(reponseRequete);
-
 
69
						}
-
 
70
						else	{
56
						vueARafraichir.rafraichir(info);
71
							vueARafraichir.rafraichir(info);
-
 
72
						}
57
					}
73
					}
58
				}
74
				}
59
			}
75
			}
60
		});
76
		});
61
	}
77
	}