Subversion Repositories eFlore/Applications.del

Rev

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

Rev 172 Rev 186
Line 1... Line 1...
1
package org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition;
1
package org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition;
Line -... Line 2...
-
 
2
 
-
 
3
import java.util.Date;
-
 
4
 
-
 
5
import org.tela_botanica.del.client.modeles.MoyenneVote;
-
 
6
import org.tela_botanica.del.client.modeles.VoteDetermination;
2
 
7
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
Line -... Line 8...
-
 
8
import org.tela_botanica.del.client.utils.MockDatasource;
-
 
9
 
-
 
10
import com.google.gwt.event.dom.client.ClickEvent;
3
import org.tela_botanica.del.client.utils.MockDatasource;
11
import com.google.gwt.event.dom.client.ClickHandler;
4
 
12
import com.google.gwt.event.shared.HandlerRegistration;
Line 5... Line 13...
5
import com.google.gwt.user.client.ui.HTML;
13
import com.google.gwt.user.client.ui.HTML;
Line 6... Line 14...
6
import com.google.gwt.user.client.ui.HasWidgets;
14
import com.google.gwt.user.client.ui.HasWidgets;
Line 7... Line 15...
7
 
15
 
8
public class BarreRepartitionVotePresenteur {
16
public class BarreRepartitionVotePresenteur {
-
 
17
	
-
 
18
	private BarreRepartitionVoteVue vue = new BarreRepartitionVoteVue();
9
	
19
 
10
	private BarreRepartitionVoteVue vue = new BarreRepartitionVoteVue();
20
	private MockDatasource validationService = MockDatasource.getInstance();
11
 
21
	
Line 12... Line 22...
12
	private MockDatasource validationService = MockDatasource.getInstance();
22
	private MoyenneVote moyenneVote;
-
 
23
	
13
 
24
	public void go(HasWidgets container) {
-
 
25
		container.add(vue);
14
	public void go(HasWidgets container) {
26
	}
Line 15... Line 27...
15
		container.add(vue);
27
 
16
	}
28
	public void afficherVotes(MoyenneVote moyenneVote) {
17
 
29
		this.moyenneVote = moyenneVote;
Line 18... Line 30...
18
	public void afficherVotes(int pourcentage, String nomTaxon) {
30
		vue.afficherVotes(moyenneVote.getScore(), moyenneVote.getIntituleAssocie());
19
		vue.afficherVotes(pourcentage, nomTaxon);
31
		gererEvenements();
20
	}
32
	}
-
 
33
	
-
 
34
	public BarreRepartitionVoteVue getBarreRepartitionVoteVue() {
-
 
35
		return vue;
-
 
36
	}
-
 
37
	
-
 
38
	public HTML getBarreRepartitionVoteVueHTML() {
-
 
39
		return vue.getBarreRepartitionHtmlBrut();
-
 
40
	}
-
 
41
	
-
 
42
	public void gererEvenements() {
-
 
43
		
-
 
44
		vue.getBoutonOui().addClickHandler(new ClickHandler() {
-
 
45
 
-
 
46
			@Override
-
 
47
			public void onClick(ClickEvent event) {
-
 
48
				VoteDetermination vd = new VoteDetermination();
-
 
49
				vd.setContributeur("test");
-
 
50
				vd.setDate(new Date());
-
 
51
				vd.setVote(1);
-
 
52
				vd.setId("3");
-
 
53
				
-
 
54
				moyenneVote.getPropositionAssociee().ajouterVoteDetermination(vd);
-
 
55
				moyenneVote = CalculVoteDeterminationService.calculerVoteDetermination(moyenneVote.getPropositionAssociee());
-
 
56
				afficherVotes(moyenneVote);
-
 
57
			}
-
 
58
			
-
 
59
		});
-
 
60
		
-
 
61
		vue.getBoutonNon().addClickHandler(new ClickHandler() {
-
 
62
 
-
 
63
			@Override
-
 
64
			public void onClick(ClickEvent event) {
-
 
65
				VoteDetermination vd = new VoteDetermination();
-
 
66
				vd.setContributeur("test");
-
 
67
				vd.setDate(new Date());
-
 
68
				vd.setVote(0);
21
	
69
				vd.setId("3");