Line 1... |
Line 1... |
1 |
package org.tela_botanica.del.client.vues.rechercheobservations;
|
1 |
package org.tela_botanica.del.client.vues.rechercheobservations;
|
Line 2... |
Line -... |
2 |
|
- |
|
3 |
import java.util.Iterator;
|
2 |
|
Line 4... |
Line 3... |
4 |
import java.util.List;
|
3 |
import java.util.List;
|
5 |
|
4 |
|
6 |
import org.tela_botanica.del.client.cache.CacheClient;
|
- |
|
7 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
5 |
import org.tela_botanica.del.client.cache.CacheClient;
|
8 |
import org.tela_botanica.del.client.i18n.I18n;
|
6 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
9 |
import org.tela_botanica.del.client.modeles.Image;
|
- |
|
10 |
import org.tela_botanica.del.client.modeles.Observation;
|
7 |
import org.tela_botanica.del.client.modeles.Image;
|
11 |
import org.tela_botanica.del.client.modeles.PropositionDetermination;
|
8 |
import org.tela_botanica.del.client.modeles.Observation;
|
- |
|
9 |
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
|
- |
|
10 |
import org.tela_botanica.del.client.navigation.evenement.validationobservation.EvenementValidation;
|
12 |
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
|
11 |
import org.tela_botanica.del.client.vues.rechercheobservations.observationdeterminations.ObservationDeterminationPresenteur;
|
13 |
import org.tela_botanica.del.client.navigation.evenement.validationobservation.EvenementValidation;
|
12 |
import org.tela_botanica.del.client.vues.rechercheobservations.observationdeterminations.ObservationDeterminationVue;
|
Line 14... |
Line 13... |
14 |
import org.tela_botanica.del.client.vues.rechercheobservations.detail.DetailVoteObservationPresenteur;
|
13 |
import org.tela_botanica.del.client.vues.rechercheobservations.observationimages.ObservationImagesPresenteur;
|
15 |
import org.tela_botanica.del.client.vues.rechercheobservations.detail.DetailVoteObservationVue;
|
14 |
import org.tela_botanica.del.client.vues.rechercheobservations.observationimages.ObservationImagesVue;
|
16 |
|
15 |
|
17 |
import com.google.gwt.event.dom.client.ClickEvent;
|
- |
|
18 |
import com.google.gwt.event.dom.client.ClickHandler;
|
- |
|
19 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
16 |
import com.google.gwt.event.dom.client.ClickEvent;
|
20 |
import com.google.gwt.user.client.ui.HTMLPanel;
|
17 |
import com.google.gwt.event.dom.client.ClickHandler;
|
Line 21... |
Line 18... |
21 |
import com.google.gwt.user.client.ui.HasText;
|
18 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
22 |
import com.google.gwt.user.client.ui.HasWidgets;
|
19 |
import com.google.gwt.user.client.ui.HasWidgets;
|
23 |
import com.google.gwt.user.client.ui.IsWidget;
|
20 |
import com.google.gwt.user.client.ui.IsWidget;
|
24 |
|
- |
|
25 |
public class ObservationPresenteur extends Presenteur {
|
- |
|
26 |
|
- |
|
27 |
public abstract interface Vue extends IsWidget {
|
- |
|
28 |
public void ajouterPhoto(String url, String titre, String alText, ClickHandler GestionnaireClic);
|
- |
|
29 |
public HasText getAuteur();
|
- |
|
30 |
public HasText getDate();
|
- |
|
31 |
public HasText getFamille();
|
- |
|
32 |
public HasText getLocalite();
|
- |
|
33 |
public HasText getMotsClefs();
|
- |
|
34 |
public HasText getNomRetenu();
|
- |
|
35 |
public HasText getNumNomenclatural();
|
- |
|
- |
|
21 |
|
36 |
public HasClickHandlers getPhotoPrincipale();
|
- |
|
37 |
public HasWidgets getPhotos();
|
- |
|
38 |
public void setUrlImagePrincipale(String url);
|
- |
|
39 |
public void setTitreImagePrincipale(String titre);
|
- |
|
40 |
public void setAltTextImagePrincipale(String altText);
|
- |
|
41 |
public String getUrlImagePrincipale();
|
- |
|
42 |
public String getTitreImagePrincipale();
|
22 |
public class ObservationPresenteur extends Presenteur {
|
- |
|
23 |
|
- |
|
24 |
public abstract interface Vue extends IsWidget {
|
- |
|
25 |
|
- |
|
26 |
public HasClickHandlers getLienDeterminer();
|
43 |
public String getAltTextImagePrincipale();
|
27 |
|
44 |
public void setTexteTableau(int ligne, int colonne, String texte);
|
28 |
public HasWidgets getDeterminationsPanel();
|
45 |
public void setElementTableau(int ligne, int colonne, IsWidget element);
|
29 |
|
Line 46... |
Line 30... |
46 |
public HasClickHandlers getLienDeterminer();
|
30 |
public HasWidgets getImagesPanel();
|
Line 47... |
Line 31... |
47 |
}
|
31 |
}
|
Line 55... |
Line 39... |
55 |
this.vue = vue;
|
39 |
this.vue = vue;
|
56 |
chargerObservation();
|
40 |
chargerObservation();
|
57 |
}
|
41 |
}
|
Line 58... |
Line 42... |
58 |
|
42 |
|
59 |
public void chargerObservation() {
|
- |
|
60 |
HasText auteur = vue.getAuteur();
|
- |
|
61 |
auteur.setText(observation.getAuteur());
|
- |
|
62 |
vue.getDate().setText(observation.getDate());
|
- |
|
63 |
vue.getFamille().setText(observation.getFamille());
|
- |
|
64 |
vue.getLocalite().setText(observation.getLocalite());
|
43 |
public void chargerObservation() {
|
65 |
|
- |
|
66 |
List<String> motsCles = observation.getMotsClefs();
|
- |
|
67 |
Iterator<String> itMotsCles = motsCles.iterator();
|
- |
|
68 |
String motsClesChaine = "";
|
- |
|
69 |
while (itMotsCles.hasNext()) {
|
- |
|
70 |
String motCle = itMotsCles.next();
|
- |
|
71 |
motsClesChaine += motCle;
|
- |
|
72 |
if (itMotsCles.hasNext()) {
|
- |
|
73 |
motsClesChaine += ", ";
|
- |
|
74 |
}
|
- |
|
75 |
}
|
- |
|
76 |
vue.getMotsClefs().setText(motsClesChaine);
|
- |
|
77 |
vue.getNomRetenu().setText(observation.getNomRetenu());
|
- |
|
78 |
vue.getNumNomenclatural().setText(observation.getNumNomenclatural());
|
- |
|
79 |
|
- |
|
80 |
List<org.tela_botanica.del.client.modeles.Image> images = observation.getImages();
|
- |
|
81 |
|
- |
|
82 |
if (images != null && images.size() > 0) {
|
- |
|
83 |
org.tela_botanica.del.client.modeles.Image imagePrincipale = images.get(0);
|
- |
|
84 |
vue.setUrlImagePrincipale(imagePrincipale.getUrl());
|
- |
|
85 |
vue.setTitreImagePrincipale(imagePrincipale.getUrlFormat("L"));
|
44 |
|
86 |
vue.setAltTextImagePrincipale(observation.getAuteur() + " - " + observation.getNomRetenu());
|
- |
|
87 |
images.remove(0);
|
- |
|
88 |
}
|
- |
|
89 |
|
- |
|
90 |
int nbImagesAffichees = 0;
|
- |
|
91 |
for (final org.tela_botanica.del.client.modeles.Image imageCourante : images) {
|
- |
|
92 |
nbImagesAffichees++;
|
- |
|
93 |
if (nbImagesAffichees < 5) {
|
- |
|
94 |
ClickHandler gestionnaireClic = new ClickHandler() {
|
- |
|
95 |
public void onClick(ClickEvent event) {
|
- |
|
96 |
ouvrirFenetreModale(new DetailImagePresenteur(imageCourante.getUrlFormat("L"), imageCourante.getObservation().getAuteur()+ " - " + imageCourante.getObservation().getNomRetenu(), new DetailImageVue()));
|
- |
|
97 |
}
|
- |
|
98 |
};
|
- |
|
99 |
vue.ajouterPhoto(imageCourante.getUrlFormat("CRX2S"),
|
- |
|
100 |
imageCourante.getUrlFormat("L"),
|
- |
|
101 |
observation.getAuteur() + " - " + observation.getNomRetenu(),
|
- |
|
102 |
gestionnaireClic);
|
- |
|
103 |
}
|
- |
|
104 |
}
|
- |
|
105 |
|
45 |
new ObservationImagesPresenteur(new ObservationImagesVue(), observation).go(vue.getImagesPanel());
|
106 |
List<PropositionDetermination> propositions = observation.getPropositionsDetermination();
|
- |
|
107 |
int i = 0;
|
- |
|
108 |
for (PropositionDetermination proposition : propositions) {
|
- |
|
109 |
|
- |
|
110 |
HTMLPanel panneau = new HTMLPanel("");
|
- |
|
111 |
DetailVoteObservationPresenteur presenteurVote = new DetailVoteObservationPresenteur(new DetailVoteObservationVue(), proposition);
|
- |
|
112 |
presenteurVote.go(panneau);
|
- |
|
113 |
vue.setElementTableau(i, 0, panneau);
|
- |
|
114 |
vue.setTexteTableau(i, 1, String.valueOf(proposition.getListeCommentaires().size()) + " " +I18n.getVocabulary().commentaires());
|
- |
|
115 |
i++;
|
- |
|
Line 116... |
Line 46... |
116 |
}
|
46 |
new ObservationDeterminationPresenteur(new ObservationDeterminationVue(), observation.getPropositionsDetermination()).go(vue.getDeterminationsPanel());
|
117 |
|
- |
|
- |
|
47 |
|
118 |
gererEvenements();
|
48 |
gererEvenements();
|
Line 119... |
Line 49... |
119 |
// vue.propositions.setText(ch);
|
49 |
|
120 |
}
|
50 |
}
|
121 |
|
51 |
|
Line 122... |
Line 52... |
122 |
public void go(HasWidgets composite) {
|
52 |
public void go(HasWidgets composite) {
|
123 |
composite.add(vue.asWidget());
|
- |
|
124 |
}
|
- |
|
125 |
|
- |
|
126 |
protected void gererEvenements() {
|
- |
|
127 |
vue.getPhotoPrincipale().addClickHandler(new ClickHandler() {
|
- |
|
128 |
public void onClick(ClickEvent event) {
|
53 |
composite.add(vue.asWidget());
|
129 |
ouvrirFenetreModale(new DetailImagePresenteur(vue.getTitreImagePrincipale(), vue.getAltTextImagePrincipale(), new DetailImageVue()));
|
54 |
}
|
130 |
}
|
55 |
|
131 |
});
|
56 |
protected void gererEvenements() {
|
132 |
|
57 |
|
133 |
vue.getLienDeterminer().addClickHandler(new ClickHandler() {
|
58 |
vue.getLienDeterminer().addClickHandler(new ClickHandler() {
|
134 |
|
59 |
|
135 |
public void onClick(ClickEvent event) {
|
60 |
public void onClick(ClickEvent event) {
|