Subversion Repositories eFlore/Applications.del

Rev

Rev 237 | Rev 352 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 237 Rev 284
Line 3... Line 3...
3
import java.util.List;
3
import java.util.List;
Line 4... Line 4...
4
 
4
 
5
import org.tela_botanica.del.client.cache.CacheClient;
5
import org.tela_botanica.del.client.cache.CacheClient;
6
import org.tela_botanica.del.client.modeles.Image;
6
import org.tela_botanica.del.client.modeles.Image;
-
 
7
import org.tela_botanica.del.client.modeles.VoteProtocole;
-
 
8
import org.tela_botanica.del.client.services.rest.ImageService;
7
import org.tela_botanica.del.client.modeles.VoteProtocole;
9
import org.tela_botanica.del.client.services.rest.VoteProtocoleService;
Line 8... Line 10...
8
import org.tela_botanica.del.client.utils.MockDatasource;
10
import org.tela_botanica.del.client.utils.MockDatasource;
9
 
11
 
-
 
12
import com.google.gwt.event.dom.client.ClickEvent;
10
import com.google.gwt.event.dom.client.ClickEvent;
13
import com.google.gwt.event.dom.client.ClickHandler;
-
 
14
import com.google.gwt.event.dom.client.HasClickHandlers;
Line 11... Line 15...
11
import com.google.gwt.event.dom.client.ClickHandler;
15
import com.google.gwt.user.client.ui.HasWidgets;
Line -... Line 16...
-
 
16
import com.google.gwt.user.client.ui.IsWidget;
-
 
17
 
-
 
18
public class ComparaisonEflorePresenteur {
-
 
19
 
-
 
20
	public interface Vue extends IsWidget {
12
import com.google.gwt.user.client.ui.HasWidgets;
21
		public void chargerImagePrincipale(org.tela_botanica.del.client.modeles.Image image);
-
 
22
 
-
 
23
		public void chargerImagesEflore(List<org.tela_botanica.del.client.modeles.Image> observationsEflore, int indexImage);
-
 
24
 
-
 
25
		public HasClickHandlers getScrollLeftImage();
-
 
26
 
-
 
27
		public HasClickHandlers getScrollRightImage();
-
 
28
 
13
 
29
		public int getCurrentIndexImages();
14
public class ComparaisonEflorePresenteur {
30
	}
-
 
31
 
15
 
32
	private Vue vue;
16
	private ComparaisonEfloreVue vue = new ComparaisonEfloreVue();
33
	private final VoteProtocoleService validationService = MockDatasource.getInstance();
17
	private final MockDatasource observationService = MockDatasource.getInstance();
34
	private final ImageService imageService = MockDatasource.getInstance();
Line 18... Line 35...
18
	private final MockDatasource validationService = MockDatasource.getInstance();
35
 
-
 
36
	private Image imagePrincipale;
19
	private Image imagePrincipale;
37
	private String nomTaxonComparaison;
20
	private String nomTaxonComparaison;
38
	private List<org.tela_botanica.del.client.modeles.Image> imagesEflore;
21
	private List<org.tela_botanica.del.client.modeles.Image> imagesEflore;
39
 
Line 22... Line 40...
22
 
40
	public ComparaisonEflorePresenteur(Vue vue) {
23
	public ComparaisonEflorePresenteur() {
41
		this.vue = vue;
24
		this.imagePrincipale = CacheClient.getInstance().getImageCourante();
42
		this.imagePrincipale = CacheClient.getInstance().getImageCourante();
25
		this.nomTaxonComparaison = CacheClient.getInstance().getTaxonPourRechercheEflore();
43
		this.nomTaxonComparaison = CacheClient.getInstance().getTaxonPourRechercheEflore();
26
	}
44
	}
27
 
45
 
28
	public void go(HasWidgets composite) {
46
	public void go(HasWidgets composite) {
Line 29... Line 47...
29
		composite.add(vue);
47
		composite.add(vue.asWidget());
30
		chargerValidationObservationPrincipale();
48
		chargerValidationObservationPrincipale();
31
		vue.chargerImagePrincipale(imagePrincipale);
49
		vue.chargerImagePrincipale(imagePrincipale);
32
		chargerObservationsEflore();
50
		chargerObservationsEflore();
Line 33... Line 51...
33
		gererEvenements();
51
		gererEvenements();
34
	}
52
	}
35
 
53
 
36
	private void chargerValidationObservationPrincipale() {
54
	public void chargerValidationObservationPrincipale() {
Line 37... Line 55...
37
		List<VoteProtocole> observationValidations = validationService.getVote(imagePrincipale.getIdImage());
55
		List<VoteProtocole> observationValidations = validationService.getVote(imagePrincipale.getIdImage());
38
		imagePrincipale.setVoteProtocoles(observationValidations);
56
		imagePrincipale.setVoteProtocoles(observationValidations);
Line 39... Line 57...
39
	}
57
	}
40
 
58
 
41
	private void chargerObservationsEflore() {
59
	public void chargerObservationsEflore() {
42
		imagesEflore = observationService.getImagesEfloreParTaxon(nomTaxonComparaison);
60
		imagesEflore = imageService.getImagesEfloreParTaxon(nomTaxonComparaison);
43
		vue.chargerImagesEflore(imagesEflore, 0);
61
		vue.chargerImagesEflore(imagesEflore, 0);
Line 44... Line 62...
44
	}
62
	}
Line 45... Line 63...
45
 
63
 
46
	private void gererEvenements() {
64
	private void gererEvenements() {
47
		vue.scrollLeftImage.addClickHandler(new ClickHandler() {
65
		vue.getScrollLeftImage().addClickHandler(new ClickHandler() {
48
 
66
 
49
			@Override
67
			@Override
50
			public void onClick(ClickEvent event) {
68
			public void onClick(ClickEvent event) {
Line -... Line 69...
-
 
69
				vue.chargerImagesEflore(imagesEflore, vue.getCurrentIndexImages() - 1);
-
 
70
			}
-
 
71
		});
-
 
72
 
51
				vue.chargerImagesEflore(imagesEflore, vue.getCurrentIndexImages() - 1);
73
		vue.getScrollRightImage().addClickHandler(new ClickHandler() {