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