15 |
benjamin |
1 |
package org.tela_botanica.del.client.navigation.evenement;
|
9 |
benjamin |
2 |
|
14 |
benjamin |
3 |
import org.tela_botanica.del.client.cache.CacheClient;
|
22 |
aurelien |
4 |
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
|
332 |
gduche |
5 |
import org.tela_botanica.del.client.modeles.Observation;
|
73 |
benjamin |
6 |
import org.tela_botanica.del.client.navigation.evenement.comparaisoneflore.EvenementComparaisonEflore;
|
|
|
7 |
import org.tela_botanica.del.client.navigation.evenement.comparaisoneflore.GestionnaireEvenementComparaisonEflore;
|
359 |
benjamin |
8 |
import org.tela_botanica.del.client.navigation.evenement.detailsimage.EvenementRechercheImage;
|
|
|
9 |
import org.tela_botanica.del.client.navigation.evenement.detailsimage.GestionnaireEvenementRechercheImage;
|
335 |
benjamin |
10 |
import org.tela_botanica.del.client.navigation.evenement.rechercheobservation.EvenementRechercheObservation;
|
|
|
11 |
import org.tela_botanica.del.client.navigation.evenement.rechercheobservation.GestionnaireEvenementRechercheObservation;
|
15 |
benjamin |
12 |
import org.tela_botanica.del.client.navigation.evenement.validationobservation.EvenementValidation;
|
|
|
13 |
import org.tela_botanica.del.client.navigation.evenement.validationobservation.GestionnaireEvenementValidation;
|
9 |
benjamin |
14 |
|
|
|
15 |
import com.google.gwt.event.shared.HandlerManager;
|
|
|
16 |
import com.google.gwt.user.client.History;
|
|
|
17 |
|
14 |
benjamin |
18 |
public class BusEvenementiel extends HandlerManager {
|
9 |
benjamin |
19 |
|
14 |
benjamin |
20 |
private static BusEvenementiel instance;
|
1129 |
gduche |
21 |
private CacheClient cache;
|
|
|
22 |
|
14 |
benjamin |
23 |
private BusEvenementiel() {
|
9 |
benjamin |
24 |
super(null);
|
|
|
25 |
instance = this;
|
233 |
gduche |
26 |
creerHandler();
|
1129 |
gduche |
27 |
this.cache = CacheClient.getInstance();
|
9 |
benjamin |
28 |
}
|
|
|
29 |
|
14 |
benjamin |
30 |
public static BusEvenementiel getInstance() {
|
9 |
benjamin |
31 |
if (instance == null) {
|
14 |
benjamin |
32 |
instance = new BusEvenementiel();
|
9 |
benjamin |
33 |
}
|
|
|
34 |
return instance;
|
|
|
35 |
}
|
|
|
36 |
|
233 |
gduche |
37 |
private void creerHandler() {
|
14 |
benjamin |
38 |
addHandler(EvenementValidation.TYPE, new GestionnaireEvenementValidation() {
|
9 |
benjamin |
39 |
|
|
|
40 |
@Override
|
332 |
gduche |
41 |
public void onValidationObservation(EvenementValidation event) {
|
|
|
42 |
doValidationObservation(event.getObservation());
|
1129 |
gduche |
43 |
cache.setPageCourante(ConstantesNavigation.PAGE_VALIDATION);
|
73 |
benjamin |
44 |
}
|
|
|
45 |
});
|
9 |
benjamin |
46 |
|
73 |
benjamin |
47 |
addHandler(EvenementComparaisonEflore.TYPE, new GestionnaireEvenementComparaisonEflore() {
|
|
|
48 |
|
|
|
49 |
@Override
|
|
|
50 |
public void onComparaisonEflore(EvenementComparaisonEflore event) {
|
|
|
51 |
doComparaisonAvecEflore(event.getTaxonDemande());
|
1129 |
gduche |
52 |
cache.setPageCourante(ConstantesNavigation.PAGE_COMPARAISON_EFLORE);
|
9 |
benjamin |
53 |
}
|
|
|
54 |
});
|
147 |
benjamin |
55 |
|
|
|
56 |
addHandler(EvenementRechercheImage.TYPE, new GestionnaireEvenementRechercheImage() {
|
360 |
benjamin |
57 |
|
147 |
benjamin |
58 |
@Override
|
|
|
59 |
public void onRechercheImage(EvenementRechercheImage event) {
|
311 |
gduche |
60 |
doRechercheImage();
|
1129 |
gduche |
61 |
cache.setPageCourante(ConstantesNavigation.PAGE_RECHERCHE_IMAGES);
|
147 |
benjamin |
62 |
}
|
|
|
63 |
});
|
178 |
benjamin |
64 |
|
335 |
benjamin |
65 |
addHandler(EvenementRechercheObservation.TYPE, new GestionnaireEvenementRechercheObservation() {
|
|
|
66 |
|
|
|
67 |
@Override
|
|
|
68 |
public void onRechercheObservation(EvenementRechercheObservation event) {
|
|
|
69 |
doRechercheObservation();
|
1129 |
gduche |
70 |
cache.setPageCourante(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS);
|
335 |
benjamin |
71 |
}
|
|
|
72 |
});
|
|
|
73 |
|
9 |
benjamin |
74 |
}
|
|
|
75 |
|
332 |
gduche |
76 |
private void doValidationObservation(Observation observation) {
|
|
|
77 |
CacheClient.getInstance().setObservationCourante(observation);
|
1035 |
benjamin |
78 |
History.newItem(ConstantesNavigation.PAGE_VALIDATION + "~" + observation.getId(), true);
|
9 |
benjamin |
79 |
}
|
|
|
80 |
|
73 |
benjamin |
81 |
private void doComparaisonAvecEflore(String taxon) {
|
|
|
82 |
History.newItem(ConstantesNavigation.PAGE_COMPARAISON_EFLORE, true);
|
|
|
83 |
}
|
|
|
84 |
|
311 |
gduche |
85 |
private void doRechercheImage() {
|
335 |
benjamin |
86 |
History.newItem(ConstantesNavigation.PAGE_RECHERCHE_IMAGES, true);
|
147 |
benjamin |
87 |
}
|
359 |
benjamin |
88 |
|
1091 |
gduche |
89 |
private void doRechercheObservation() {
|
335 |
benjamin |
90 |
History.newItem(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS, true);
|
|
|
91 |
}
|
147 |
benjamin |
92 |
|
9 |
benjamin |
93 |
}
|