2211 |
arthur |
1 |
package org.tela_botanica.del.client.composants.votes.details;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
|
|
4 |
import org.tela_botanica.del.client.i18n.I18n;
|
|
|
5 |
import org.tela_botanica.del.client.modeles.VoteDetermination;
|
|
|
6 |
|
|
|
7 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
|
|
8 |
import com.google.gwt.user.client.ui.HasWidgets;
|
|
|
9 |
import com.google.gwt.user.client.ui.IsWidget;
|
|
|
10 |
|
|
|
11 |
public class LigneVotePresenteur extends Presenteur {
|
|
|
12 |
|
|
|
13 |
public interface Vue extends IsWidget {
|
|
|
14 |
public void setAuteur(String auteur);
|
|
|
15 |
public void setColonneDateEtNb(String date);
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
private Vue vue;
|
|
|
19 |
private VoteDetermination vote;
|
|
|
20 |
|
|
|
21 |
public LigneVotePresenteur(Vue vue, VoteDetermination vote) {
|
|
|
22 |
this.vue = vue;
|
|
|
23 |
this.vote = vote;
|
|
|
24 |
afficherProposition();
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
//Pour les votes anonymes
|
|
|
28 |
public LigneVotePresenteur(Vue vue, int nbVotes) {
|
|
|
29 |
this.vue = vue;
|
|
|
30 |
vue.setAuteur(I18n.getMessages().etVotesAnonymes(String.valueOf(nbVotes)));
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
public void afficherProposition() {
|
|
|
35 |
String nomAuteur = vote.getAuteur().getNomComplet();
|
|
|
36 |
if (nomAuteur == null || nomAuteur.equals("")) {
|
|
|
37 |
nomAuteur = I18n.getVocabulary().utilisateurAnonyme();
|
|
|
38 |
}
|
|
|
39 |
vue.setAuteur(nomAuteur);
|
|
|
40 |
vue.setColonneDateEtNb(DateTimeFormat.getFormat("dd/MM/yyyy").format(vote.getDate()));
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* Declenchement du présenteur
|
|
|
45 |
*/
|
|
|
46 |
public void go(HasWidgets container) {
|
|
|
47 |
container.add(vue.asWidget());
|
|
|
48 |
gererEvenements();
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
protected void gererEvenements() {
|
|
|
53 |
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|