Subversion Repositories eFlore/Applications.del

Rev

Rev 14 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 66
Line 3... Line 3...
3
import java.util.List;
3
import java.util.List;
Line 4... Line 4...
4
 
4
 
5
import org.cobogw.gwt.user.client.ui.Rating;
5
import org.cobogw.gwt.user.client.ui.Rating;
Line -... Line 6...
-
 
6
import org.tela_botanica.del.client.modeles.ObservationValidation;
-
 
7
 
-
 
8
import com.google.gwt.core.client.GWT;
6
import org.tela_botanica.del.client.modeles.ObservationValidation;
9
import com.google.gwt.uibinder.client.UiBinder;
7
 
10
import com.google.gwt.uibinder.client.UiField;
8
import com.google.gwt.user.client.ui.Composite;
11
import com.google.gwt.user.client.ui.Composite;
9
import com.google.gwt.user.client.ui.HTML;
12
import com.google.gwt.user.client.ui.FocusPanel;
10
import com.google.gwt.user.client.ui.HorizontalPanel;
13
import com.google.gwt.user.client.ui.Label;
-
 
14
import com.google.gwt.user.client.ui.Panel;
Line 11... Line 15...
11
import com.google.gwt.user.client.ui.Panel;
15
import com.google.gwt.user.client.ui.VerticalPanel;
Line -... Line 16...
-
 
16
import com.google.gwt.user.client.ui.Widget;
-
 
17
 
-
 
18
public class MoyenneVoteVue extends Composite {
-
 
19
 
-
 
20
	// Annotation can be used to change the name of the associated xml file
-
 
21
	// @UiTemplate("MoyenneVoteVue.ui.xml")
-
 
22
	interface MyUiBinder extends UiBinder<Widget, MoyenneVoteVue> {
12
import com.google.gwt.user.client.ui.VerticalPanel;
23
	}
Line -... Line 24...
-
 
24
 
-
 
25
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
-
 
26
 
-
 
27
	private Panel mainPanel = new VerticalPanel();
-
 
28
 
-
 
29
	@UiField
13
 
30
	FocusPanel voter;
-
 
31
 
Line 14... Line 32...
14
public class MoyenneVoteVue extends Composite {
32
	@UiField
15
 
33
	Label nbVotes;
16
	private Panel mainPanel = new VerticalPanel();
34
 
Line 17... Line 35...
17
 
35
	protected MoyenneVoteVue(List<ObservationValidation> validationDatas) {
18
	protected MoyenneVoteVue(List<ObservationValidation> validationDatas) {
36
		initWidget(uiBinder.createAndBindUi(this));
19
 
37
 
20
		int meanVote = 0;
38
		int meanVote = 0;
21
		int nbVote = 0;
39
		int nbVote = 0;
22
		for (ObservationValidation imageCelValidationData : validationDatas) {
-
 
23
 
-
 
24
			meanVote += imageCelValidationData.getVote();
40
		for (ObservationValidation imageCelValidationData : validationDatas) {
25
			nbVote++;
41
 
-
 
42
			meanVote += imageCelValidationData.getVote();
Line 26... Line -...
26
		}
-
 
27
		if (nbVote > 0)
-
 
28
			meanVote /= nbVote;
-
 
29
 
43
			nbVote++;
30
		Panel ratePanel = new HorizontalPanel();
-
 
31
		Rating rating = new Rating(meanVote, 5);
-
 
32
		rating.setReadOnly(true);
-
 
33
 
-
 
Line 34... Line 44...
34
		ratePanel.add(new HTML("Moyenne: "));
44
		}
35
		ratePanel.add(rating);
45
		if (nbVote > 0)