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;
|
9 |
benjamin |
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;
|
15 |
benjamin |
8 |
import org.tela_botanica.del.client.navigation.evenement.validationobservation.EvenementValidation;
|
|
|
9 |
import org.tela_botanica.del.client.navigation.evenement.validationobservation.GestionnaireEvenementValidation;
|
9 |
benjamin |
10 |
|
|
|
11 |
import com.google.gwt.event.shared.HandlerManager;
|
|
|
12 |
import com.google.gwt.user.client.History;
|
|
|
13 |
|
14 |
benjamin |
14 |
public class BusEvenementiel extends HandlerManager {
|
9 |
benjamin |
15 |
|
14 |
benjamin |
16 |
private static BusEvenementiel instance;
|
9 |
benjamin |
17 |
|
14 |
benjamin |
18 |
private BusEvenementiel() {
|
9 |
benjamin |
19 |
super(null);
|
|
|
20 |
instance = this;
|
|
|
21 |
createHandlers();
|
|
|
22 |
}
|
|
|
23 |
|
14 |
benjamin |
24 |
public static BusEvenementiel getInstance() {
|
9 |
benjamin |
25 |
if (instance == null) {
|
14 |
benjamin |
26 |
instance = new BusEvenementiel();
|
9 |
benjamin |
27 |
}
|
|
|
28 |
return instance;
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
private void createHandlers() {
|
14 |
benjamin |
32 |
addHandler(EvenementValidation.TYPE, new GestionnaireEvenementValidation() {
|
9 |
benjamin |
33 |
|
|
|
34 |
@Override
|
73 |
benjamin |
35 |
public void onValidationImage(EvenementValidation event) {
|
|
|
36 |
doValidationObservation(event.getImageCel());
|
|
|
37 |
}
|
|
|
38 |
});
|
9 |
benjamin |
39 |
|
73 |
benjamin |
40 |
addHandler(EvenementComparaisonEflore.TYPE, new GestionnaireEvenementComparaisonEflore() {
|
|
|
41 |
|
|
|
42 |
@Override
|
|
|
43 |
public void onComparaisonEflore(EvenementComparaisonEflore event) {
|
|
|
44 |
doComparaisonAvecEflore(event.getTaxonDemande());
|
9 |
benjamin |
45 |
}
|
|
|
46 |
});
|
73 |
benjamin |
47 |
|
9 |
benjamin |
48 |
}
|
|
|
49 |
|
73 |
benjamin |
50 |
private void doValidationObservation(Observation observation) {
|
14 |
benjamin |
51 |
CacheClient.getInstance().setCurrentObservation(observation);
|
73 |
benjamin |
52 |
History.newItem(ConstantesNavigation.PAGE_VALIDATION, true);
|
9 |
benjamin |
53 |
History.fireCurrentHistoryState();
|
|
|
54 |
}
|
|
|
55 |
|
73 |
benjamin |
56 |
private void doComparaisonAvecEflore(String taxon) {
|
|
|
57 |
CacheClient.getInstance().setTaxonPourRechercheEflore(taxon);
|
|
|
58 |
History.newItem(ConstantesNavigation.PAGE_COMPARAISON_EFLORE, true);
|
|
|
59 |
History.fireCurrentHistoryState();
|
|
|
60 |
}
|
|
|
61 |
|
9 |
benjamin |
62 |
}
|