Subversion Repositories eFlore/Applications.del

Rev

Rev 321 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

package org.tela_botanica.del.client.vues.plateformedetermination.forum;

import org.tela_botanica.del.client.i18n.I18n;
import org.tela_botanica.del.client.modeles.Commentaire;
import org.tela_botanica.del.client.modeles.PropositionDetermination;
import org.tela_botanica.del.client.vues.plateformedetermination.forum.ForumPresenteur.Vue;

import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
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.FlexTable;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;

public class ForumVue extends Composite implements Vue {

        private static ForumUIiBinder uiBinder = GWT.create(ForumUIiBinder.class);

        interface ForumUIiBinder extends UiBinder<Widget, ForumVue> {
        };

        @UiField
        FlexTable htmlTableau;

        public ForumVue() {
                initWidget(uiBinder.createAndBindUi(this));
        }

        /*
         * (non-Javadoc)
         * 
         * @see org.tela_botanica.del.client.vues.plateformedetermination.forum.Vue#
         * initialiserEntetesTableau()
         */
        @Override
        public void initialiserEntetesTableau() {

                htmlTableau.setHTML(1, 1, I18n.getVocabulary().nom());
                htmlTableau.setHTML(1, 2, I18n.getVocabulary().contributeur());
                htmlTableau.setHTML(1, 3, I18n.getVocabulary().fiabilite());
                htmlTableau.setHTML(1, 4, I18n.getVocabulary().date());
                htmlTableau.setHTML(1, 5, I18n.getVocabulary().commentaire());
        }

        @Override
        public void ajouterLigne(PropositionDetermination determination, IsWidget barreRepartition, IsWidget arbreCommentaires) {

                int ligne = htmlTableau.getRowCount() + 1;
                htmlTableau.setWidget(ligne, 1, barreRepartition);
                htmlTableau.setHTML(ligne, 2, determination.getAuteur());
                htmlTableau.setHTML(ligne, 4, DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(determination.getDate()));
                htmlTableau.setWidget(ligne, 5, arbreCommentaires);
        }

        public void ajouterLigne(Commentaire commentaire, IsWidget arbreCommentaires) {

                int ligne = htmlTableau.getRowCount() + 1;
                htmlTableau.setHTML(ligne, 2, commentaire.getAuteur());
                htmlTableau.setHTML(ligne, 4, DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(commentaire.getDate()));
                htmlTableau.setWidget(ligne, 5, arbreCommentaires);
        }

        @Override
        public FlexTable getTable() {
                return htmlTableau;
        }
}