14 |
benjamin |
1 |
package org.tela_botanica.del.client.vues.rechercheobservations;
|
9 |
benjamin |
2 |
|
|
|
3 |
import java.util.List;
|
|
|
4 |
|
|
|
5 |
import org.tela_botanica.del.client.modeles.Observation;
|
14 |
benjamin |
6 |
import org.tela_botanica.del.client.modeles.ObservationValidation;
|
9 |
benjamin |
7 |
import org.tela_botanica.del.client.utils.MockDatasource;
|
14 |
benjamin |
8 |
import org.tela_botanica.del.client.vues.rechercheobservations.vote.MoyenneVotePresenteur;
|
9 |
benjamin |
9 |
|
|
|
10 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
11 |
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
12 |
import com.google.gwt.user.client.ui.HasWidgets;
|
52 |
gduche |
13 |
import com.google.gwt.user.client.ui.Label;
|
|
|
14 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
9 |
benjamin |
15 |
|
14 |
benjamin |
16 |
public class ObservationPresenteur {
|
9 |
benjamin |
17 |
|
|
|
18 |
private final MockDatasource validationService = MockDatasource.getInstance();
|
32 |
gduche |
19 |
private ObservationVue vue = new ObservationVue();
|
9 |
benjamin |
20 |
private final Observation observation;
|
|
|
21 |
private boolean detailsOpen = false;
|
|
|
22 |
|
14 |
benjamin |
23 |
public ObservationPresenteur(Observation observation) {
|
9 |
benjamin |
24 |
this.observation = observation;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
public void go(HasWidgets composite) {
|
32 |
gduche |
28 |
composite.add(vue);
|
|
|
29 |
vue.loadImage(observation);
|
63 |
gduche |
30 |
loadValidationData();
|
52 |
gduche |
31 |
handleEvents();
|
9 |
benjamin |
32 |
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
private void loadValidationData() {
|
|
|
36 |
|
32 |
gduche |
37 |
List<ObservationValidation> observationValidationDatas = validationService.getValidationData(observation.getIdImage());
|
9 |
benjamin |
38 |
observation.setImageCelValidationDatas(observationValidationDatas);
|
63 |
gduche |
39 |
new MoyenneVotePresenteur(observationValidationDatas).go(vue.getVoter());
|
32 |
gduche |
40 |
vue.showValidationData(observationValidationDatas);
|
9 |
benjamin |
41 |
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
private void handleEvents() {
|
|
|
45 |
|
52 |
gduche |
46 |
vue.getEnSavoirPlus().addClickHandler(new ClickHandler() {
|
|
|
47 |
|
9 |
benjamin |
48 |
@Override
|
|
|
49 |
public void onClick(ClickEvent event) {
|
63 |
gduche |
50 |
// FIXME : Cacher les précédentes fenêtres affichées
|
52 |
gduche |
51 |
VerticalPanel zoneCache = vue.getZoneCache();
|
|
|
52 |
Label enSavoirPlus = vue.getEnSavoirPlus();
|
|
|
53 |
zoneCache.setVisible(!zoneCache.isVisible());
|
9 |
benjamin |
54 |
|
52 |
gduche |
55 |
if (!zoneCache.isVisible()) {
|
|
|
56 |
enSavoirPlus.setStyleName("boutonPlus");
|
9 |
benjamin |
57 |
} else {
|
52 |
gduche |
58 |
enSavoirPlus.setStyleName("boutonMoins");
|
9 |
benjamin |
59 |
}
|
|
|
60 |
}
|
|
|
61 |
});
|
|
|
62 |
}
|
|
|
63 |
}
|