50 |
benjamin |
1 |
package org.tela_botanica.del.client.vues.comparaisoneflore;
|
|
|
2 |
|
|
|
3 |
import java.util.List;
|
|
|
4 |
|
|
|
5 |
import org.tela_botanica.del.client.modeles.Observation;
|
|
|
6 |
import org.tela_botanica.del.client.utils.MockDatasource;
|
|
|
7 |
|
|
|
8 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
9 |
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
10 |
import com.google.gwt.user.client.ui.HasWidgets;
|
|
|
11 |
|
|
|
12 |
public class ComparaisonEflorePresenteur {
|
|
|
13 |
|
|
|
14 |
private ComparaisonEfloreVue vue = new ComparaisonEfloreVue();
|
|
|
15 |
|
|
|
16 |
private final MockDatasource observationService = MockDatasource.getInstance();
|
|
|
17 |
|
|
|
18 |
private Observation observationPrincipale;
|
|
|
19 |
|
|
|
20 |
private String nomTaxonComparaison;
|
|
|
21 |
|
|
|
22 |
private List<Observation> observationsEflore ;
|
|
|
23 |
|
|
|
24 |
public ComparaisonEflorePresenteur(Observation observationPrincipale, String nomTaxonComparaison) {
|
|
|
25 |
this.observationPrincipale = observationPrincipale;
|
|
|
26 |
this.nomTaxonComparaison = nomTaxonComparaison;
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
public void go(HasWidgets composite) {
|
|
|
30 |
composite.add(vue);
|
|
|
31 |
vue.chargerImagePrincipale(observationPrincipale);
|
|
|
32 |
chargerObservationsEflore();
|
|
|
33 |
gererEvenements();
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
private void chargerObservationsEflore() {
|
|
|
37 |
observationsEflore = observationService.getObservationsEfloreParTaxon(nomTaxonComparaison);
|
|
|
38 |
vue.chargerImagesEflore(observationsEflore, 0);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
private void gererEvenements() {
|
|
|
42 |
vue.getScrollLeftImage().addClickHandler(new ClickHandler() {
|
|
|
43 |
|
|
|
44 |
@Override
|
|
|
45 |
public void onClick(ClickEvent event) {
|
|
|
46 |
vue.chargerImagesEflore(observationsEflore, vue.getCurrentIndexImages()-1);
|
|
|
47 |
}
|
|
|
48 |
});
|
|
|
49 |
|
|
|
50 |
vue.getScrollRightImage().addClickHandler(new ClickHandler() {
|
|
|
51 |
|
|
|
52 |
@Override
|
|
|
53 |
public void onClick(ClickEvent event) {
|
|
|
54 |
vue.chargerImagesEflore(observationsEflore, vue.getCurrentIndexImages()+1);
|
|
|
55 |
}
|
|
|
56 |
});
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
}
|