Subversion Repositories eFlore/Applications.del

Rev

Rev 1503 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.del.client.composants.images;

import org.tela_botanica.del.client.i18n.I18n;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.dom.client.LoadHandler;
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.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class DetailImageVue extends Composite implements DetailImagePresenteur.Vue {

        // Gestion d'UiBinder
        interface Binder extends UiBinder<Widget, DetailImageVue> {
        }

        private static Binder binder = GWT.create(Binder.class);

        @UiField
        protected Image photoPrincipale;

        @UiField
        protected HTML texteAlternatif;

        public DetailImageVue() {
                initWidget(binder.createAndBindUi(this));
                photoPrincipale.addLoadHandler(new LoadHandler() {              
                        @Override
                        public void onLoad(LoadEvent event) {
                                setWidth(photoPrincipale.getWidth()+"px");
                                setHeight(photoPrincipale.getHeight()+"px");
                        }
                });
        }

        public void chargerImage(org.tela_botanica.del.client.modeles.Image imageCourante) {
                setUrlImage(imageCourante.getUrlFormat("L"));
                setTitle(imageCourante.getUrlFormat("L"));
                setTexteAlternatif("<strong> "+I18n.getVocabulary().imageNumero()+""+ imageCourante.getIdImage() +" - "+ imageCourante.getObservation().getNomRetenuFormateReferentiel() + " "  + I18n.getVocabulary().par() + " " + imageCourante.getObservation().getAuteur() + "</strong><br />"
                                + I18n.getVocabulary().publiee() + " "+ imageCourante.getObservation().getDateReleve() + " - " + imageCourante.getObservation().getLocaliteAvecIdFormatee());
        }

        public void setUrlImage(String urlImage) {
                photoPrincipale.setUrl(urlImage);
        }

        public void setTexteAlternatif(String texteAlternatif) {
                this.texteAlternatif.setHTML(texteAlternatif);
        }

}