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;
|
73 |
benjamin |
8 |
import org.tela_botanica.del.client.navigation.evenement.comparaisoneflore.EvenementComparaisonEflore;
|
|
|
9 |
import org.tela_botanica.del.client.navigation.evenement.comparaisoneflore.GestionnaireEvenementComparaisonEflore;
|
147 |
benjamin |
10 |
import org.tela_botanica.del.client.navigation.evenement.rechercheimage.EvenementRechercheImage;
|
|
|
11 |
import org.tela_botanica.del.client.navigation.evenement.rechercheimage.GestionnaireEvenementRechercheImage;
|
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;
|
9 |
benjamin |
21 |
|
14 |
benjamin |
22 |
private BusEvenementiel() {
|
9 |
benjamin |
23 |
super(null);
|
|
|
24 |
instance = this;
|
|
|
25 |
createHandlers();
|
|
|
26 |
}
|
|
|
27 |
|
14 |
benjamin |
28 |
public static BusEvenementiel getInstance() {
|
9 |
benjamin |
29 |
if (instance == null) {
|
14 |
benjamin |
30 |
instance = new BusEvenementiel();
|
9 |
benjamin |
31 |
}
|
|
|
32 |
return instance;
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
private void createHandlers() {
|
14 |
benjamin |
36 |
addHandler(EvenementValidation.TYPE, new GestionnaireEvenementValidation() {
|
9 |
benjamin |
37 |
|
|
|
38 |
@Override
|
73 |
benjamin |
39 |
public void onValidationImage(EvenementValidation event) {
|
147 |
benjamin |
40 |
doValidationImage(event.getImage());
|
73 |
benjamin |
41 |
}
|
|
|
42 |
});
|
9 |
benjamin |
43 |
|
73 |
benjamin |
44 |
addHandler(EvenementComparaisonEflore.TYPE, new GestionnaireEvenementComparaisonEflore() {
|
|
|
45 |
|
|
|
46 |
@Override
|
|
|
47 |
public void onComparaisonEflore(EvenementComparaisonEflore event) {
|
|
|
48 |
doComparaisonAvecEflore(event.getTaxonDemande());
|
9 |
benjamin |
49 |
}
|
|
|
50 |
});
|
147 |
benjamin |
51 |
|
|
|
52 |
addHandler(EvenementRechercheImage.TYPE, new GestionnaireEvenementRechercheImage() {
|
|
|
53 |
|
|
|
54 |
@Override
|
|
|
55 |
public void onRechercheImage(EvenementRechercheImage event) {
|
|
|
56 |
doRechercheImage(event.getImages());
|
|
|
57 |
}
|
|
|
58 |
});
|
9 |
benjamin |
59 |
}
|
|
|
60 |
|
147 |
benjamin |
61 |
private void doValidationImage(Image image) {
|
|
|
62 |
CacheClient.getInstance().setCurrentObservation(image.getObservation());
|
|
|
63 |
CacheClient.getInstance().setImageCourante(image);
|
73 |
benjamin |
64 |
History.newItem(ConstantesNavigation.PAGE_VALIDATION, true);
|
9 |
benjamin |
65 |
History.fireCurrentHistoryState();
|
|
|
66 |
}
|
|
|
67 |
|
73 |
benjamin |
68 |
private void doComparaisonAvecEflore(String taxon) {
|
|
|
69 |
CacheClient.getInstance().setTaxonPourRechercheEflore(taxon);
|
|
|
70 |
History.newItem(ConstantesNavigation.PAGE_COMPARAISON_EFLORE, true);
|
|
|
71 |
History.fireCurrentHistoryState();
|
|
|
72 |
}
|
|
|
73 |
|
147 |
benjamin |
74 |
private void doRechercheImage(List<Image> images) {
|
|
|
75 |
CacheClient.getInstance().setImages(images);
|
|
|
76 |
History.newItem(ConstantesNavigation.PAGE_RECHERCHE_IMAGES, true);
|
|
|
77 |
History.fireCurrentHistoryState();
|
|
|
78 |
}
|
|
|
79 |
|
9 |
benjamin |
80 |
}
|