Subversion Repositories eFlore/Applications.del

Rev

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

Rev 478 Rev 629
Line 7... Line 7...
7
import org.tela_botanica.del.client.modeles.VoteProtocole;
7
import org.tela_botanica.del.client.modeles.VoteProtocole;
Line 8... Line 8...
8
 
8
 
9
import com.google.gwt.core.client.GWT;
9
import com.google.gwt.core.client.GWT;
10
import com.google.gwt.event.dom.client.ClickEvent;
10
import com.google.gwt.event.dom.client.ClickEvent;
-
 
11
import com.google.gwt.event.dom.client.ClickHandler;
11
import com.google.gwt.event.dom.client.ClickHandler;
12
import com.google.gwt.event.dom.client.HasChangeHandlers;
12
import com.google.gwt.event.dom.client.HasClickHandlers;
13
import com.google.gwt.event.dom.client.HasClickHandlers;
13
import com.google.gwt.uibinder.client.UiBinder;
14
import com.google.gwt.uibinder.client.UiBinder;
14
import com.google.gwt.uibinder.client.UiField;
15
import com.google.gwt.uibinder.client.UiField;
15
import com.google.gwt.user.client.Window;
16
import com.google.gwt.user.client.Window;
16
import com.google.gwt.user.client.ui.Button;
17
import com.google.gwt.user.client.ui.Button;
17
import com.google.gwt.user.client.ui.Composite;
18
import com.google.gwt.user.client.ui.Composite;
18
import com.google.gwt.user.client.ui.FocusPanel;
19
import com.google.gwt.user.client.ui.FocusPanel;
-
 
20
import com.google.gwt.user.client.ui.HasText;
19
import com.google.gwt.user.client.ui.HasText;
21
import com.google.gwt.user.client.ui.HasWidgets;
20
import com.google.gwt.user.client.ui.Label;
22
import com.google.gwt.user.client.ui.Label;
Line 21... Line 23...
21
import com.google.gwt.user.client.ui.Widget;
23
import com.google.gwt.user.client.ui.Widget;
Line 22... Line 24...
22
 
24
 
23
public class MoyenneVoteVue extends Composite {
25
public class MoyenneVoteVue extends Composite implements MoyenneVotePresenteur.Vue {
24
 
26
 
25
	// Annotation can be used to change the name of the associated xml file
27
	// Annotation can be used to change the name of the associated xml file
Line 38... Line 40...
38
	Label nbVotes;
40
	Label nbVotes;
Line 39... Line 41...
39
 
41
 
40
	@UiField 
42
	@UiField 
Line 41... Line 43...
41
	Button boutonVoter, boutonAnnuler;
43
	Button boutonVoter, boutonAnnuler;
42
	
44
	
43
	protected MoyenneVoteVue(List<VoteProtocole> validationDatas) {
-
 
44
		initWidget(uiBinder.createAndBindUi(this));
45
	public MoyenneVoteVue() {
45
		
46
		initWidget(uiBinder.createAndBindUi(this));
46
		votes = new Rating(0, 5);
47
		votes = new Rating(0, 5);
47
		votes.setReadOnly(false);
-
 
48
		voter.add(votes);
48
		votes.setReadOnly(false);
49
 
49
		voter.add(votes);
50
		masquerBoutonAnnuler();
-
 
51
		masquerBoutonVoter();
50
		masquerBoutonAnnuler();
Line 52... Line 51...
52
		rafraichir(validationDatas);
51
		masquerBoutonVoter();
53
	}
52
	}
54
	
53
	
Line 66... Line 65...
66
	
65
	
67
	public HasClickHandlers getVotes() {
66
	public HasClickHandlers getVotes() {
68
		return votes;
67
		return votes;
Line -... Line 68...
-
 
68
	}
-
 
69
	
-
 
70
	public int getValeurVote() {
-
 
71
		return votes.getValue();
69
	}
72
	}
70
	
73
	
71
	public void afficherBoutonVoter() {
74
	public void afficherBoutonVoter() {
Line 72... Line 75...
72
		boutonVoter.setVisible(true);
75
		boutonVoter.setVisible(true);
Line 94... Line 97...
94
	
97
	
95
	public void reinitialiserVotes() {
98
	public void reinitialiserVotes() {
96
		votes.setValue(valeurOrigine);
99
		votes.setValue(valeurOrigine);
Line 97... Line 100...
97
	}
100
	}
98
	
-
 
99
	public void rafraichir(List<VoteProtocole> validationDatas) {
101
	
100
		
-
 
101
		int meanVote = 0;
102
	public void rafraichir(int moyenneVote, int nombreVotes) {
102
		int nbVote = 0;
103
		valeurOrigine = moyenneVote;
103
		for (VoteProtocole imageCelValidationData : validationDatas) {
-
 
104
			meanVote += imageCelValidationData.getVote();
104
		nbVotes.setText(nombreVotes+" "+I18n.getVocabulary().nbVotes());
105
			nbVote++;
-
 
106
		}
-
 
107
		if (nbVote > 0) {
105
		votes.setValue(moyenneVote);
-
 
106
	}
108
			meanVote /= nbVote;
107
 
109
		}
108
	@Override
110
		votes.setValue(nbVote);
-
 
111
		valeurOrigine = nbVote;
109
	public void ajouterAuParent(HasWidgets composite) {
112
		nbVotes.setText(String.valueOf(validationDatas.size()) + " " +I18n.getVocabulary().nbVotes());
110
		composite.add(this);