Subversion Repositories eFlore/Archives.cel-v2

Rev

Rev 12 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 aperonnet 1
package org.tela_botanica.client.modeles;
2
 
3
import org.tela_botanica.client.interfaces.Rafraichissable;
4
 
5
import com.google.gwt.json.client.JSONArray;
6
import com.google.gwt.json.client.JSONParser;
7
import com.google.gwt.json.client.JSONString;
8
import com.google.gwt.json.client.JSONValue;
9
import com.google.gwt.user.client.HTTPRequest;
10
import com.google.gwt.user.client.ResponseTextHandler;
11
import com.gwtext.client.data.ArrayReader;
12
import com.gwtext.client.data.FieldDef;
13
import com.gwtext.client.data.MemoryProxy;
14
import com.gwtext.client.data.RecordDef;
15
import com.gwtext.client.data.Store;
16
import com.gwtext.client.data.StringFieldDef;
17
 
18
public class ListeImageAsynchroneDAO {
19
 
20
	public void ObtenirListeImages(final Rafraichissable r)
21
	{
22
		HTTPRequest.asyncGet("getphotos.php", new ResponseTextHandler() {
23
			public void onCompletion(String responseText) {
24
 
25
				final Object[][] photoData ;
26
 
27
				final JSONValue responseValue = JSONParser.parse(responseText);
28
				if (responseValue.isArray() != null) {
29
 
30
					final JSONArray liste_noms = responseValue.isArray();
31
 
32
					final int taillemax = liste_noms.size();
33
					photoData = new Object[taillemax][2];
34
					for (int j = 0; j < liste_noms.size(); j++) {
35
						final JSONString debuturl = (JSONString) liste_noms
36
								.get(j);
37
						photoData[j] = new Object[]{"photo" + j,
38
								"images/" + debuturl.stringValue()};
39
					}
40
				}
41
				else
42
				{
43
					photoData = null ;
44
				}
45
 
46
				r.rafraichir(photoData);
47
			}
48
		});
49
	}
50
 
51
}