1196 |
gduche |
1 |
package org.tela_botanica.del.client.composants.forum.interventions;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.del.client.composants.forum.interventions.ForumInterventionPresenteur.Vue;
|
|
|
4 |
import org.tela_botanica.del.client.modeles.Commentaire;
|
|
|
5 |
import org.tela_botanica.del.client.modeles.PropositionDetermination;
|
|
|
6 |
|
|
|
7 |
import com.google.gwt.core.client.GWT;
|
|
|
8 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
|
|
9 |
import com.google.gwt.event.dom.client.HasMouseOutHandlers;
|
|
|
10 |
import com.google.gwt.event.dom.client.HasMouseOverHandlers;
|
|
|
11 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
|
|
12 |
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
13 |
import com.google.gwt.uibinder.client.UiField;
|
|
|
14 |
import com.google.gwt.user.client.ui.Composite;
|
|
|
15 |
import com.google.gwt.user.client.ui.FocusPanel;
|
|
|
16 |
import com.google.gwt.user.client.ui.HTML;
|
|
|
17 |
import com.google.gwt.user.client.ui.HTMLPanel;
|
|
|
18 |
import com.google.gwt.user.client.ui.HasWidgets;
|
|
|
19 |
import com.google.gwt.user.client.ui.Hyperlink;
|
|
|
20 |
import com.google.gwt.user.client.ui.IsWidget;
|
|
|
21 |
import com.google.gwt.user.client.ui.Label;
|
|
|
22 |
import com.google.gwt.user.client.ui.Panel;
|
|
|
23 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
24 |
|
|
|
25 |
public class ForumInterventionVue extends Composite implements Vue {
|
|
|
26 |
|
|
|
27 |
private static ForumUIiBinder uiBinder = GWT.create(ForumUIiBinder.class);
|
|
|
28 |
|
|
|
29 |
interface ForumUIiBinder extends UiBinder<Widget, ForumInterventionVue> {
|
|
|
30 |
};
|
|
|
31 |
|
|
|
32 |
@UiField
|
|
|
33 |
FocusPanel proposition;
|
|
|
34 |
|
|
|
35 |
@UiField
|
|
|
36 |
Label nom, nomTaxon, date, commentaire, repondre, labelDeterminationProposee;
|
|
|
37 |
|
|
|
38 |
@UiField
|
|
|
39 |
HTMLPanel voter, zoneVoter, zoneDetermination, zoneEnfants;
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
@UiField
|
|
|
43 |
FocusPanel conteneurLienSuppression;
|
|
|
44 |
|
|
|
45 |
@UiField
|
|
|
46 |
HTML supprimer, nbVotesHtml;
|
|
|
47 |
|
|
|
48 |
@UiField
|
|
|
49 |
FocusPanel conteneurPanneauVotes;
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
public ForumInterventionVue() {
|
|
|
53 |
initWidget(uiBinder.createAndBindUi(this));
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
@Override
|
|
|
57 |
public HasClickHandlers getLienSuppression() {
|
|
|
58 |
return conteneurLienSuppression;
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
@Override
|
|
|
62 |
public void afficherLienSuppression() {
|
|
|
63 |
conteneurLienSuppression.removeStyleName("invisible");
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
@Override
|
|
|
67 |
public void cacherLienSuppression() {
|
|
|
68 |
conteneurLienSuppression.addStyleName("invisible");
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
@Override
|
|
|
72 |
public void ajouterInterventionDetermination(PropositionDetermination determination, IsWidget barreRepartition, IsWidget arbreCommentaires) {
|
|
|
73 |
|
|
|
74 |
nom.setText(determination.getAuteur());
|
|
|
75 |
nomTaxon.setText(determination.getEspece());
|
|
|
76 |
|
|
|
77 |
voter.add(barreRepartition);
|
|
|
78 |
|
|
|
79 |
date.setText(DateTimeFormat.getFormat("dd/MM/yyyy").format(determination.getDate()));
|
|
|
80 |
|
|
|
81 |
commentaire.setText(determination.getCommentaire());
|
|
|
82 |
|
|
|
83 |
if (determination.estFils()) {
|
|
|
84 |
proposition.setStyleName("enfant");
|
|
|
85 |
}
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
@Override
|
|
|
89 |
public void ajouterInterventionCommentaire(Commentaire nouveauCommentaire, IsWidget arbreCommentaires) {
|
|
|
90 |
|
|
|
91 |
zoneVoter.setVisible(false);
|
|
|
92 |
zoneDetermination.setVisible(false);
|
|
|
93 |
|
|
|
94 |
nom.setText(nouveauCommentaire.getAuteur());
|
|
|
95 |
|
|
|
96 |
date.setText(DateTimeFormat.getFormat("dd/MM/yyyy").format(nouveauCommentaire.getDate()));
|
|
|
97 |
|
|
|
98 |
commentaire.setText(nouveauCommentaire.getCommentaire());
|
|
|
99 |
|
|
|
100 |
if (nouveauCommentaire.estFils()) {
|
|
|
101 |
proposition.setStyleName("enfant");
|
|
|
102 |
}
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
@Override
|
|
|
106 |
public HasClickHandlers getRepondre() {
|
|
|
107 |
return repondre;
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
@Override
|
|
|
111 |
public HasWidgets getEnfants() {
|
|
|
112 |
|
|
|
113 |
return zoneEnfants;
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
@Override
|
|
|
117 |
public HasMouseOverHandlers getConteneurInterventionMouseOver() {
|
|
|
118 |
return proposition;
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
@Override
|
|
|
122 |
public HasMouseOutHandlers getConteneurInterventionMouseOut() {
|
|
|
123 |
return proposition;
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
public HasClickHandlers getEspece() {
|
|
|
127 |
return nomTaxon;
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
public void ajouterLienEspece() {
|
|
|
131 |
nomTaxon.addStyleName("labelLien");
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
public HasClickHandlers getAuteur() {
|
|
|
135 |
return nom;
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
public void ajouterLienAuteur() {
|
|
|
139 |
nom.addStyleName("lien");
|
|
|
140 |
nom.setTitle("Voir le profil");
|
|
|
141 |
}
|
|
|
142 |
|
|
|
143 |
public void cacherDeterminationProposee() {
|
|
|
144 |
labelDeterminationProposee.setVisible(false);
|
|
|
145 |
}
|
|
|
146 |
|
|
|
147 |
@Override
|
|
|
148 |
public void ajouterLienVotes() {
|
|
|
149 |
conteneurPanneauVotes.addStyleName("nombreVotes");
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
public void masquerLienVotes() {
|
|
|
153 |
conteneurPanneauVotes.removeStyleName("nombreVotes");
|
|
|
154 |
nbVotesHtml.setVisible(false);
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
@Override
|
|
|
158 |
public void setNbVotes(int votes) {
|
|
|
159 |
nbVotesHtml.setText(String.valueOf(votes));
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
public HasClickHandlers getZoneNbVotes() {
|
|
|
163 |
return this.conteneurPanneauVotes;
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
}
|