Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 154 → Rev 155

/src/org/tela_botanica/del/client/vues/plateformedetermination/forum/ForumVue.java
1,6 → 1,5
package org.tela_botanica.del.client.vues.plateformedetermination.forum;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
18,59 → 17,48
import com.google.gwt.user.client.ui.Widget;
 
public class ForumVue extends Composite {
 
private static ForumUIiBinder uiBinder = GWT.create(ForumUIiBinder.class);
interface ForumUIiBinder extends UiBinder<Widget, ForumVue>{};
@UiField(provided = true)
 
interface ForumUIiBinder extends UiBinder<Widget, ForumVue> {
};
 
@UiField(provided = true)
HTML htmlTableau = new HTML();
public ForumVue() {
 
public ForumVue() {
initWidget(uiBinder.createAndBindUi(this));
}
 
public void chargerObservations(List<PropositionDetermination> determinations) {
String ligne = "<table>"+
"<tr>"+
"<th> "+I18n.getVocabulary().nom()+" </th>"+
"<th> "+I18n.getVocabulary().contributeur()+" </th>"+
"<th> "+I18n.getVocabulary().fiabilite()+" </th>"+
"<th> "+I18n.getVocabulary().date()+" </th>"+
"<th> "+I18n.getVocabulary().commentaire()+" </th>"+
"</tr>";
 
String ligne = "<table>" + "<tr>" + "<th> " + I18n.getVocabulary().nom() + " </th>" + "<th> " + I18n.getVocabulary().contributeur() + " </th>" + "<th> " + I18n.getVocabulary().fiabilite() + " </th>" + "<th> " + I18n.getVocabulary().date() + " </th>" + "<th> " + I18n.getVocabulary().commentaire() + " </th>" + "</tr>";
 
for (PropositionDetermination observationDetermination : determinations) {
ligne += "<tr>"+
"<td>"+observationDetermination.getEspece()+"</td>"+
"<td>"+observationDetermination.getContributeur()+"</td>"+
"<td>"+observationDetermination.getPourcentageConfiance()+"</td>"+
"<td>"+formaterDatePourForum(observationDetermination.getDate())+"</td>"+
"<td>"+creerListeCommentaireRecursive(observationDetermination.getCommentaires())+"</td>"+
"</tr>";
 
ligne += "<tr>" + "<td>" + observationDetermination.getEspece() + "</td>" + "<td>" + observationDetermination.getContributeur() + "</td>" + "<td>" + observationDetermination.getPourcentageConfiance() + "</td>" + "<td>" + formaterDatePourForum(observationDetermination.getDate()) + "</td>" + "<td>" + creerListeCommentaireRecursive(observationDetermination.getCommentaires()) + "</td>" + "</tr>";
}
ligne += "</table>";
htmlTableau.setHTML(ligne);
}
private String creerListeCommentaireRecursive(ArrayList<Commentaire> commentaires) {
 
private String creerListeCommentaireRecursive(List<Commentaire> commentaires) {
 
String commentairesHtml = "<ul class=\"liste_commentaire\">";
for (Commentaire commentaire : commentaires) {
commentairesHtml += "<li class=\"commentaire\">";
commentairesHtml += "<div class=\"commentaire_texte\">"+commentaire.getCommentaire()+"</div>";
commentairesHtml += "<span class=\"commentaire_auteur\">"+commentaire.getAuteur()+"</span>";
commentairesHtml += "<span class=\"commentaire_date\">"+formaterDatePourForum(commentaire.getDate())+"</span>";
if(commentaire.getListeCommentaires().size() != 0) {
commentairesHtml += "<div class=\"commentaire_texte\">" + commentaire.getCommentaire() + "</div>";
commentairesHtml += "<span class=\"commentaire_auteur\">" + commentaire.getAuteur() + "</span>";
commentairesHtml += "<span class=\"commentaire_date\">" + formaterDatePourForum(commentaire.getDate()) + "</span>";
if (commentaire.getListeCommentaires().size() != 0) {
commentairesHtml += creerListeCommentaireRecursive(commentaire.getListeCommentaires());
}
commentairesHtml += "</li>";
}
 
return commentairesHtml;
}
 
private String formaterDatePourForum(Date date) {
return DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(date);
}