Line 1... |
Line 1... |
1 |
package org.tela_botanica.del.client.vues.identiplante.resultats.observations;
|
1 |
package org.tela_botanica.del.client.vues.identiplante.resultats.observations;
|
Line -... |
Line 2... |
- |
|
2 |
|
- |
|
3 |
import java.util.HashMap;
|
2 |
|
4 |
import java.util.Iterator;
|
- |
|
5 |
import java.util.List;
|
Line 3... |
Line 6... |
3 |
import java.util.List;
|
6 |
import java.util.Map;
|
4 |
|
7 |
|
5 |
import org.tela_botanica.del.client.cache.CacheClient;
|
8 |
import org.tela_botanica.del.client.cache.CacheClient;
|
6 |
import org.tela_botanica.del.client.composants.metadonnees.MetadonneesPresenteur;
|
9 |
import org.tela_botanica.del.client.composants.metadonnees.MetadonneesPresenteur;
|
Line 25... |
Line 28... |
25 |
import org.tela_botanica.del.client.composants.formulaires.formulaireproposition.FormulairePropositionPresenteur;
|
28 |
import org.tela_botanica.del.client.composants.formulaires.formulaireproposition.FormulairePropositionPresenteur;
|
26 |
import org.tela_botanica.del.client.composants.formulaires.formulaireproposition.FormulairePropositionVue;
|
29 |
import org.tela_botanica.del.client.composants.formulaires.formulaireproposition.FormulairePropositionVue;
|
27 |
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
|
30 |
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
|
28 |
import org.tela_botanica.del.client.services.rest.CommentaireServiceConcret;
|
31 |
import org.tela_botanica.del.client.services.rest.CommentaireServiceConcret;
|
29 |
import org.tela_botanica.del.client.services.rest.PropositionDeterminationServiceConcret;
|
32 |
import org.tela_botanica.del.client.services.rest.PropositionDeterminationServiceConcret;
|
- |
|
33 |
import org.tela_botanica.del.client.utils.StringUtils;
|
30 |
import org.tela_botanica.del.client.vues.identiplante.resultats.observationdeterminations.ObservationDeterminationPresenteur;
|
34 |
import org.tela_botanica.del.client.vues.identiplante.resultats.observationdeterminations.ObservationDeterminationPresenteur;
|
31 |
import org.tela_botanica.del.client.vues.identiplante.resultats.observationdeterminations.ObservationDeterminationVue;
|
35 |
import org.tela_botanica.del.client.vues.identiplante.resultats.observationdeterminations.ObservationDeterminationVue;
|
Line -... |
Line 36... |
- |
|
36 |
|
- |
|
37 |
import com.gargoylesoftware.htmlunit.html.Util;
|
32 |
|
38 |
import com.google.gwt.core.shared.GWT;
|
33 |
import com.google.gwt.event.dom.client.ClickEvent;
|
39 |
import com.google.gwt.event.dom.client.ClickEvent;
|
34 |
import com.google.gwt.event.dom.client.ClickHandler;
|
40 |
import com.google.gwt.event.dom.client.ClickHandler;
|
35 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
41 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
36 |
import com.google.gwt.user.client.Window;
|
42 |
import com.google.gwt.user.client.Window;
|
Line 54... |
Line 60... |
54 |
|
60 |
|
Line 55... |
Line 61... |
55 |
public void setNbCommentaires(String nbCommentaires);
|
61 |
public void setNbCommentaires(String nbCommentaires);
|
56 |
|
62 |
|
- |
|
63 |
public HasClickHandlers getBoutonAjoutCommentaire();
|
- |
|
64 |
public HasClickHandlers getBoutonPlusDeDetails();
|
- |
|
65 |
|
- |
|
66 |
public void afficherEvenementsObservation(String evenementsObs);
|
- |
|
67 |
|
- |
|
68 |
public void cacherEvenementsObservation();
|
57 |
public HasClickHandlers getBoutonAjoutCommentaire();
|
69 |
|
Line 58... |
Line 70... |
58 |
public HasClickHandlers getBoutonPlusDeDetails();
|
70 |
public void mettreEnValeurEvenementsObs();
|
Line 59... |
Line 71... |
59 |
}
|
71 |
}
|
Line 80... |
Line 92... |
80 |
new MetadonneesPresenteur(new MetadonneesVue(), observation, ModeRecherche.MODE_OBSERVATION, false).go(vue.getMetadonneesPanel());
|
92 |
new MetadonneesPresenteur(new MetadonneesVue(), observation, ModeRecherche.MODE_OBSERVATION, false).go(vue.getMetadonneesPanel());
|
81 |
observationDeterminationPresenteur = new ObservationDeterminationPresenteur(new ObservationDeterminationVue(), observation.getPropositionDeterminations());
|
93 |
observationDeterminationPresenteur = new ObservationDeterminationPresenteur(new ObservationDeterminationVue(), observation.getPropositionDeterminations());
|
82 |
observationDeterminationPresenteur.go(vue.getDeterminationsPanel());
|
94 |
observationDeterminationPresenteur.go(vue.getDeterminationsPanel());
|
83 |
vue.setNomEspece(observation.getNomRetenu());
|
95 |
vue.setNomEspece(observation.getNomRetenu());
|
84 |
vue.setNbCommentaires(observation.getNbCommentaires());
|
96 |
vue.setNbCommentaires(observation.getNbCommentaires());
|
- |
|
97 |
gererAffichageEvenementsObs();
|
85 |
gererEvenements();
|
98 |
gererEvenements();
|
86 |
}
|
99 |
}
|
Line -... |
Line 100... |
- |
|
100 |
|
- |
|
101 |
private void gererAffichageEvenementsObs() {
|
- |
|
102 |
if(!observation.getEvenementsAssocies().isEmpty()) {
|
- |
|
103 |
Map<String, Integer> nbEventsParEvent = new HashMap<String, Integer>();
|
- |
|
104 |
|
- |
|
105 |
List<String> evts = observation.getEvenementsAssocies();
|
- |
|
106 |
GWT.log("Evenements pour l'obs "+observation.getId());
|
- |
|
107 |
GWT.log(observation.getEvenementsAssocies().size()+" evenements dans la liste");
|
- |
|
108 |
for (Iterator<String> iterator = evts.iterator(); iterator.hasNext();) {
|
- |
|
109 |
String evenement = iterator.next();
|
- |
|
110 |
if(nbEventsParEvent.containsKey(evenement)) {
|
- |
|
111 |
Integer nbEvent = nbEventsParEvent.get(evenement);
|
- |
|
112 |
nbEvent++;
|
- |
|
113 |
nbEventsParEvent.put(evenement, nbEvent);
|
- |
|
114 |
GWT.log("ajout à l'évènement "+evenement+" "+(nbEvent));
|
- |
|
115 |
} else {
|
- |
|
116 |
GWT.log("nouvel évènement "+evenement);
|
- |
|
117 |
nbEventsParEvent.put(evenement, 1);
|
- |
|
118 |
}
|
- |
|
119 |
|
- |
|
120 |
GWT.log("vérif évenement "+evenement+" "+nbEventsParEvent.get(evenement));
|
- |
|
121 |
}
|
- |
|
122 |
|
- |
|
123 |
StringBuilder stb = new StringBuilder();
|
- |
|
124 |
for (Iterator<String> iterator = nbEventsParEvent.keySet().iterator(); iterator.hasNext();) {
|
- |
|
125 |
String evtNom = (String) iterator.next();
|
- |
|
126 |
stb.append(StringUtils.getCorrespondanceChaineEvenementObs(evtNom, nbEventsParEvent.get(evtNom)));
|
- |
|
127 |
if(iterator.hasNext()) {
|
- |
|
128 |
stb.append(", ");
|
- |
|
129 |
}
|
- |
|
130 |
}
|
- |
|
131 |
|
- |
|
132 |
vue.afficherEvenementsObservation(stb.toString());
|
- |
|
133 |
} else {
|
- |
|
134 |
vue.cacherEvenementsObservation();
|
- |
|
135 |
}
|
- |
|
136 |
}
|
87 |
|
137 |
|
88 |
public void go(HasWidgets composite) {
|
138 |
public void go(HasWidgets composite) {
|
89 |
composite.add(vue.asWidget());
|
139 |
composite.add(vue.asWidget());
|
Line 90... |
Line 140... |
90 |
}
|
140 |
}
|
Line 146... |
Line 196... |
146 |
}
|
196 |
}
|
Line 147... |
Line 197... |
147 |
|
197 |
|
148 |
private void ajouterPropositionDetermination(PropositionDetermination propositionDetermination) {
|
198 |
private void ajouterPropositionDetermination(PropositionDetermination propositionDetermination) {
|
149 |
observationDeterminationPresenteur.setPropositions(observation.getPropositionDeterminations());
|
199 |
observationDeterminationPresenteur.setPropositions(observation.getPropositionDeterminations());
|
- |
|
200 |
}
|
- |
|
201 |
|
- |
|
202 |
public void mettreEnValeurEvenementsObs() {
|
- |
|
203 |
vue.mettreEnValeurEvenementsObs();
|
150 |
}
|
204 |
}
|