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.metadonnees.MetadonneesPresenteur;
|
6 |
import org.tela_botanica.del.client.composants.metadonnees.MetadonneesPresenteur;
|
7 |
import org.tela_botanica.del.client.composants.metadonnees.MetadonneesVue;
|
7 |
import org.tela_botanica.del.client.composants.metadonnees.MetadonneesVue;
|
- |
|
8 |
import org.tela_botanica.del.client.composants.observations.ObservationImagesPresenteur;
|
- |
|
9 |
import org.tela_botanica.del.client.composants.observations.ObservationImagesVue;
|
8 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
10 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
9 |
import org.tela_botanica.del.client.modeles.MoyenneVote;
|
11 |
import org.tela_botanica.del.client.modeles.MoyenneVote;
|
10 |
import org.tela_botanica.del.client.modeles.VoteDetermination;
|
12 |
import org.tela_botanica.del.client.modeles.VoteDetermination;
|
11 |
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
|
13 |
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
|
12 |
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.EvenementAjoutDetermination;
|
14 |
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.EvenementAjoutDetermination;
|
13 |
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.GestionnaireEvenementAjoutDetermination;
|
15 |
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.GestionnaireEvenementAjoutDetermination;
|
14 |
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.EvenementVoteDetermination;
|
16 |
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.EvenementVoteDetermination;
|
15 |
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.GestionnaireEvenementVoteDetermination;
|
17 |
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.GestionnaireEvenementVoteDetermination;
|
16 |
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
|
18 |
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
|
17 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulaireproposition.FormulairePropositionPresenteur;
|
19 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulaireproposition.FormulairePropositionPresenteur;
|
18 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulaireproposition.FormulairePropositionVue;
|
20 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulaireproposition.FormulairePropositionVue;
|
19 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulairerechercheeflore.FormulaireRechercheEflorePresenteur;
|
21 |
import org.tela_botanica.del.client.vues.plateformedetermination.formulairerechercheeflore.FormulaireRechercheEflorePresenteur;
|
20 |
import org.tela_botanica.del.client.vues.plateformedetermination.forum.ForumPresenteur;
|
22 |
import org.tela_botanica.del.client.vues.plateformedetermination.forum.ForumPresenteur;
|
21 |
import org.tela_botanica.del.client.vues.plateformedetermination.forum.ForumVue;
|
23 |
import org.tela_botanica.del.client.vues.plateformedetermination.forum.ForumVue;
|
22 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesPresenteur;
|
24 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesPresenteur;
|
23 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesVue;
|
25 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesVue;
|
24 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVotePresenteur;
|
26 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVotePresenteur;
|
25 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVoteVue;
|
27 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVoteVue;
|
26 |
import org.tela_botanica.del.client.vues.rechercheobservations.observationimages.ObservationImagesPresenteur;
|
- |
|
27 |
import org.tela_botanica.del.client.vues.rechercheobservations.observationimages.ObservationImagesVue;
|
- |
|
28 |
|
28 |
|
29 |
import com.google.gwt.event.dom.client.ClickEvent;
|
29 |
import com.google.gwt.event.dom.client.ClickEvent;
|
30 |
import com.google.gwt.event.dom.client.ClickHandler;
|
30 |
import com.google.gwt.event.dom.client.ClickHandler;
|
31 |
import com.google.gwt.user.client.ui.Button;
|
31 |
import com.google.gwt.user.client.ui.Button;
|
32 |
import com.google.gwt.user.client.ui.HasWidgets;
|
32 |
import com.google.gwt.user.client.ui.HasWidgets;
|
33 |
import com.google.gwt.user.client.ui.IsWidget;
|
33 |
import com.google.gwt.user.client.ui.IsWidget;
|
34 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
34 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
35 |
|
35 |
|
36 |
public class DeterminationPresenteur extends Presenteur {
|
36 |
public class DeterminationPresenteur extends Presenteur {
|
37 |
|
37 |
|
38 |
public abstract interface Vue extends IsWidget {
|
38 |
public abstract interface Vue extends IsWidget {
|
39 |
public VerticalPanel getForum();
|
39 |
public VerticalPanel getForum();
|
40 |
|
40 |
|
41 |
public VerticalPanel getDetailImageObservation();
|
41 |
public VerticalPanel getDetailImageObservation();
|
42 |
|
42 |
|
43 |
public VerticalPanel getFormulaireRechercheEflore();
|
43 |
public VerticalPanel getFormulaireRechercheEflore();
|
44 |
|
44 |
|
45 |
public VerticalPanel getVote();
|
45 |
public VerticalPanel getVote();
|
46 |
|
46 |
|
47 |
public VerticalPanel getBarreRepartition();
|
47 |
public VerticalPanel getBarreRepartition();
|
48 |
|
48 |
|
49 |
public Button getBoutonAjoutProposition();
|
49 |
public Button getBoutonAjoutProposition();
|
50 |
|
50 |
|
51 |
public HasWidgets getMetadonnees();
|
51 |
public HasWidgets getMetadonnees();
|
52 |
}
|
52 |
}
|
53 |
|
53 |
|
54 |
private Vue vue;
|
54 |
private Vue vue;
|
55 |
|
55 |
|
56 |
BarreRepartitionVotePresenteur barreRepartitionVotePresenteur;
|
56 |
BarreRepartitionVotePresenteur barreRepartitionVotePresenteur;
|
57 |
|
57 |
|
58 |
public DeterminationPresenteur(Vue vue) {
|
58 |
public DeterminationPresenteur(Vue vue) {
|
59 |
this.vue = vue;
|
59 |
this.vue = vue;
|
60 |
}
|
60 |
}
|
61 |
|
61 |
|
62 |
public void go(HasWidgets composite) {
|
62 |
public void go(HasWidgets composite) {
|
63 |
|
63 |
|
64 |
if (CacheClient.getInstance().getImageCourante() != null) {
|
64 |
if (CacheClient.getInstance().getImageCourante() != null) {
|
65 |
new MetadonneesPresenteur(new MetadonneesVue(), CacheClient.getInstance().getObservationCourante()).go(vue.getMetadonnees());
|
65 |
new MetadonneesPresenteur(new MetadonneesVue(), CacheClient.getInstance().getObservationCourante()).go(vue.getMetadonnees());
|
66 |
new ObservationImagesPresenteur(new ObservationImagesVue(), CacheClient.getInstance().getObservationCourante()).go(vue.getDetailImageObservation());
|
66 |
new ObservationImagesPresenteur(new ObservationImagesVue(), CacheClient.getInstance().getObservationCourante()).go(vue.getDetailImageObservation());
|
67 |
new EnsembleVotesPresenteur(new EnsembleVotesVue()).go(vue.getVote());
|
67 |
new EnsembleVotesPresenteur(new EnsembleVotesVue()).go(vue.getVote());
|
68 |
}
|
68 |
}
|
69 |
new ForumPresenteur(new ForumVue()).go(vue.getForum());
|
69 |
new ForumPresenteur(new ForumVue()).go(vue.getForum());
|
70 |
new FormulaireRechercheEflorePresenteur().go(vue.getFormulaireRechercheEflore());
|
70 |
new FormulaireRechercheEflorePresenteur().go(vue.getFormulaireRechercheEflore());
|
71 |
|
71 |
|
72 |
barreRepartitionVotePresenteur = new BarreRepartitionVotePresenteur(new BarreRepartitionVoteVue());
|
72 |
barreRepartitionVotePresenteur = new BarreRepartitionVotePresenteur(new BarreRepartitionVoteVue());
|
73 |
barreRepartitionVotePresenteur.go(vue.getBarreRepartition());
|
73 |
barreRepartitionVotePresenteur.go(vue.getBarreRepartition());
|
74 |
calculerEtAfficherVoteDeterminationPlusPopulaire();
|
74 |
calculerEtAfficherVoteDeterminationPlusPopulaire();
|
75 |
|
75 |
|
76 |
composite.add(vue.asWidget());
|
76 |
composite.add(vue.asWidget());
|
77 |
|
77 |
|
78 |
gererEvenements();
|
78 |
gererEvenements();
|
79 |
}
|
79 |
}
|
80 |
|
80 |
|
81 |
private void calculerEtAfficherVoteDeterminationPlusPopulaire() {
|
81 |
private void calculerEtAfficherVoteDeterminationPlusPopulaire() {
|
82 |
|
82 |
|
83 |
List<MoyenneVote> votesOrdonnes = CalculVoteDeterminationService.calculerVoteDeterminationPlusPopulaire(CacheClient.getInstance().getObservationCourante().getPropositionsDetermination());
|
83 |
List<MoyenneVote> votesOrdonnes = CalculVoteDeterminationService.calculerVoteDeterminationPlusPopulaire(CacheClient.getInstance().getObservationCourante().getPropositionsDetermination());
|
84 |
if (votesOrdonnes.size() > 0) {
|
84 |
if (votesOrdonnes.size() > 0) {
|
85 |
barreRepartitionVotePresenteur.afficherVotes(votesOrdonnes.get(0));
|
85 |
barreRepartitionVotePresenteur.afficherVotes(votesOrdonnes.get(0));
|
86 |
}
|
86 |
}
|
87 |
}
|
87 |
}
|
88 |
|
88 |
|
89 |
public void gererEvenements() {
|
89 |
public void gererEvenements() {
|
90 |
BusEvenementiel.getInstance().addHandler(EvenementVoteDetermination.TYPE, new GestionnaireEvenementVoteDetermination() {
|
90 |
BusEvenementiel.getInstance().addHandler(EvenementVoteDetermination.TYPE, new GestionnaireEvenementVoteDetermination() {
|
91 |
@Override
|
91 |
@Override
|
92 |
public void onVoteDetermination(VoteDetermination event) {
|
92 |
public void onVoteDetermination(VoteDetermination event) {
|
93 |
calculerEtAfficherVoteDeterminationPlusPopulaire();
|
93 |
calculerEtAfficherVoteDeterminationPlusPopulaire();
|
94 |
}
|
94 |
}
|
95 |
});
|
95 |
});
|
96 |
|
96 |
|
97 |
vue.getBoutonAjoutProposition().addClickHandler(new ClickHandler() {
|
97 |
vue.getBoutonAjoutProposition().addClickHandler(new ClickHandler() {
|
98 |
@Override
|
98 |
@Override
|
99 |
public void onClick(ClickEvent event) {
|
99 |
public void onClick(ClickEvent event) {
|
100 |
|
100 |
|
101 |
ouvrirFenetreModale(new FormulairePropositionPresenteur(new FormulairePropositionVue()));
|
101 |
ouvrirFenetreModale(new FormulairePropositionPresenteur(new FormulairePropositionVue()));
|
102 |
}
|
102 |
}
|
103 |
});
|
103 |
});
|
104 |
|
104 |
|
105 |
BusEvenementiel.getInstance().addHandler(EvenementAjoutDetermination.TYPE, new GestionnaireEvenementAjoutDetermination() {
|
105 |
BusEvenementiel.getInstance().addHandler(EvenementAjoutDetermination.TYPE, new GestionnaireEvenementAjoutDetermination() {
|
106 |
|
106 |
|
107 |
@Override
|
107 |
@Override
|
108 |
public void onAjoutDetermination(EvenementAjoutDetermination event) {
|
108 |
public void onAjoutDetermination(EvenementAjoutDetermination event) {
|
109 |
if (fenetreModaleEstOuverte()) {
|
109 |
if (fenetreModaleEstOuverte()) {
|
110 |
fermerFenetreModale();
|
110 |
fermerFenetreModale();
|
111 |
}
|
111 |
}
|
112 |
}
|
112 |
}
|
113 |
});
|
113 |
});
|
114 |
}
|
114 |
}
|
115 |
}
|
115 |
}
|