Rev 12 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.client.modeles;
import org.tela_botanica.client.interfaces.Rafraichissable;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.HTTPRequest;
import com.google.gwt.user.client.ResponseTextHandler;
import com.gwtext.client.data.ArrayReader;
import com.gwtext.client.data.FieldDef;
import com.gwtext.client.data.MemoryProxy;
import com.gwtext.client.data.RecordDef;
import com.gwtext.client.data.Store;
import com.gwtext.client.data.StringFieldDef;
public class ListeImageAsynchroneDAO {
public void ObtenirListeImages(final Rafraichissable r)
{
HTTPRequest.asyncGet("getphotos.php", new ResponseTextHandler() {
public void onCompletion(String responseText) {
final Object[][] photoData ;
final JSONValue responseValue = JSONParser.parse(responseText);
if (responseValue.isArray() != null) {
final JSONArray liste_noms = responseValue.isArray();
final int taillemax = liste_noms.size();
photoData = new Object[taillemax][2];
for (int j = 0; j < liste_noms.size(); j++) {
final JSONString debuturl = (JSONString) liste_noms
.get(j);
photoData[j] = new Object[]{"photo" + j,
"images/" + debuturl.stringValue()};
}
}
else
{
photoData = null ;
}
r.rafraichir(photoData);
}
});
}
}