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;
|
178 |
benjamin |
8 |
import org.tela_botanica.del.client.modeles.Protocole;
|
|
|
9 |
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
|
|
|
10 |
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.GestionnaireEvenementChangementProtocole;
|
73 |
benjamin |
11 |
import org.tela_botanica.del.client.navigation.evenement.comparaisoneflore.EvenementComparaisonEflore;
|
|
|
12 |
import org.tela_botanica.del.client.navigation.evenement.comparaisoneflore.GestionnaireEvenementComparaisonEflore;
|
147 |
benjamin |
13 |
import org.tela_botanica.del.client.navigation.evenement.rechercheimage.EvenementRechercheImage;
|
|
|
14 |
import org.tela_botanica.del.client.navigation.evenement.rechercheimage.GestionnaireEvenementRechercheImage;
|
15 |
benjamin |
15 |
import org.tela_botanica.del.client.navigation.evenement.validationobservation.EvenementValidation;
|
|
|
16 |
import org.tela_botanica.del.client.navigation.evenement.validationobservation.GestionnaireEvenementValidation;
|
9 |
benjamin |
17 |
|
|
|
18 |
import com.google.gwt.event.shared.HandlerManager;
|
|
|
19 |
import com.google.gwt.user.client.History;
|
|
|
20 |
|
14 |
benjamin |
21 |
public class BusEvenementiel extends HandlerManager {
|
9 |
benjamin |
22 |
|
14 |
benjamin |
23 |
private static BusEvenementiel instance;
|
9 |
benjamin |
24 |
|
14 |
benjamin |
25 |
private BusEvenementiel() {
|
9 |
benjamin |
26 |
super(null);
|
|
|
27 |
instance = this;
|
|
|
28 |
createHandlers();
|
|
|
29 |
}
|
|
|
30 |
|
14 |
benjamin |
31 |
public static BusEvenementiel getInstance() {
|
9 |
benjamin |
32 |
if (instance == null) {
|
14 |
benjamin |
33 |
instance = new BusEvenementiel();
|
9 |
benjamin |
34 |
}
|
|
|
35 |
return instance;
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
private void createHandlers() {
|
14 |
benjamin |
39 |
addHandler(EvenementValidation.TYPE, new GestionnaireEvenementValidation() {
|
9 |
benjamin |
40 |
|
|
|
41 |
@Override
|
73 |
benjamin |
42 |
public void onValidationImage(EvenementValidation event) {
|
147 |
benjamin |
43 |
doValidationImage(event.getImage());
|
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());
|
9 |
benjamin |
52 |
}
|
|
|
53 |
});
|
147 |
benjamin |
54 |
|
|
|
55 |
addHandler(EvenementRechercheImage.TYPE, new GestionnaireEvenementRechercheImage() {
|
|
|
56 |
|
|
|
57 |
@Override
|
|
|
58 |
public void onRechercheImage(EvenementRechercheImage event) {
|
|
|
59 |
doRechercheImage(event.getImages());
|
|
|
60 |
}
|
|
|
61 |
});
|
178 |
benjamin |
62 |
|
|
|
63 |
addHandler(EvenementChangementProtocole.TYPE, new GestionnaireEvenementChangementProtocole() {
|
|
|
64 |
|
|
|
65 |
@Override
|
|
|
66 |
public void onChangementProtocole(EvenementChangementProtocole event) {
|
|
|
67 |
doChangementProtocole(event.getProtocole());
|
|
|
68 |
}
|
|
|
69 |
});
|
9 |
benjamin |
70 |
}
|
|
|
71 |
|
147 |
benjamin |
72 |
private void doValidationImage(Image image) {
|
|
|
73 |
CacheClient.getInstance().setCurrentObservation(image.getObservation());
|
|
|
74 |
CacheClient.getInstance().setImageCourante(image);
|
73 |
benjamin |
75 |
History.newItem(ConstantesNavigation.PAGE_VALIDATION, true);
|
9 |
benjamin |
76 |
History.fireCurrentHistoryState();
|
|
|
77 |
}
|
|
|
78 |
|
73 |
benjamin |
79 |
private void doComparaisonAvecEflore(String taxon) {
|
|
|
80 |
CacheClient.getInstance().setTaxonPourRechercheEflore(taxon);
|
|
|
81 |
History.newItem(ConstantesNavigation.PAGE_COMPARAISON_EFLORE, true);
|
|
|
82 |
History.fireCurrentHistoryState();
|
|
|
83 |
}
|
|
|
84 |
|
147 |
benjamin |
85 |
private void doRechercheImage(List<Image> images) {
|
|
|
86 |
CacheClient.getInstance().setImages(images);
|
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 |
}
|