Subversion Repositories eFlore/Applications.del

Rev

Rev 332 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 332 Rev 436
Line 21... Line 21...
21
import org.tela_botanica.del.client.vues.plateformedetermination.forum.ForumVue;
21
import org.tela_botanica.del.client.vues.plateformedetermination.forum.ForumVue;
22
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesPresenteur;
22
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesPresenteur;
23
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesVue;
23
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesVue;
24
import org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVotePresenteur;
24
import org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVotePresenteur;
25
import org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVoteVue;
25
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;
Line 26... Line 28...
26
 
28
 
27
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;
28
import com.google.gwt.event.dom.client.ClickHandler;
31
import com.google.gwt.user.client.Window;
29
import com.google.gwt.user.client.ui.Button;
32
import com.google.gwt.user.client.ui.Button;
30
import com.google.gwt.user.client.ui.HasWidgets;
33
import com.google.gwt.user.client.ui.HasWidgets;
31
import com.google.gwt.user.client.ui.IsWidget;
34
import com.google.gwt.user.client.ui.IsWidget;
Line 32... Line 35...
32
import com.google.gwt.user.client.ui.VerticalPanel;
35
import com.google.gwt.user.client.ui.VerticalPanel;
Line 33... Line 36...
33
 
36
 
34
public class DeterminationPresenteur extends Presenteur {
37
public class DeterminationPresenteur extends Presenteur {
-
 
38
 
35
 
39
	public abstract interface Vue extends IsWidget {
-
 
40
		public VerticalPanel getForum();
36
	public abstract interface Vue extends IsWidget {
41
 
-
 
42
		public VerticalPanel getDetailImageObservation();
37
		public VerticalPanel getForum();
43
 
-
 
44
		public VerticalPanel getFormulaireRechercheEflore();
38
		public VerticalPanel getDetailImageObservation();
45
 
-
 
46
		public VerticalPanel getVote();
39
		public VerticalPanel getFormulaireRechercheEflore();
47
 
40
		public VerticalPanel getVote();	
48
		public VerticalPanel getBarreRepartition();
-
 
49
 
41
		public VerticalPanel getBarreRepartition();
50
		public Button getBoutonAjoutProposition();
42
		public Button getBoutonAjoutProposition();
51
	}
43
	}
52
 
Line 44... Line 53...
44
	private Vue vue;
53
	private Vue vue;
45
	
54
 
46
	BarreRepartitionVotePresenteur barreRepartitionVotePresenteur;
55
	BarreRepartitionVotePresenteur barreRepartitionVotePresenteur;
Line 47... Line 56...
47
 
56
 
48
	public DeterminationPresenteur(Vue vue) {
57
	public DeterminationPresenteur(Vue vue) {
49
		this.vue = vue;
58
		this.vue = vue;
-
 
59
	}
50
	}
60
 
-
 
61
	public void go(HasWidgets composite) {
51
 
62
 
52
	public void go(HasWidgets composite) {
63
		if (CacheClient.getInstance().getImageCourante() != null) {
53
		
64
			// new DetailImageObservationPresenteur(new
54
		if (CacheClient.getInstance().getImageCourante() != null) {
65
			// DetailImageObservationVue()).go(vue.getDetailImageObservation());
Line 55... Line 66...
55
			new DetailImageObservationPresenteur(new DetailImageObservationVue()).go(vue.getDetailImageObservation());
66
			new ObservationImagesPresenteur(new ObservationImagesVue(), CacheClient.getInstance().getObservationCourante()).go(vue.getDetailImageObservation());
56
			new EnsembleVotesPresenteur(new EnsembleVotesVue()).go(vue.getVote());
67
			new EnsembleVotesPresenteur(new EnsembleVotesVue()).go(vue.getVote());
57
		}
68
		}
Line 58... Line 69...
58
		new ForumPresenteur(new ForumVue()).go(vue.getForum());
69
		new ForumPresenteur(new ForumVue()).go(vue.getForum());
59
		new FormulaireRechercheEflorePresenteur().go(vue.getFormulaireRechercheEflore());
70
		new FormulaireRechercheEflorePresenteur().go(vue.getFormulaireRechercheEflore());
60
 
71
 
61
		barreRepartitionVotePresenteur = new BarreRepartitionVotePresenteur(new BarreRepartitionVoteVue());
72
		barreRepartitionVotePresenteur = new BarreRepartitionVotePresenteur(new BarreRepartitionVoteVue());
Line 62... Line 73...
62
		barreRepartitionVotePresenteur.go(vue.getBarreRepartition());
73
		barreRepartitionVotePresenteur.go(vue.getBarreRepartition());
Line 63... Line 74...
63
		calculerEtAfficherVoteDeterminationPlusPopulaire();
74
		calculerEtAfficherVoteDeterminationPlusPopulaire();
64
 
75
 
65
		composite.add(vue.asWidget());
76
		composite.add(vue.asWidget());
66
		
77
 
67
		gererEvenements();
78
		gererEvenements();
68
	}
79
	}
69
 
80
 
70
	private void calculerEtAfficherVoteDeterminationPlusPopulaire() {
81
	private void calculerEtAfficherVoteDeterminationPlusPopulaire() {
71
 
82
 
72
		List<MoyenneVote> votesOrdonnes = CalculVoteDeterminationService.calculerVoteDeterminationPlusPopulaire(CacheClient.getInstance().getObservationCourante().getPropositionsDetermination());
83
		List<MoyenneVote> votesOrdonnes = CalculVoteDeterminationService.calculerVoteDeterminationPlusPopulaire(CacheClient.getInstance().getObservationCourante().getPropositionsDetermination());
73
		if (votesOrdonnes.size() > 0) {
84
		if (votesOrdonnes.size() > 0) {
74
			barreRepartitionVotePresenteur.afficherVotes(votesOrdonnes.get(0));
85
			barreRepartitionVotePresenteur.afficherVotes(votesOrdonnes.get(0));
75
		}
86
		}
76
	}
87
	}
77
	
88
 
78
	public void gererEvenements() {
89
	public void gererEvenements() {
79
		BusEvenementiel.getInstance().addHandler(EvenementVoteDetermination.TYPE, new GestionnaireEvenementVoteDetermination() {
90
		BusEvenementiel.getInstance().addHandler(EvenementVoteDetermination.TYPE, new GestionnaireEvenementVoteDetermination() {
80
			@Override
91
			@Override
81
			public void onVoteDetermination(VoteDetermination event) {
92
			public void onVoteDetermination(VoteDetermination event) {
82
				calculerEtAfficherVoteDeterminationPlusPopulaire();
93
				calculerEtAfficherVoteDeterminationPlusPopulaire();
83
			}
94
			}
84
		});
95
		});
85
		
96
 
86
		vue.getBoutonAjoutProposition().addClickHandler(new ClickHandler() {		
97
		vue.getBoutonAjoutProposition().addClickHandler(new ClickHandler() {
87
			@Override
98
			@Override
88
			public void onClick(ClickEvent event) {
99
			public void onClick(ClickEvent event) {
89
				
100
 
90
				ouvrirFenetreModale(new FormulairePropositionPresenteur(new FormulairePropositionVue()));
101
				ouvrirFenetreModale(new FormulairePropositionPresenteur(new FormulairePropositionVue()));
91
			}
102
			}
92
		});
103
		});
93
		
104
 
94
		BusEvenementiel.getInstance().addHandler(EvenementAjoutDetermination.TYPE, new GestionnaireEvenementAjoutDetermination() {
105
		BusEvenementiel.getInstance().addHandler(EvenementAjoutDetermination.TYPE, new GestionnaireEvenementAjoutDetermination() {