5,6 → 5,7 |
import org.tela_botanica.client.interfaces.Rafraichissable; |
|
import com.extjs.gxt.ui.client.Registry; |
import com.google.gwt.core.client.GWT; |
import com.google.gwt.http.client.Request; |
import com.google.gwt.http.client.RequestBuilder; |
import com.google.gwt.http.client.RequestCallback; |
11,6 → 12,7 |
import com.google.gwt.http.client.RequestException; |
import com.google.gwt.http.client.Response; |
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.JSONValue; |
import com.google.gwt.user.client.Window; |
44,8 → 46,8 |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
|
// Si la requête est un succès, reception d'un tableau |
if (responseValue.isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
if (responseValue.isObject() != null) { |
final JSONObject reponse = responseValue.isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
publications = new PublicationListe(reponse); |
// et on met à jour le demandeur des données |
85,7 → 87,7 |
|
// Si la requête est un succès, reception d'un tableau |
if (responseValue.isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
final JSONObject reponse = responseValue.isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
publications = new PublicationListe(reponse); |
// et on met à jour le demandeur des données |
124,8 → 126,8 |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
|
// Si la requête est un succès, reception d'un tableau |
if (responseValue.isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
if (responseValue.isObject() != null) { |
final JSONObject reponse = responseValue.isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
publications = new PublicationListe(reponse); |
// et on met à jour le demandeur des données |
146,4 → 148,46 |
|
} |
|
public void supprimerPublication(Modele modele, String utilisateurId, |
String idPubs) { |
String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl(); |
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url+"CoelPublicationListe/"+utilisateurId+"/"+idPubs); |
|
try { |
rb.sendRequest("action=DELETE", new RequestCallback() { |
|
public void onError(Request request, Throwable exception) { |
|
GWT.log("Erreur dans la requête de suppression", exception); |
|
} |
|
public void onResponseReceived(Request request, Response response) { |
Boolean defaut = true; |
if (response.getText().length() != 0 && response.getText() != null) { |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
|
// Si la requête est un succès, reception d'un tableau |
if (responseValue.isObject() != null) { |
final JSONObject reponse = responseValue.isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
publications = new PublicationListe(reponse); |
// et on met à jour le demandeur des données |
rafraichissement.rafraichir(publications); |
// Tout c'est bien déroulé, on courcircuite l'affichage par défaut |
defaut = false; |
} |
} |
if (defaut == true) { |
publications = new PublicationListe(0); |
rafraichissement.rafraichir(publications); |
} |
} |
}); |
} catch (RequestException e) { |
e.printStackTrace(); |
} |
|
} |
|
} |