Subversion Repositories eFlore/Archives.cel-v2

Rev

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

Rev 5 Rev 12
Line 1... Line 1...
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
Line 2... Line 2...
2
 
2
 
Line 3... Line 3...
3
import org.tela_botanica.client.interfaces.Rafraichissable;
3
import org.tela_botanica.client.interfaces.Rafraichissable;
-
 
4
 
4
 
5
import com.google.gwt.json.client.JSONArray;
5
import com.google.gwt.json.client.JSONArray;
6
import com.google.gwt.json.client.JSONObject;
6
import com.google.gwt.json.client.JSONParser;
7
import com.google.gwt.json.client.JSONParser;
7
import com.google.gwt.json.client.JSONString;
8
import com.google.gwt.json.client.JSONString;
8
import com.google.gwt.json.client.JSONValue;
9
import com.google.gwt.json.client.JSONValue;
Line 13... Line 14...
13
import com.gwtext.client.data.MemoryProxy;
14
import com.gwtext.client.data.MemoryProxy;
14
import com.gwtext.client.data.RecordDef;
15
import com.gwtext.client.data.RecordDef;
15
import com.gwtext.client.data.Store;
16
import com.gwtext.client.data.Store;
16
import com.gwtext.client.data.StringFieldDef;
17
import com.gwtext.client.data.StringFieldDef;
Line -... Line 18...
-
 
18
 
-
 
19
/**
-
 
20
 * Data Object Access communiquant avec le serveur jrest fournissant la liste des images
-
 
21
 * répondant à des critères donné
-
 
22
 * @author aurelien
-
 
23
 *
17
 
24
 */
Line 18... Line 25...
18
public class ListeImageAsynchroneDAO {
25
public class ListeImageAsynchroneDAO {
19
	
26
	
20
	public void ObtenirListeImages(final Rafraichissable r)
27
	public void ObtenirListeImages(final Rafraichissable r)
21
	{
28
	{
Line 22... Line 29...
22
		HTTPRequest.asyncGet("getphotos.php", new ResponseTextHandler() {
29
		HTTPRequest.asyncGet("jrest/inventoryImageList/1/ci_publiable_eflore=0", new ResponseTextHandler() {
Line 23... Line 30...
23
			public void onCompletion(String responseText) {
30
			public void onCompletion(String responseText) {
24
				
31
				
Line 25... Line 32...
25
				final Object[][] photoData ;
32
				final ListeImage photoData ;
Line 26... Line 33...
26
 
33
 
27
				final JSONValue responseValue = JSONParser.parse(responseText);
34
				final JSONValue responseValue = JSONParser.parse(responseText);
-
 
35
				if (responseValue.isArray() != null) {
-
 
36
					
28
				if (responseValue.isArray() != null) {
37
					final JSONArray reponse = responseValue.isArray();
-
 
38
 
29
					
39
					final int taillemax = reponse.size();
30
					final JSONArray liste_noms = responseValue.isArray();
40
					photoData = new ListeImage(taillemax);
31
 
41
					
32
					final int taillemax = liste_noms.size();
-
 
-
 
42
					
33
					photoData = new Object[taillemax][2];
43
					for (int j = 0; j < taillemax ; j++) {
34
					for (int j = 0; j < liste_noms.size(); j++) {
44
						
35
						final JSONString debuturl = (JSONString) liste_noms
45
						JSONObject image = (JSONObject)reponse.get(j) ;
36
								.get(j);
46
						
-
 
47
						photoData.add(new ImageCarnet(image)) ;
-
 
48
						
-
 
49
					}
-
 
50
				}
-
 
51
				else
-
 
52
				{
-
 
53
					if(responseValue.isObject() != null)
37
						photoData[j] = new Object[]{"photo" + j,
54
					{
-
 
55
						photoData = new ListeImage(1);
38
								"images/" + debuturl.stringValue()};
56
						photoData.add(new ImageCarnet(responseValue.isObject())) ;
Line 39... Line 57...
39
					}
57
					}
40
				}
58
					else
41
				else
59
					{