3,6 → 3,7 |
import org.tela_botanica.client.interfaces.Rafraichissable; |
|
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONObject; |
import com.google.gwt.json.client.JSONParser; |
import com.google.gwt.json.client.JSONString; |
import com.google.gwt.json.client.JSONValue; |
15,32 → 16,49 |
import com.gwtext.client.data.Store; |
import com.gwtext.client.data.StringFieldDef; |
|
/** |
* Data Object Access communiquant avec le serveur jrest fournissant la liste des images |
* répondant à des critères donné |
* @author aurelien |
* |
*/ |
public class ListeImageAsynchroneDAO { |
|
public void ObtenirListeImages(final Rafraichissable r) |
{ |
HTTPRequest.asyncGet("getphotos.php", new ResponseTextHandler() { |
HTTPRequest.asyncGet("jrest/inventoryImageList/1/ci_publiable_eflore=0", new ResponseTextHandler() { |
public void onCompletion(String responseText) { |
|
final Object[][] photoData ; |
final ListeImage photoData ; |
|
final JSONValue responseValue = JSONParser.parse(responseText); |
if (responseValue.isArray() != null) { |
|
final JSONArray liste_noms = responseValue.isArray(); |
final JSONArray reponse = 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()}; |
final int taillemax = reponse.size(); |
photoData = new ListeImage(taillemax); |
|
|
for (int j = 0; j < taillemax ; j++) { |
|
JSONObject image = (JSONObject)reponse.get(j) ; |
|
photoData.add(new ImageCarnet(image)) ; |
|
} |
} |
else |
{ |
photoData = null ; |
if(responseValue.isObject() != null) |
{ |
photoData = new ListeImage(1); |
photoData.add(new ImageCarnet(responseValue.isObject())) ; |
} |
else |
{ |
photoData = null ; |
} |
} |
|
r.rafraichir(photoData); |