/trunk/src/org/tela_botanica/client/modeles/ListeReferentielNomAsynchroneDAO.java |
---|
5,6 → 5,11 |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.observation.ObservationModele; |
import com.google.gwt.http.client.Request; |
import com.google.gwt.http.client.RequestBuilder; |
import com.google.gwt.http.client.RequestCallback; |
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.JSONParser; |
import com.google.gwt.json.client.JSONString; |
44,18 → 49,23 |
public void obtenirListeDonnees(final Rafraichissable r, String critere) |
{ |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, observationModele.getConfig().getServiceBaseUrl()+"/NameSearch/"+critere) ; |
// on envoie le get asynchrone |
HTTPRequest.asyncGet(observationModele.getConfig().getServiceBaseUrl()+"/NameSearch/"+critere, new ResponseTextHandler() { |
try { |
rb.sendRequest(null, new RequestCallback() { |
// si tout se passe bien on reçoit une réponse JSON |
public void onCompletion(String responseText) { |
public void onError(Request request, Throwable exception) { |
// TODO Auto-generated method stub |
} |
public void onResponseReceived(Request request, |
Response response) { |
final ListeReferentielNom referentielNomData ; |
final JSONValue responseValue = JSONParser.parse(responseText); |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
JSONArray reponse=null; |
86,16 → 96,24 |
} |
} |
} else { |
referentielNomData = new ListeReferentielNom(0) ; |
} |
// dans tous les cas on transmet la liste crée au rafraichissable en lui demandant de répandre les données car il est |
// le premier à les recevoir |
r.rafraichir(referentielNomData,true); |
} |
} |
}); |
} catch(RequestException e) { |
} |
} |
} |
/trunk/src/org/tela_botanica/client/modeles/ListeReferentielCommuneAsynchroneDAO.java |
---|
5,6 → 5,11 |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.observation.ObservationModele; |
import com.google.gwt.http.client.Request; |
import com.google.gwt.http.client.RequestBuilder; |
import com.google.gwt.http.client.RequestCallback; |
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.JSONParser; |
import com.google.gwt.json.client.JSONString; |
45,18 → 50,23 |
public void obtenirListeDonnees(final Rafraichissable r, String critere) |
{ |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,observationModele.getConfig().getServiceBaseUrl()+"/LocationSearch/"+critere) ; |
// on envoie le get asynchrone |
HTTPRequest.asyncGet(observationModele.getConfig().getServiceBaseUrl()+"/LocationSearch/"+critere, new ResponseTextHandler() { |
try { |
rb.sendRequest(null, new RequestCallback() { |
// si tout se passe bien on reçoit une réponse JSON |
public void onCompletion(String responseText) { |
public void onError(Request request, Throwable exception) { |
// TODO Auto-generated method stub |
} |
public void onResponseReceived(Request request, |
Response response) { |
final ListeReferentielCommune referentielCommuneData ; |
final JSONValue responseValue = JSONParser.parse(responseText); |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
JSONArray reponse=null; |
80,20 → 90,38 |
referentielCommuneData.put(com.getCommune()+com.getDepartement(),com); |
} |
} |
} else { |
referentielCommuneData = new ListeReferentielCommune(0) ; |
} |
// dans tous les cas on transmet la liste crée au rafraichissable en lui demandant de répandre les données car il est |
// le premier à les recevoir |
r.rafraichir(referentielCommuneData,true); |
r.rafraichir(referentielCommuneData,true); |
} |
}) ; |
} catch (RequestException e) { |
e.printStackTrace() ; |
} |
// on envoie le get asynchrone |
HTTPRequest.asyncGet(observationModele.getConfig().getServiceBaseUrl()+"/LocationSearch/"+critere, new ResponseTextHandler() { |
// si tout se passe bien on reçoit une réponse JSON |
public void onCompletion(String responseText) { |
} |
}); |
} |
} |
/trunk/src/org/tela_botanica/client/modeles/ObservationAsynchroneDAO.java |
---|
54,20 → 54,35 |
// private void addElement(String nom_sel, String num_nom_sel, String nom_ret, |
// String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String lieu, String sta, String mil, String comment) { |
HTTPRequest.asyncPost(oModele.getConfig().getServiceBaseUrl()+ "/Inventory/", "identifiant=" |
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,oModele.getConfig().getServiceBaseUrl()+ "/Inventory/") ; |
String postData = "identifiant=" |
+ utilisateur + "&nom_sel=" + URL.encodeComponent(obs.getNomSaisi()) + "&num_nom_sel=" + obs.getNumeroNomenclaturalSaisi() |
+ "&nom_ret=" + URL.encodeComponent(obs.getNomRetenu()) + "&num_nom_ret=" + obs.getNumeroNomenclaturalRetenu() |
+ "&num_taxon=" + obs.getNumeroTaxonomique() + "&famille=" + URL.encodeComponent(obs.getFamille()) + "&location=" + URL.encodeComponent(obs.getLocalite()) + "&id_location=" + obs.getIdentifiantLocalite() + "&date_observation=" + obs.getDate() |
+ "&lieudit="+ URL.encodeComponent(obs.getLieudit()) + "&station="+ URL.encodeComponent(obs.getLieudit()) +"&milieu="+ URL.encodeComponent(obs.getMilieu()) + "&commentaire="+ URL.encodeComponent(obs.getCommentaire()), |
+ "&lieudit="+ URL.encodeComponent(obs.getLieudit()) + "&station="+ URL.encodeComponent(obs.getLieudit()) +"&milieu="+ URL.encodeComponent(obs.getMilieu()) + "&commentaire="+ URL.encodeComponent(obs.getCommentaire()) ; |
new ResponseTextHandler() { |
try { |
public void onCompletion(String str) { |
rb.sendRequest(postData, new RequestCallback() { |
public void onError(Request request, Throwable exception) { |
// TODO Auto-generated method stub |
} |
public void onResponseReceived(Request request, |
Response response) { |
r.rafraichir(obs,true); |
} |
}); |
} catch (RequestException e) { |
} |
} |
} |
/trunk/src/org/tela_botanica/client/modeles/ListeObservationAsynchroneDAO.java |
---|
4,6 → 4,11 |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.observation.ObservationModele; |
import com.google.gwt.http.client.Request; |
import com.google.gwt.http.client.RequestBuilder; |
import com.google.gwt.http.client.RequestCallback; |
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.JSONParser; |
import com.google.gwt.json.client.JSONString; |
64,17 → 69,23 |
} |
} |
// on envoie le get asynchrone |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,observationModele.getConfig().getServiceBaseUrl() |
+"/InventoryObservationList/"+utilisateur+"/"+requete) ; |
try { |
rb.sendRequest(null, new RequestCallback() { |
// on envoie le get asynchrone |
HTTPRequest.asyncGet(observationModele.getConfig().getServiceBaseUrl()+"/InventoryObservationList/"+utilisateur+"/"+requete, new ResponseTextHandler() { |
public void onError(Request request, Throwable exception) { |
// TODO Auto-generated method stub |
} |
// si tout se passe bien on reçoit une réponse JSON |
public void onCompletion(String responseText) { |
public void onResponseReceived(Request request, |
Response response) { |
final ListeObservation observationData ; |
final JSONValue responseValue = JSONParser.parse(responseText); |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
JSONArray reponse=null; |
90,9 → 101,6 |
if ((observation=reponse.get(i).isArray()) != null) { |
String transmis=((JSONString) observation.get(13)).stringValue(); |
String identifiantLocalite=((JSONString) observation.get(14)).toString(); |
String nomSaisi=Util.toCelString(((JSONString) observation.get(0)).toString()); |
115,13 → 123,21 |
} |
} |
} else { |
observationData = new ListeObservation(0) ; |
} |
// dans tous les cas on transmet la liste crée au rafraichissable en lui demandant de répandre les données car il est |
// le premier à les recevoir |
r.rafraichir(observationData,true); |
} |
} |
}); |
} catch (RequestException e) { |
// TODO Auto-generated catch block |
e.printStackTrace(); |
} |
} |
} |
/trunk/src/org/tela_botanica/client/modeles/NombreObservationAsynchroneDAO.java |
---|
3,6 → 3,11 |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.observation.ObservationModele; |
import com.google.gwt.http.client.Request; |
import com.google.gwt.http.client.RequestBuilder; |
import com.google.gwt.http.client.RequestCallback; |
import com.google.gwt.http.client.RequestException; |
import com.google.gwt.http.client.Response; |
import com.google.gwt.json.client.JSONParser; |
import com.google.gwt.json.client.JSONString; |
import com.google.gwt.json.client.JSONValue; |
55,14 → 60,23 |
} |
} |
// on fait un get asynchrone |
HTTPRequest.asyncGet(observationModele.getConfig().getServiceBaseUrl()+"/InventoryObservationCount/"+utilisateur+"/"+requete, new ResponseTextHandler() { |
public void onCompletion(String responseText) { |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,observationModele.getConfig().getServiceBaseUrl()+"/InventoryObservationCount/"+utilisateur+"/"+requete) ; |
try { |
final JSONValue responseValue = JSONParser.parse(responseText); |
rb.sendRequest(null, new RequestCallback() { |
public void onError(Request request, Throwable exception) { |
// TODO Auto-generated method stub |
} |
public void onResponseReceived(Request request, |
Response response) { |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
// si la requete se passe bien on reçoit un tableau JSON |
if(responseValue.isArray() != null) |
{ |
73,11 → 87,20 |
int[] nbObservations = {maxObservations} ; |
// on le met dans un tableau d'entiers qu'on tranmset au demandeur de la mise à jour |
r.rafraichir(nbObservations, true) ; |
} |
} else { |
int[] nbObservations = {} ; |
r.rafraichir(nbObservations, true) ; |
} |
} |
}) ; |
} catch (RequestException e) { |
} |
} |
} |