Subversion Repositories eFlore/Applications.del

Rev

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

Rev 534 Rev 764
Line 7... Line 7...
7
import java.util.Map;
7
import java.util.Map;
Line 8... Line 8...
8
 
8
 
Line 9... Line 9...
9
import org.tela_botanica.del.client.utils.UtilitairesServiceResultat;
9
import org.tela_botanica.del.client.utils.UtilitairesServiceResultat;
-
 
10
 
10
 
11
import com.google.gwt.core.client.GWT;
11
import com.google.gwt.core.client.GWT;
12
import com.google.gwt.dev.js.rhino.ObjToIntMap.Iterator;
12
import com.google.gwt.i18n.client.DateTimeFormat;
13
import com.google.gwt.i18n.client.DateTimeFormat;
13
import com.google.gwt.json.client.JSONArray;
14
import com.google.gwt.json.client.JSONArray;
14
import com.google.gwt.json.client.JSONObject;
15
import com.google.gwt.json.client.JSONObject;
Line 20... Line 21...
20
	private List<Image> images;
21
	private List<Image> images;
Line 21... Line 22...
21
 
22
 
Line 22... Line 23...
22
	private int nbTotalImagesPourLaRecherche;
23
	private int nbTotalImagesPourLaRecherche;
23
 
24
 
24
	public ImageServiceResultat(JSONValue retourJson) {
25
	public ImageServiceResultat(JSONValue retourJson) {
25
 
26
	
26
		try {
27
		try {
27
			// TODO ajouter vérifications plus précises
28
			// TODO ajouter vérifications plus précises
Line 28... Line 29...
28
			double total = retourJson.isObject().get("total").isNumber().doubleValue();
29
			double total = retourJson.isObject().get("entete").isObject().get("total").isNumber().doubleValue();
29
			nbTotalImagesPourLaRecherche = (int) total;
30
			nbTotalImagesPourLaRecherche = (int) total;
-
 
31
 
-
 
32
			JSONObject tableauObs = retourJson.isObject().get("resultats").isObject();
Line 30... Line -...
30
 
-
 
31
			JSONArray tableauObs = retourJson.isObject().get("contenu").isArray();
33
			images = new ArrayList<Image>();
32
			images = new ArrayList<Image>();
-
 
33
 
34
			
34
			int nbResultats = tableauObs.size();
35
			java.util.Iterator<String> it = tableauObs.keySet().iterator();
35
			for (int i = 0; i < nbResultats; i++) {
36
 
36
 
37
			while (it.hasNext()) {
37
				JSONObject imageJson = tableauObs.get(i).isObject();
38
				JSONObject imageJson = tableauObs.get(it.next()).isObject();
38
				Image image = UtilitairesServiceResultat.parserImageJSON(imageJson);
39
				Image image = UtilitairesServiceResultat.parserImageJSON(imageJson);
39
 
40