1 |
package org.tela_botanica.del.client.vues.plateformedetermination;
|
1 |
package org.tela_botanica.del.client.vues.plateformedetermination;
|
2 |
|
2 |
|
3 |
import java.util.List;
|
3 |
import java.util.List;
|
4 |
|
4 |
|
5 |
import org.tela_botanica.del.client.cache.CacheClient;
|
5 |
import org.tela_botanica.del.client.cache.CacheClient;
|
- |
|
6 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
6 |
import org.tela_botanica.del.client.modeles.MoyenneVote;
|
7 |
import org.tela_botanica.del.client.modeles.MoyenneVote;
|
7 |
import org.tela_botanica.del.client.modeles.VoteDetermination;
|
8 |
import org.tela_botanica.del.client.modeles.VoteDetermination;
|
8 |
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
|
9 |
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
|
9 |
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.EvenementAjoutDetermination;
|
10 |
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.EvenementAjoutDetermination;
|
10 |
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.GestionnaireEvenementAjoutDetermination;
|
11 |
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.GestionnaireEvenementAjoutDetermination;
|
11 |
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.EvenementVoteDetermination;
|
12 |
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.EvenementVoteDetermination;
|
12 |
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.GestionnaireEvenementVoteDetermination;
|
13 |
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.GestionnaireEvenementVoteDetermination;
|
13 |
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
|
14 |
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
|
14 |
import org.tela_botanica.del.client.vues.plateformedetermination.detail.DetailImageObservationPresenteur;
|
15 |
import org.tela_botanica.del.client.vues.plateformedetermination.detail.DetailImageObservationPresenteur;
|
15 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulaireproposition.FormulairePropositionPresenteur;
|
16 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulaireproposition.FormulairePropositionPresenteur;
|
16 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulairerechercheeflore.FormulaireRechercheEflorePresenteur;
|
17 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulairerechercheeflore.FormulaireRechercheEflorePresenteur;
|
17 |
import org.tela_botanica.del.client.vues.plateformedetermination.forum.ForumPresenteur;
|
18 |
import org.tela_botanica.del.client.vues.plateformedetermination.forum.ForumPresenteur;
|
18 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesPresenteur;
|
19 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesPresenteur;
|
19 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVotePresenteur;
|
20 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVotePresenteur;
|
- |
|
21 |
|
- |
|
22 |
import com.google.gwt.event.dom.client.ClickEvent;
|
20 |
|
23 |
import com.google.gwt.event.dom.client.ClickHandler;
|
21 |
import com.google.gwt.user.client.ui.HasWidgets;
|
24 |
import com.google.gwt.user.client.ui.HasWidgets;
|
22 |
|
- |
|
23 |
public class DeterminationPresenteur {
|
25 |
|
24 |
|
26 |
public class DeterminationPresenteur extends Presenteur {
|
25 |
DeterminationVue determinationVue = new DeterminationVue();
|
27 |
|
26 |
BarreRepartitionVotePresenteur barreRepartitionVotePresenteur;
|
28 |
BarreRepartitionVotePresenteur barreRepartitionVotePresenteur;
|
27 |
|
29 |
|
28 |
public DeterminationPresenteur() {
|
30 |
public DeterminationPresenteur() {
|
29 |
|
- |
|
- |
|
31 |
super(new DeterminationVue());
|
30 |
}
|
32 |
}
|
31 |
|
33 |
|
32 |
public void go(HasWidgets composite) {
|
34 |
public void go(HasWidgets composite) {
|
- |
|
35 |
|
- |
|
36 |
DeterminationVue determinationVue = (DeterminationVue)getVue();
|
33 |
|
37 |
|
34 |
new DetailImageObservationPresenteur().go(determinationVue.getDetailImageObservation());
|
38 |
new DetailImageObservationPresenteur().go(determinationVue.getDetailImageObservation());
|
35 |
new EnsembleVotesPresenteur().go(determinationVue.getVote());
|
39 |
new EnsembleVotesPresenteur().go(determinationVue.getVote());
|
36 |
new ForumPresenteur().go(determinationVue.getForum());
|
40 |
new ForumPresenteur().go(determinationVue.getForum());
|
37 |
new FormulairePropositionPresenteur().go(determinationVue.getFormulaireProposition());
|
- |
|
38 |
new FormulaireRechercheEflorePresenteur().go(determinationVue.getFormulaireRechercheEflore());
|
41 |
new FormulaireRechercheEflorePresenteur().go(determinationVue.getFormulaireRechercheEflore());
|
39 |
|
42 |
|
40 |
barreRepartitionVotePresenteur = new BarreRepartitionVotePresenteur();
|
43 |
barreRepartitionVotePresenteur = new BarreRepartitionVotePresenteur();
|
41 |
barreRepartitionVotePresenteur.go(determinationVue.getBarreRepartition());
|
44 |
barreRepartitionVotePresenteur.go(determinationVue.getBarreRepartition());
|
42 |
calculerEtAfficherVoteDeterminationPlusPopulaire();
|
45 |
calculerEtAfficherVoteDeterminationPlusPopulaire();
|
43 |
|
46 |
|
44 |
composite.add(determinationVue);
|
47 |
composite.add(determinationVue);
|
45 |
|
48 |
|
46 |
gererEvenements();
|
49 |
gererEvenements();
|
47 |
}
|
50 |
}
|
48 |
|
51 |
|
49 |
private void calculerEtAfficherVoteDeterminationPlusPopulaire() {
|
52 |
private void calculerEtAfficherVoteDeterminationPlusPopulaire() {
|
50 |
|
53 |
|
51 |
List<MoyenneVote> votesOrdonnes = CalculVoteDeterminationService.calculerVoteDeterminationPlusPopulaire(CacheClient.getInstance().getObservationCourante().getPropositionsDetermination());
|
54 |
List<MoyenneVote> votesOrdonnes = CalculVoteDeterminationService.calculerVoteDeterminationPlusPopulaire(CacheClient.getInstance().getObservationCourante().getPropositionsDetermination());
|
52 |
if (votesOrdonnes.size() > 0) {
|
55 |
if (votesOrdonnes.size() > 0) {
|
53 |
barreRepartitionVotePresenteur.afficherVotes(votesOrdonnes.get(0));
|
56 |
barreRepartitionVotePresenteur.afficherVotes(votesOrdonnes.get(0));
|
54 |
}
|
57 |
}
|
55 |
}
|
58 |
}
|
56 |
|
59 |
|
57 |
public void gererEvenements() {
|
60 |
public void gererEvenements() {
|
58 |
BusEvenementiel.getInstance().addHandler(EvenementVoteDetermination.TYPE, new GestionnaireEvenementVoteDetermination() {
|
61 |
BusEvenementiel.getInstance().addHandler(EvenementVoteDetermination.TYPE, new GestionnaireEvenementVoteDetermination() {
|
59 |
|
- |
|
60 |
@Override
|
62 |
@Override
|
61 |
public void onVoteDetermination(VoteDetermination event) {
|
63 |
public void onVoteDetermination(VoteDetermination event) {
|
62 |
calculerEtAfficherVoteDeterminationPlusPopulaire();
|
64 |
calculerEtAfficherVoteDeterminationPlusPopulaire();
|
63 |
}
|
65 |
}
|
- |
|
66 |
});
|
- |
|
67 |
|
- |
|
68 |
((DeterminationVue)getVue()).getBoutonAjoutProposition().addClickHandler(new ClickHandler() {
|
- |
|
69 |
@Override
|
- |
|
70 |
public void onClick(ClickEvent event) {
|
- |
|
71 |
|
- |
|
72 |
ouvrirFenetreModale(new FormulairePropositionPresenteur());
|
- |
|
73 |
}
|
- |
|
74 |
});
|
- |
|
75 |
|
- |
|
76 |
BusEvenementiel.getInstance().addHandler(EvenementAjoutDetermination.TYPE, new GestionnaireEvenementAjoutDetermination() {
|
- |
|
77 |
|
- |
|
78 |
@Override
|
- |
|
79 |
public void onAjoutDetermination(EvenementAjoutDetermination event) {
|
- |
|
80 |
if(fenetreModaleEstOuverte()) {
|
- |
|
81 |
fermerFenetreModale();
|
- |
|
82 |
}
|
- |
|
83 |
}
|
64 |
});
|
84 |
});
|
65 |
}
|
85 |
}
|
66 |
}
|
86 |
}
|