Subversion Repositories eFlore/Applications.del

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
342 aurelien 1
package org.tela_botanica.del.client.services.rest.async;
2
 
3
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
4
 
5
import com.google.gwt.http.client.Request;
6
import com.google.gwt.http.client.RequestCallback;
7
import com.google.gwt.http.client.Response;
8
import com.google.gwt.json.client.JSONParser;
359 benjamin 9
import com.google.gwt.user.client.Window;
342 aurelien 10
 
359 benjamin 11
public abstract class ImagesParTaxonCallback implements RequestCallback {
342 aurelien 12
 
13
	public ImagesParTaxonCallback() {
359 benjamin 14
 
342 aurelien 15
	}
359 benjamin 16
 
342 aurelien 17
	@Override
18
	public void onResponseReceived(Request request, Response response) {
19
		ImageServiceResultat imagesRecues = convertirReponseVersListeImage(response);
20
		surImagesRecues(imagesRecues);
21
	}
359 benjamin 22
 
342 aurelien 23
	@Override
24
	public void onError(Request request, Throwable exception) {
359 benjamin 25
		Window.alert(exception.getMessage());
342 aurelien 26
	}
27
 
28
	public abstract void surImagesRecues(ImageServiceResultat imagesRecues);
29
 
30
	private ImageServiceResultat convertirReponseVersListeImage(Response reponse) {
31
		ImageServiceResultat resultat = new ImageServiceResultat(JSONParser.parseStrict(reponse.getText()));
32
		return resultat;
33
	}
34
 
35
}