| 478 |
benjamin |
1 |
package org.tela_botanica.del.client.vues.rechercheimages.resultats.votes;
|
| 9 |
benjamin |
2 |
|
|
|
3 |
import java.util.List;
|
|
|
4 |
|
|
|
5 |
import org.cobogw.gwt.user.client.ui.Rating;
|
| 423 |
gduche |
6 |
import org.tela_botanica.del.client.i18n.I18n;
|
| 148 |
benjamin |
7 |
import org.tela_botanica.del.client.modeles.VoteProtocole;
|
| 9 |
benjamin |
8 |
|
| 66 |
gduche |
9 |
import com.google.gwt.core.client.GWT;
|
| 423 |
gduche |
10 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
11 |
import com.google.gwt.event.dom.client.ClickHandler;
|
| 629 |
aurelien |
12 |
import com.google.gwt.event.dom.client.HasChangeHandlers;
|
| 423 |
gduche |
13 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
| 66 |
gduche |
14 |
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
15 |
import com.google.gwt.uibinder.client.UiField;
|
| 423 |
gduche |
16 |
import com.google.gwt.user.client.Window;
|
|
|
17 |
import com.google.gwt.user.client.ui.Button;
|
| 9 |
benjamin |
18 |
import com.google.gwt.user.client.ui.Composite;
|
| 66 |
gduche |
19 |
import com.google.gwt.user.client.ui.FocusPanel;
|
| 423 |
gduche |
20 |
import com.google.gwt.user.client.ui.HasText;
|
| 629 |
aurelien |
21 |
import com.google.gwt.user.client.ui.HasWidgets;
|
| 66 |
gduche |
22 |
import com.google.gwt.user.client.ui.Label;
|
|
|
23 |
import com.google.gwt.user.client.ui.Widget;
|
| 9 |
benjamin |
24 |
|
| 629 |
aurelien |
25 |
public class MoyenneVoteVue extends Composite implements MoyenneVotePresenteur.Vue {
|
| 9 |
benjamin |
26 |
|
| 66 |
gduche |
27 |
// Annotation can be used to change the name of the associated xml file
|
|
|
28 |
// @UiTemplate("MoyenneVoteVue.ui.xml")
|
|
|
29 |
interface MyUiBinder extends UiBinder<Widget, MoyenneVoteVue> {
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
|
| 423 |
gduche |
33 |
private Rating votes;
|
|
|
34 |
private int valeurOrigine;
|
|
|
35 |
|
| 66 |
gduche |
36 |
@UiField
|
|
|
37 |
FocusPanel voter;
|
|
|
38 |
|
|
|
39 |
@UiField
|
|
|
40 |
Label nbVotes;
|
|
|
41 |
|
| 423 |
gduche |
42 |
@UiField
|
|
|
43 |
Button boutonVoter, boutonAnnuler;
|
|
|
44 |
|
| 629 |
aurelien |
45 |
public MoyenneVoteVue() {
|
| 66 |
gduche |
46 |
initWidget(uiBinder.createAndBindUi(this));
|
| 423 |
gduche |
47 |
votes = new Rating(0, 5);
|
|
|
48 |
votes.setReadOnly(false);
|
|
|
49 |
voter.add(votes);
|
|
|
50 |
masquerBoutonAnnuler();
|
|
|
51 |
masquerBoutonVoter();
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
public HasClickHandlers getBoutonVoter() {
|
|
|
55 |
return boutonVoter;
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
public HasClickHandlers getBoutonAnnuler() {
|
|
|
59 |
return boutonAnnuler;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
public HasText getNbVotes() {
|
|
|
63 |
return nbVotes;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
public HasClickHandlers getVotes() {
|
|
|
67 |
return votes;
|
|
|
68 |
}
|
|
|
69 |
|
| 629 |
aurelien |
70 |
public int getValeurVote() {
|
|
|
71 |
return votes.getValue();
|
|
|
72 |
}
|
|
|
73 |
|
| 423 |
gduche |
74 |
public void afficherBoutonVoter() {
|
|
|
75 |
boutonVoter.setVisible(true);
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public void afficherBoutonAnnuler() {
|
|
|
79 |
boutonAnnuler.setVisible(true);
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
public void masquerBoutonVoter() {
|
|
|
83 |
boutonVoter.setVisible(false);
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
public void masquerBoutonAnnuler() {
|
|
|
87 |
boutonAnnuler.setVisible(false);
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
public void afficherNbVotes () {
|
|
|
91 |
nbVotes.setVisible(true);
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public void masquerNbVotes () {
|
|
|
95 |
nbVotes.setVisible(false);
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
public void reinitialiserVotes() {
|
|
|
99 |
votes.setValue(valeurOrigine);
|
|
|
100 |
}
|
|
|
101 |
|
| 629 |
aurelien |
102 |
public void rafraichir(int moyenneVote, int nombreVotes) {
|
|
|
103 |
valeurOrigine = moyenneVote;
|
|
|
104 |
nbVotes.setText(nombreVotes+" "+I18n.getVocabulary().nbVotes());
|
|
|
105 |
votes.setValue(moyenneVote);
|
| 9 |
benjamin |
106 |
}
|
| 629 |
aurelien |
107 |
|
|
|
108 |
@Override
|
|
|
109 |
public void ajouterAuParent(HasWidgets composite) {
|
|
|
110 |
composite.add(this);
|
|
|
111 |
}
|
| 9 |
benjamin |
112 |
}
|