Subversion Repositories eFlore/Applications.del

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
116 benjamin 1
package org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.personnel;
2
 
3
import java.util.Date;
4
 
5
import org.tela_botanica.del.client.modeles.Protocole;
6
import org.tela_botanica.del.client.modeles.VoteProtocole;
7
import org.tela_botanica.del.client.utils.MockDatasource;
8
 
9
import com.google.gwt.event.dom.client.ClickEvent;
10
import com.google.gwt.event.dom.client.ClickHandler;
11
import com.google.gwt.user.client.ui.HasWidgets;
12
 
13
public class MonVoteProtocolePresenteur {
14
 
15
	private MonVoteProtocoleVue vue;
16
 
17
	private Protocole protocole;
18
 
19
	private MockDatasource voteService = MockDatasource.getInstance();
20
 
21
	public MonVoteProtocolePresenteur(Protocole protocole) {
22
		this.protocole = protocole;
23
		vue = new MonVoteProtocoleVue();
24
	}
25
 
26
	public void go(HasWidgets container) {
27
		container.add(vue);
28
	}
29
 
30
	public void gererEvenements() {
31
		vue.getBoutonVote().addClickHandler(new ClickHandler() {
32
 
33
			@Override
34
			public void onClick(ClickEvent event) {
35
				VoteProtocole voteProtocole = new VoteProtocole();
36
				voteProtocole.setDate(new Date());
37
				voteProtocole.setVote(vue.getRating().getValue());
38
				voteProtocole.setProtocol(protocole);
39
 
40
				vue.getRating();
41
				voteService.saveVote(voteProtocole);
42
			}
43
		});
44
	}
45
}