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