Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 971 Rev 973
Line 10... Line 10...
10
import com.google.gwt.http.client.RequestBuilder;
10
import com.google.gwt.http.client.RequestBuilder;
11
import com.google.gwt.http.client.RequestCallback;
11
import com.google.gwt.http.client.RequestCallback;
12
import com.google.gwt.http.client.RequestException;
12
import com.google.gwt.http.client.RequestException;
13
import com.google.gwt.http.client.Response;
13
import com.google.gwt.http.client.Response;
14
import com.google.gwt.json.client.JSONArray;
14
import com.google.gwt.json.client.JSONArray;
-
 
15
import com.google.gwt.json.client.JSONObject;
15
import com.google.gwt.json.client.JSONParser;
16
import com.google.gwt.json.client.JSONParser;
16
import com.google.gwt.json.client.JSONString;
17
import com.google.gwt.json.client.JSONString;
17
import com.google.gwt.json.client.JSONValue;
18
import com.google.gwt.json.client.JSONValue;
18
import com.google.gwt.user.client.Window;
19
import com.google.gwt.user.client.Window;
Line 43... Line 44...
43
		iModele = im;
44
		iModele = im;
44
	}
45
	}
Line 45... Line 46...
45
	
46
	
46
	public void obtenirLiaisonsImagesObservations(Rafraichissable r,String id)
47
	public void obtenirLiaisonsImagesObservations(Rafraichissable r,String id)
47
	{
48
	{
Line 48... Line 49...
48
		String paramGet = "&id_image="+id ;
49
		String paramGet = "id_image="+id ;
Line 49... Line 50...
49
		
50
		
50
		raf = r ;
51
		raf = r ;
Line 69... Line 70...
69
						JSONArray reponse=null;
70
						JSONArray reponse=null;
Line 70... Line 71...
70
						
71
						
71
						// si c'est un tableau
72
						// si c'est un tableau
Line 72... Line 73...
72
						if ((reponse=responseValue.isArray()) != null) {
73
						if ((reponse=responseValue.isArray()) != null) {
73
							
74
							
Line 74... Line 75...
74
							JSONArray observation;
75
							JSONObject observation;
Line 75... Line 76...
75
							final int taillemax = reponse.size();
76
							final int taillemax = reponse.size();
Line 76... Line 77...
76
							
77
							
Line 77... Line -...
77
							observationData = new ListeObservation(taillemax);
-
 
78
							
-
 
79
							for (int i = 0; i < taillemax; i++) {
-
 
80
								
-
 
81
								if ((observation=reponse.get(i).isArray()) != null) {								
-
 
82
									
-
 
83
									String transmis=((JSONString) observation.get(13)).stringValue();
-
 
84
									String identifiantLocalite=((JSONString) observation.get(14)).toString();
-
 
85
									String nomSaisi=Util.toCelString(((JSONString) observation.get(0)).toString());
-
 
86
									String nomRetenu=Util.toCelString(((JSONString) observation.get(2)).toString());
-
 
87
									String numeroNomenclaturalSaisi=((JSONString) observation.get(1)).stringValue();
-
 
88
									String numeroNomenclaturalRetenu=((JSONString) observation.get(3)).stringValue();
-
 
89
									String numeroTaxonomique=((JSONString) observation.get(4)).stringValue();
-
 
90
									String famille=Util.toCelString(((JSONString) observation .get(5)).toString());
78
							observationData = new ListeObservation(taillemax);
91
									String localite=Util.toCelString(((JSONString) observation .get(6)).toString());
-
 
92
									String lieudit=Util.toCelString(((JSONString) observation .get(9)).toString());
-
 
93
									String station=Util.toCelString(((JSONString) observation .get(10)).toString());
-
 
94
									String milieu=Util.toCelString(((JSONString) observation .get(11)).toString());
-
 
95
									String commentaire=Util.toCelString(((JSONString) observation .get(12)).toString());
79
							
96
									String date=((JSONString) observation .get(8)).stringValue();
80
							for (int i = 0; i < taillemax; i++) {
97
									String numeroOrdre=((JSONString) observation.get(7)).stringValue();
81
								
98
									
82
								if ((observation = reponse.get(i).isObject()) != null) {								
Line 120... Line 104...
120
			}
104
			}
121
	}
105
	}
Line 122... Line 106...
122
	
106
	
123
	public void obtenirLiaisonsObservationsImages(Rafraichissable r,String idObs, String utilisateur)
107
	public void obtenirLiaisonsObservationsImages(Rafraichissable r,String idObs, String utilisateur)
124
	{
108
	{
125
		String paramGet = "&id_observation="+idObs ;
109
		String paramGet = "id_observation="+idObs ;
Line 126... Line 110...
126
		raf = r ;
110
		raf = r ;
127
 
111
 
128
		// et on envoie ça au serveur
112
		// et on envoie ça au serveur
Line 153... Line 137...
153
							String imgTab[][] = new String[taillemax][3] ;
137
							String imgTab[][] = new String[taillemax][3] ;
Line 154... Line 138...
154
							
138
							
155
							for(int i = 0 ;i<taillemax ;i++)
139
							for(int i = 0 ;i<taillemax ;i++)
Line 156... Line 140...
156
							{
140
							{
157
								
141
								
158
								final JSONArray reponseInt = reponse.get(i).isArray();
142
								final JSONObject reponseInt = reponse.get(i).isObject();
159
								String idImg = ((JSONString)reponseInt.get(0)).stringValue() ;
143
								String idImg = ((JSONString)reponseInt.get("id_image")).stringValue() ;
160
								String X = ((JSONString)reponseInt.get(1)).stringValue() ;
144
								String X = ((JSONString)reponseInt.get("hauteur")).stringValue() ;
161
								String Y = ((JSONString)reponseInt.get(2)).stringValue() ;
145
								String Y = ((JSONString)reponseInt.get("largeur")).stringValue() ;
162
								imgTab[i][0] = idImg ;
146
								imgTab[i][0] = idImg ;
Line 163... Line 147...
163
								imgTab[i][1] = X ;
147
								imgTab[i][1] = X ;
Line 184... Line 168...
184
	
168
	
Line 185... Line 169...
185
	public void lierImageBaseDeDonnees(String idsImages, String idsObs) {
169
	public void lierImageBaseDeDonnees(String idsImages, String idsObs) {
Line 186... Line 170...
186
		
170
		
187
		String postData = "";
171
		String postData = "";
188
		
172
		
Line 189... Line 173...
189
		postData += "&id_image="+idsImages ;
173
		postData += "id_image="+idsImages ;
190
		postData += "&id_observation="+idsObs ;
174
		postData += "&id_observation="+idsObs ;
Line 238... Line 222...
238
	
222
	
239
					public void onResponseReceived(Request request,
223
					public void onResponseReceived(Request request,
Line 240... Line 224...
240
							Response response) {
224
							Response response) {
241
	
225
	
242
						// quand la requête est éxecutée on le signale au modèle
226
						// quand la requête est éxecutée on le signale au modèle
243
						// poru qu'il mette à jour les données
227
						// pour qu'il mette à jour les données
Line 244... Line 228...
244
						// et en notifie le médiateur
228
						// et en notifie le médiateur
245
						iModele.requeteTerminee();
229
						iModele.requeteTerminee();