476 |
benjamin |
1 |
package org.tela_botanica.del.client.composants.images;
|
200 |
gduche |
2 |
|
|
|
3 |
import com.google.gwt.core.client.GWT;
|
437 |
aurelien |
4 |
import com.google.gwt.event.dom.client.LoadEvent;
|
|
|
5 |
import com.google.gwt.event.dom.client.LoadHandler;
|
200 |
gduche |
6 |
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
7 |
import com.google.gwt.uibinder.client.UiField;
|
|
|
8 |
import com.google.gwt.user.client.ui.Composite;
|
575 |
gduche |
9 |
import com.google.gwt.user.client.ui.HTML;
|
200 |
gduche |
10 |
import com.google.gwt.user.client.ui.Image;
|
|
|
11 |
import com.google.gwt.user.client.ui.Label;
|
|
|
12 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
13 |
|
308 |
gduche |
14 |
public class DetailImageVue extends Composite implements DetailImagePresenteur.Vue {
|
200 |
gduche |
15 |
|
|
|
16 |
// Gestion d'UiBinder
|
|
|
17 |
interface Binder extends UiBinder<Widget, DetailImageVue> {
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
private static Binder binder = GWT.create(Binder.class);
|
|
|
21 |
|
|
|
22 |
@UiField
|
|
|
23 |
protected Image photoPrincipale;
|
|
|
24 |
|
|
|
25 |
@UiField
|
575 |
gduche |
26 |
protected HTML texteAlternatif;
|
200 |
gduche |
27 |
|
308 |
gduche |
28 |
public DetailImageVue() {
|
200 |
gduche |
29 |
initWidget(binder.createAndBindUi(this));
|
437 |
aurelien |
30 |
photoPrincipale.addLoadHandler(new LoadHandler() {
|
|
|
31 |
@Override
|
|
|
32 |
public void onLoad(LoadEvent event) {
|
|
|
33 |
setWidth(photoPrincipale.getWidth()+"px");
|
|
|
34 |
setHeight(photoPrincipale.getHeight()+"px");
|
|
|
35 |
}
|
|
|
36 |
});
|
200 |
gduche |
37 |
}
|
308 |
gduche |
38 |
|
436 |
benjamin |
39 |
public void chargerImage(org.tela_botanica.del.client.modeles.Image imageCourante) {
|
|
|
40 |
setUrlImage(imageCourante.getUrlFormat("L"));
|
|
|
41 |
setTitle(imageCourante.getUrlFormat("L"));
|
575 |
gduche |
42 |
setTexteAlternatif("<p><strong>" + imageCourante.getObservation().getNomRetenu() + " par " + imageCourante.getObservation().getAuteur() + "</strong><br />"
|
|
|
43 |
+ "PubliƩe le " + imageCourante.getObservation().getDateReleve() + " - " + imageCourante.getObservation().getLocaliteAvecIdFormatee());
|
436 |
benjamin |
44 |
}
|
|
|
45 |
|
308 |
gduche |
46 |
public void setUrlImage(String urlImage) {
|
436 |
benjamin |
47 |
photoPrincipale.setUrl(urlImage);
|
308 |
gduche |
48 |
}
|
|
|
49 |
|
|
|
50 |
public void setTexteAlternatif(String texteAlternatif) {
|
575 |
gduche |
51 |
this.texteAlternatif.setHTML(texteAlternatif);
|
308 |
gduche |
52 |
}
|
316 |
aurelien |
53 |
|
200 |
gduche |
54 |
}
|