2,34 → 2,13 |
|
import org.tela_botanica.del.client.modeles.ObservationServiceResultat; |
|
import com.google.gwt.http.client.Request; |
import com.google.gwt.http.client.RequestCallback; |
import com.google.gwt.http.client.Response; |
import com.google.gwt.json.client.JSONParser; |
import com.google.gwt.user.client.Window; |
|
public abstract class ObservationsCallback implements RequestCallback { |
public abstract class ObservationsCallback extends PHPCallback<ObservationServiceResultat> { |
|
public ObservationsCallback() { |
|
} |
|
@Override |
public void onResponseReceived(Request request, Response response) { |
ObservationServiceResultat observationsRecues = convertirReponseVersListeObservation(response); |
surObservationsRecues(observationsRecues); |
public ObservationServiceResultat parserJSON(String retourService) { |
return new ObservationServiceResultat(JSONParser.parseStrict(retourService)); |
} |
|
@Override |
public void onError(Request request, Throwable exception) { |
Window.alert(exception.getMessage()); |
} |
|
public abstract void surObservationsRecues(ObservationServiceResultat observationsRecues); |
|
private ObservationServiceResultat convertirReponseVersListeObservation(Response reponse) { |
ObservationServiceResultat resultat = new ObservationServiceResultat(JSONParser.parseStrict(reponse.getText())); |
return resultat; |
} |
|
} |