Subversion Repositories eFlore/Applications.del

Rev

Rev 471 | Rev 575 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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

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.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 Label 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(imageCourante.getObservation().getAuteur() +
                                " - " + imageCourante.getObservation().getNomRetenu()+
                                " - " + imageCourante.getObservation().getLocaliteAvecIdFormatee()+
                                " -  "+ imageCourante.getObservation().getDateReleve());
        }

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

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

}