5,17 → 5,35 |
import org.cobogw.gwt.user.client.ui.Rating; |
import org.tela_botanica.del.client.modeles.ObservationValidation; |
|
import com.google.gwt.core.client.GWT; |
import com.google.gwt.uibinder.client.UiBinder; |
import com.google.gwt.uibinder.client.UiField; |
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.HTML; |
import com.google.gwt.user.client.ui.HorizontalPanel; |
import com.google.gwt.user.client.ui.FocusPanel; |
import com.google.gwt.user.client.ui.Label; |
import com.google.gwt.user.client.ui.Panel; |
import com.google.gwt.user.client.ui.VerticalPanel; |
import com.google.gwt.user.client.ui.Widget; |
|
public class MoyenneVoteVue extends Composite { |
|
// Annotation can be used to change the name of the associated xml file |
// @UiTemplate("MoyenneVoteVue.ui.xml") |
interface MyUiBinder extends UiBinder<Widget, MoyenneVoteVue> { |
} |
|
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class); |
|
private Panel mainPanel = new VerticalPanel(); |
|
@UiField |
FocusPanel voter; |
|
@UiField |
Label nbVotes; |
|
protected MoyenneVoteVue(List<ObservationValidation> validationDatas) { |
initWidget(uiBinder.createAndBindUi(this)); |
|
int meanVote = 0; |
int nbVote = 0; |
26,19 → 44,11 |
} |
if (nbVote > 0) |
meanVote /= nbVote; |
|
Panel ratePanel = new HorizontalPanel(); |
Rating rating = new Rating(meanVote, 5); |
rating.setReadOnly(true); |
voter.add(rating); |
|
ratePanel.add(new HTML("Moyenne: ")); |
ratePanel.add(rating); |
ratePanel.add(new HTML(" Nb votes: " |
+ validationDatas.size())); |
nbVotes.setText(String.valueOf(validationDatas.size())); |
|
mainPanel.add(ratePanel); |
|
initWidget(mainPanel); |
|
} |
} |