477 |
benjamin |
1 |
package org.tela_botanica.del.client.composants.observations;
|
436 |
benjamin |
2 |
|
|
|
3 |
import com.google.gwt.core.client.GWT;
|
|
|
4 |
import com.google.gwt.event.dom.client.ClickHandler;
|
1704 |
jpm |
5 |
import com.google.gwt.event.shared.HandlerRegistration;
|
436 |
benjamin |
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;
|
1041 |
benjamin |
9 |
import com.google.gwt.user.client.ui.HTML;
|
436 |
benjamin |
10 |
import com.google.gwt.user.client.ui.Image;
|
|
|
11 |
import com.google.gwt.user.client.ui.Panel;
|
|
|
12 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
13 |
|
|
|
14 |
public class ObservationImagesVue extends Composite implements ObservationImagesPresenteur.Vue {
|
|
|
15 |
|
|
|
16 |
// Gestion d'UiBinder
|
|
|
17 |
interface Binder extends UiBinder<Widget, ObservationImagesVue> {
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
private static Binder binder = GWT.create(Binder.class);
|
|
|
21 |
|
|
|
22 |
@UiField
|
|
|
23 |
protected Image photoPrincipale;
|
|
|
24 |
|
|
|
25 |
@UiField
|
|
|
26 |
protected Panel photos;
|
1041 |
benjamin |
27 |
|
1044 |
gduche |
28 |
protected HTML lienPlateforme = new HTML(">>>");
|
436 |
benjamin |
29 |
|
1704 |
jpm |
30 |
private HandlerRegistration imgPrincipaleClicGestionnaire;
|
436 |
benjamin |
31 |
|
|
|
32 |
public ObservationImagesVue() {
|
|
|
33 |
initWidget(binder.createAndBindUi(this));
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
public void chargerImagePrincipale(org.tela_botanica.del.client.modeles.Image image) {
|
444 |
aurelien |
37 |
setUrlImagePrincipale(image.getUrlFormat("CRS"));
|
436 |
benjamin |
38 |
setTitreImagePrincipale(image.getUrlFormat("L"));
|
1963 |
mathias |
39 |
setAltTextImagePrincipale(image.getObservation().getAuteur() + " - " + image.getObservation().getNomRetenu());
|
436 |
benjamin |
40 |
}
|
|
|
41 |
|
|
|
42 |
@Override
|
|
|
43 |
public void ajouterPhoto(org.tela_botanica.del.client.modeles.Image imageCourante, ClickHandler gestionnaireClic) {
|
|
|
44 |
Image photo = new Image();
|
|
|
45 |
photo.setUrl(imageCourante.getUrlFormat("CRX2S"));
|
|
|
46 |
photo.setTitle(imageCourante.getUrlFormat("L"));
|
471 |
aurelien |
47 |
photo.setAltText("");
|
436 |
benjamin |
48 |
photo.addClickHandler(gestionnaireClic);
|
|
|
49 |
getPhotos().add(photo);
|
|
|
50 |
}
|
1041 |
benjamin |
51 |
|
|
|
52 |
public void afficherLienPlateformeValidation(){
|
|
|
53 |
getPhotos().add(lienPlateforme);
|
1044 |
gduche |
54 |
lienPlateforme.setStyleName("suiteImages");
|
1041 |
benjamin |
55 |
}
|
436 |
benjamin |
56 |
|
|
|
57 |
public void setUrlImagePrincipale(String url) {
|
|
|
58 |
photoPrincipale.setUrl(url);
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
public void setTitreImagePrincipale(String titre) {
|
|
|
62 |
photoPrincipale.setTitle(titre);
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
public void setAltTextImagePrincipale(String altText) {
|
|
|
66 |
photoPrincipale.setAltText(altText);
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
public String getUrlImagePrincipale() {
|
|
|
70 |
return photoPrincipale.getUrl();
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
public String getTitreImagePrincipale() {
|
|
|
74 |
return photoPrincipale.getTitle();
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
public String getAltTextImagePrincipale() {
|
|
|
78 |
return photoPrincipale.getAltText();
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
public Image getPhotoPrincipale() {
|
|
|
82 |
return photoPrincipale;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
public Panel getPhotos() {
|
|
|
86 |
return photos;
|
|
|
87 |
}
|
|
|
88 |
|
1041 |
benjamin |
89 |
public HTML getLienPlateforme() {
|
|
|
90 |
return lienPlateforme;
|
|
|
91 |
}
|
1704 |
jpm |
92 |
|
|
|
93 |
public HandlerRegistration setImgPrincipaleClicGestionnaire(ClickHandler gestionnaireClic) {
|
|
|
94 |
if (imgPrincipaleClicGestionnaire != null) {
|
|
|
95 |
imgPrincipaleClicGestionnaire.removeHandler();
|
|
|
96 |
}
|
|
|
97 |
imgPrincipaleClicGestionnaire = photoPrincipale.addClickHandler(gestionnaireClic);
|
|
|
98 |
return imgPrincipaleClicGestionnaire;
|
|
|
99 |
}
|
1041 |
benjamin |
100 |
|
436 |
benjamin |
101 |
}
|