Subversion Repositories eFlore/Applications.del

Rev

Rev 359 | Rev 386 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.del.client.services.rest.async;

import org.tela_botanica.del.client.modeles.ImageServiceResultat;

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 ImagesParTaxonCallback implements RequestCallback {

        public ImagesParTaxonCallback() {

        }

        @Override
        public void onResponseReceived(Request request, Response response) {
                ImageServiceResultat imagesRecues = convertirReponseVersListeImage(response);
                surImagesRecues(imagesRecues);
        }

        @Override
        public void onError(Request request, Throwable exception) {
                Window.alert(exception.getMessage());
        }

        public abstract void surImagesRecues(ImageServiceResultat imagesRecues);

        private ImageServiceResultat convertirReponseVersListeImage(Response reponse) {
                //Window.alert(reponse.getText());
                ImageServiceResultat resultat = new ImageServiceResultat(JSONParser.parseStrict(reponse.getText()));
                return resultat;
        }

}