| 2 |
aperonnet |
1 |
package org.tela_botanica.client.observation;
|
|
|
2 |
|
| 12 |
david |
3 |
|
| 86 |
jpm |
4 |
|
| 82 |
david |
5 |
// TODO : systematiser les onQuelquechose, appelle depuis les vues
|
|
|
6 |
|
| 2 |
aperonnet |
7 |
import org.tela_botanica.client.CarnetEnLigneMediateur;
|
| 12 |
david |
8 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
9 |
import org.tela_botanica.client.modeles.ListeObservation;
|
| 2 |
aperonnet |
10 |
import org.tela_botanica.client.modeles.Observation;
|
| 66 |
david |
11 |
import org.tela_botanica.client.vues.ArbreEntiteGeographiqueObservationFiltreVue;
|
| 12 |
david |
12 |
import org.tela_botanica.client.vues.FormulaireSaisieObservationVue;
|
| 54 |
david |
13 |
import org.tela_botanica.client.vues.ImageGeneriqueVue;
|
|
|
14 |
import org.tela_botanica.client.vues.InformationRepartitionVue;
|
| 12 |
david |
15 |
import org.tela_botanica.client.vues.ListeObservationVue;
|
| 107 |
aurelien |
16 |
import org.tela_botanica.client.vues.MenuObservationVue;
|
| 94 |
jpm |
17 |
import org.tela_botanica.client.vues.MiniZoomImageVue;
|
| 54 |
david |
18 |
import org.tela_botanica.client.vues.PanneauFiltresObservationVues;
|
| 53 |
david |
19 |
import com.google.gwt.core.client.GWT;
|
| 77 |
jpm |
20 |
import com.google.gwt.user.client.Window;
|
| 41 |
jpm |
21 |
import com.gwtext.client.core.EventObject;
|
| 86 |
jpm |
22 |
import com.gwtext.client.core.Ext;
|
|
|
23 |
import com.gwtext.client.core.ExtElement;
|
| 53 |
david |
24 |
import com.gwtext.client.core.RegionPosition;
|
| 86 |
jpm |
25 |
import com.gwtext.client.widgets.Component;
|
| 12 |
david |
26 |
import com.gwtext.client.widgets.Panel;
|
| 86 |
jpm |
27 |
import com.gwtext.client.widgets.event.ContainerListener;
|
|
|
28 |
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
|
| 53 |
david |
29 |
import com.gwtext.client.widgets.layout.BorderLayout;
|
|
|
30 |
import com.gwtext.client.widgets.layout.BorderLayoutData;
|
|
|
31 |
import com.gwtext.client.widgets.layout.RowLayout;
|
| 80 |
jpm |
32 |
import com.gwtext.client.widgets.layout.RowLayoutData;
|
| 2 |
aperonnet |
33 |
|
| 48 |
david |
34 |
|
| 12 |
david |
35 |
/**
|
|
|
36 |
* Mediateur gérant les interactions entre vues et les echanges de données
|
|
|
37 |
* C'est un singleton.
|
|
|
38 |
* @author aurelien
|
|
|
39 |
*
|
|
|
40 |
*/
|
| 47 |
david |
41 |
public class ObservationMediateur {
|
| 12 |
david |
42 |
|
|
|
43 |
/**
|
|
|
44 |
* booleen qui verifie l'unicite de l'instance (donc static)
|
|
|
45 |
*/
|
| 31 |
jpm |
46 |
private static boolean estInstancie = false ;
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* pointeur sur le médiateur (pour le pattern singleton)
|
|
|
50 |
*/
|
|
|
51 |
private static ObservationMediateur thisMediateur = null ;
|
| 12 |
david |
52 |
|
|
|
53 |
/** Mediateur general de l'application carnet en ligne
|
|
|
54 |
*
|
|
|
55 |
*
|
|
|
56 |
*/
|
|
|
57 |
|
|
|
58 |
private CarnetEnLigneMediateur carnetEnLigneMediateur = null ;
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
/**
|
|
|
62 |
* modele de données
|
|
|
63 |
*/
|
|
|
64 |
private ObservationModele observationModele = null ;
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
/**
|
|
|
68 |
* panneau principal des Observation (onglet "observation")
|
|
|
69 |
*/
|
|
|
70 |
private final Panel panneauPrincipalObservation = new Panel("Observation");
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
/**
|
|
|
74 |
* liste détaillée des Observations
|
|
|
75 |
*/
|
|
|
76 |
private ListeObservationVue listeObservation = null ;
|
|
|
77 |
|
|
|
78 |
/**
|
|
|
79 |
* Saisie des Observations
|
|
|
80 |
*/
|
|
|
81 |
|
|
|
82 |
private FormulaireSaisieObservationVue formulaireSaisieObservationVue=null;
|
|
|
83 |
|
| 48 |
david |
84 |
|
|
|
85 |
|
| 12 |
david |
86 |
/**
|
|
|
87 |
* booleen explicitant s'il y a une selection en cours
|
|
|
88 |
*/
|
|
|
89 |
private boolean selection = false ;
|
| 47 |
david |
90 |
|
| 12 |
david |
91 |
|
|
|
92 |
|
|
|
93 |
/**
|
|
|
94 |
* La liste des observations affichées en cours (verifier utilité)
|
|
|
95 |
*/
|
|
|
96 |
|
|
|
97 |
private ListeObservation cacheObservation = new ListeObservation(0) ;
|
|
|
98 |
/**
|
|
|
99 |
|
|
|
100 |
|
| 53 |
david |
101 |
/**
|
|
|
102 |
* panneau conteneur pour le panneau des informations lies à l'observation
|
|
|
103 |
*/
|
| 12 |
david |
104 |
|
| 53 |
david |
105 |
private Panel details = new Panel("Détails");
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
| 12 |
david |
109 |
/**
|
| 53 |
david |
110 |
* panneau conteneur pour le panneau des filtres
|
|
|
111 |
*/
|
|
|
112 |
|
| 54 |
david |
113 |
private PanneauFiltresObservationVues filtres = null;
|
| 53 |
david |
114 |
|
|
|
115 |
|
| 54 |
david |
116 |
|
|
|
117 |
/**
|
|
|
118 |
* panneau d'information de repartition sur le nom selectionné
|
|
|
119 |
*
|
|
|
120 |
*/
|
|
|
121 |
|
|
|
122 |
private InformationRepartitionVue informationRepartitionVue=null;
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
/**
|
|
|
126 |
* panneau d'affichage d'une image generique associe au nom selectionne
|
|
|
127 |
*
|
|
|
128 |
*/
|
|
|
129 |
|
|
|
130 |
private ImageGeneriqueVue imageGeneriqueVue=null;
|
|
|
131 |
|
| 94 |
jpm |
132 |
private MiniZoomImageVue mvz = null ;
|
| 54 |
david |
133 |
|
| 94 |
jpm |
134 |
|
| 53 |
david |
135 |
/**
|
| 12 |
david |
136 |
* constructeur privé (on accède a la classe par la méthode getInstance
|
|
|
137 |
*/
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
private ObservationMediateur(CarnetEnLigneMediateur carnetEnLigneMediateur )
|
|
|
141 |
{
|
|
|
142 |
this.carnetEnLigneMediateur=carnetEnLigneMediateur;
|
|
|
143 |
|
| 53 |
david |
144 |
|
| 12 |
david |
145 |
// on crée un modèle
|
|
|
146 |
observationModele = ObservationModele.Instance(this);
|
|
|
147 |
|
|
|
148 |
|
| 48 |
david |
149 |
|
| 12 |
david |
150 |
listeObservation = new ListeObservationVue(this);
|
| 53 |
david |
151 |
listeObservation.setTitle("Observations");
|
| 12 |
david |
152 |
|
| 53 |
david |
153 |
// quelques variables de position pour les borderlayouts
|
|
|
154 |
final BorderLayoutData regionNord = new BorderLayoutData(
|
|
|
155 |
RegionPosition.NORTH);
|
|
|
156 |
|
|
|
157 |
final BorderLayoutData regionCentre = new BorderLayoutData(
|
|
|
158 |
RegionPosition.CENTER);
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
final BorderLayoutData regionEst = new BorderLayoutData(
|
|
|
162 |
RegionPosition.EAST);
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
if (GWT.isScript()) { // FIXME : ne fonctionne pas en mode hosted
|
|
|
166 |
regionEst.setSplit(true);
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
final BorderLayoutData regionOuest = new BorderLayoutData(
|
|
|
170 |
RegionPosition.WEST);
|
| 12 |
david |
171 |
|
| 53 |
david |
172 |
if (GWT.isScript()) { // FIXME : ne fonctionne pas en mode hosted
|
|
|
173 |
regionOuest.setSplit(true);
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
panneauPrincipalObservation.setLayout(new BorderLayout()) ;
|
|
|
177 |
|
|
|
178 |
|
| 12 |
david |
179 |
// Le formulaire de saisie / modification d'observation
|
|
|
180 |
|
|
|
181 |
formulaireSaisieObservationVue = new FormulaireSaisieObservationVue(this);
|
| 53 |
david |
182 |
formulaireSaisieObservationVue.setTitle("Saisie");
|
|
|
183 |
formulaireSaisieObservationVue.setTitleCollapse(true);
|
|
|
184 |
formulaireSaisieObservationVue.setCollapsible(true) ;
|
|
|
185 |
|
| 2 |
aperonnet |
186 |
|
| 53 |
david |
187 |
Panel centre = new Panel();
|
| 55 |
jpm |
188 |
centre.setLayout(new RowLayout()) ;
|
| 80 |
jpm |
189 |
|
|
|
190 |
centre.setHeight(panneauPrincipalObservation.getHeight()) ;
|
| 12 |
david |
191 |
|
| 105 |
aurelien |
192 |
centre.add(formulaireSaisieObservationVue, new RowLayoutData()) ;
|
|
|
193 |
centre.add(listeObservation, new RowLayoutData("60%"));
|
| 2 |
aperonnet |
194 |
|
| 53 |
david |
195 |
// on initialise le volet qui contient les details
|
|
|
196 |
details.setWidth("15%");
|
|
|
197 |
details.setTitleCollapse(true);
|
|
|
198 |
details.setCollapsible(true);
|
| 54 |
david |
199 |
details.setLayout(new RowLayout());
|
| 53 |
david |
200 |
|
| 54 |
david |
201 |
|
|
|
202 |
|
|
|
203 |
// Information de repartition
|
|
|
204 |
informationRepartitionVue=new InformationRepartitionVue(this);
|
|
|
205 |
// TODO : calcul de la hauteur automatique par le panel ?
|
|
|
206 |
informationRepartitionVue.setHeight(160);
|
|
|
207 |
details.add(informationRepartitionVue);
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
// Image generique
|
|
|
211 |
imageGeneriqueVue=new ImageGeneriqueVue(this);
|
|
|
212 |
// TODO : calcul de la hauteur automatique par le panel ?
|
|
|
213 |
|
|
|
214 |
imageGeneriqueVue.setHeight(160);
|
|
|
215 |
details.add(imageGeneriqueVue);
|
|
|
216 |
|
| 94 |
jpm |
217 |
mvz = new MiniZoomImageVue(this) ;
|
|
|
218 |
mvz.setHeight(300) ;
|
| 54 |
david |
219 |
|
| 94 |
jpm |
220 |
details.add(mvz) ;
|
|
|
221 |
|
| 54 |
david |
222 |
// on crée le panneau des filtres
|
|
|
223 |
filtres = new PanneauFiltresObservationVues(this);
|
|
|
224 |
|
|
|
225 |
// on initialise le volet qui contient les filtres
|
| 60 |
jpm |
226 |
filtres.setWidth("15%");
|
| 99 |
jpm |
227 |
filtres.setHeight(700) ;
|
| 53 |
david |
228 |
filtres.setTitleCollapse(true);
|
|
|
229 |
filtres.setCollapsible(true);
|
| 54 |
david |
230 |
|
| 53 |
david |
231 |
panneauPrincipalObservation.add(details,regionEst);
|
|
|
232 |
panneauPrincipalObservation.add(filtres,regionOuest);
|
|
|
233 |
panneauPrincipalObservation.add(centre,regionCentre);
|
|
|
234 |
|
| 12 |
david |
235 |
}
|
| 2 |
aperonnet |
236 |
|
| 7 |
aperonnet |
237 |
|
| 12 |
david |
238 |
/**
|
|
|
239 |
* Retourne une instance de manière unique
|
|
|
240 |
* @return l'instance unique du médiateur
|
|
|
241 |
*/
|
|
|
242 |
public static ObservationMediateur Instance(CarnetEnLigneMediateur carnetEnLigneMediateur)
|
|
|
243 |
{
|
| 31 |
jpm |
244 |
if(!estInstancie || thisMediateur == null)
|
| 12 |
david |
245 |
{
|
|
|
246 |
estInstancie = true ;
|
| 31 |
jpm |
247 |
thisMediateur = new ObservationMediateur(carnetEnLigneMediateur) ;
|
| 12 |
david |
248 |
}
|
| 31 |
jpm |
249 |
|
| 82 |
david |
250 |
|
| 31 |
jpm |
251 |
return thisMediateur ;
|
| 12 |
david |
252 |
}
|
| 82 |
david |
253 |
|
| 12 |
david |
254 |
|
|
|
255 |
|
| 82 |
david |
256 |
// ACTIONS a entreprendre lors d'un evenement particulier
|
| 12 |
david |
257 |
|
| 82 |
david |
258 |
|
| 12 |
david |
259 |
/**
|
| 82 |
david |
260 |
* Lors du raffraichissement de la liste d'observation
|
|
|
261 |
*/
|
|
|
262 |
|
|
|
263 |
|
|
|
264 |
public void onRafraichissementListeObservations() {
|
|
|
265 |
|
|
|
266 |
cacheObservation = listeObservation.getCacheListeObservation() ;
|
|
|
267 |
if(cacheObservation.size() == 0)
|
|
|
268 |
{
|
| 104 |
jpm |
269 |
formulaireSaisieObservationVue.raz() ;
|
| 82 |
david |
270 |
}
|
| 104 |
jpm |
271 |
carnetEnLigneMediateur.donneesRafraichies(cacheObservation) ;
|
| 82 |
david |
272 |
}
|
|
|
273 |
|
|
|
274 |
/**
|
|
|
275 |
*
|
|
|
276 |
* TODO : fonction plus generique, appelle sur un clic ou une selection de ligne, a appeller : SelectionnerObservation
|
|
|
277 |
* est appelé lors d'un clic de souris sur un enregistrement de la liste le
|
|
|
278 |
* médiateur gère alors les conséquences
|
|
|
279 |
*
|
|
|
280 |
* @param rowIndex
|
|
|
281 |
* le numéro de ligne selectionné
|
|
|
282 |
*/
|
|
|
283 |
|
|
|
284 |
public void onClicListeObservation(int rowIndex, String ordreObservation) {
|
|
|
285 |
|
|
|
286 |
Observation obs = cacheObservation.get(ordreObservation) ;
|
|
|
287 |
|
| 105 |
aurelien |
288 |
if(GWT.isScript()) {
|
|
|
289 |
masquerChargementInfosObservations() ;
|
|
|
290 |
}
|
| 86 |
jpm |
291 |
|
| 82 |
david |
292 |
// Affichage de la carte de repartition correspondante
|
|
|
293 |
String numeroNomenclaturalSaisiObservation = obs.getNumeroNomenclaturalSaisi() ;
|
|
|
294 |
|
|
|
295 |
observationModele.obtenirImageInformationRepartition(informationRepartitionVue,numeroNomenclaturalSaisiObservation) ;
|
| 105 |
aurelien |
296 |
|
| 82 |
david |
297 |
// affichage des détails dans le formulaire d'observation
|
|
|
298 |
formulaireSaisieObservationVue.rafraichir(obs, false) ;
|
|
|
299 |
// Affichage de l'image correspondante
|
|
|
300 |
|
|
|
301 |
observationModele.obtenirImageGenerique(imageGeneriqueVue,numeroNomenclaturalSaisiObservation) ;
|
| 94 |
jpm |
302 |
|
|
|
303 |
observationModele.obtenirLiaisonImage(mvz, ordreObservation) ;
|
| 82 |
david |
304 |
|
|
|
305 |
|
|
|
306 |
}
|
|
|
307 |
|
|
|
308 |
|
|
|
309 |
// ACCES au Modèle
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
// C du CRUD
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
|
316 |
/**
|
|
|
317 |
* TODO : afficher un message du type "observation ajouté".
|
|
|
318 |
* Lance la creation d'une observation
|
|
|
319 |
* @param obs : l'observation saisie
|
| 104 |
jpm |
320 |
*/
|
| 82 |
david |
321 |
public void ajouterObservation(Observation obs) {
|
| 104 |
jpm |
322 |
|
| 82 |
david |
323 |
// On raffraichi la liste d'observation
|
|
|
324 |
observationModele.ajouterObservation(listeObservation, obs) ;
|
| 91 |
jpm |
325 |
filtres.getArbreEntiteGeographiqueObservationFiltreVue().rafraichir(obs,true) ;
|
| 94 |
jpm |
326 |
filtres.getArbreDateObservationFiltreVue().rafraichir(obs,true) ;
|
| 82 |
david |
327 |
|
|
|
328 |
}
|
|
|
329 |
|
|
|
330 |
|
|
|
331 |
|
|
|
332 |
// R du CRUD
|
|
|
333 |
|
|
|
334 |
/**
|
| 54 |
david |
335 |
* Demande au modele le nombre d'Observation à afficher
|
|
|
336 |
* TODO : grouper cette demande avec la demande d'affichage de liste ?
|
| 12 |
david |
337 |
*/
|
| 2 |
aperonnet |
338 |
|
| 12 |
david |
339 |
public void obtenirNombreObservation() {
|
|
|
340 |
|
| 104 |
jpm |
341 |
mvz.raz() ;
|
|
|
342 |
imageGeneriqueVue.raz() ;
|
|
|
343 |
informationRepartitionVue.raz() ;
|
|
|
344 |
observationModele.obtenirNombreObservation(listeObservation) ;
|
| 12 |
david |
345 |
|
| 2 |
aperonnet |
346 |
}
|
| 54 |
david |
347 |
|
| 12 |
david |
348 |
|
| 82 |
david |
349 |
|
|
|
350 |
public void obtenirListeObservation() {
|
|
|
351 |
obtenirListeObservation(listeObservation);
|
|
|
352 |
}
|
|
|
353 |
|
| 2 |
aperonnet |
354 |
/**
|
| 82 |
david |
355 |
* Demande au modele le detail des Observations à afficher
|
| 54 |
david |
356 |
* TODO : grouper cette demande avec la demande d'affichage de liste ?
|
| 2 |
aperonnet |
357 |
*/
|
| 7 |
aperonnet |
358 |
|
| 12 |
david |
359 |
|
| 61 |
jpm |
360 |
public void obtenirListeObservation(Rafraichissable r) {
|
|
|
361 |
|
| 77 |
jpm |
362 |
listeObservation.masquerChargement() ;
|
| 104 |
jpm |
363 |
formulaireSaisieObservationVue.raz() ;
|
| 61 |
jpm |
364 |
observationModele.obtenirListeObservation(r,listeObservation.getTaillePage(),listeObservation.getPageEncours()) ;
|
|
|
365 |
}
|
|
|
366 |
|
| 86 |
jpm |
367 |
public void obtenirCacheObservation(Rafraichissable r) {
|
|
|
368 |
|
|
|
369 |
r.rafraichir(cacheObservation, false) ;
|
|
|
370 |
}
|
|
|
371 |
|
| 82 |
david |
372 |
|
| 2 |
aperonnet |
373 |
/**
|
| 82 |
david |
374 |
* Envoie au modèle une demande pour obtenir l'arbre des localites
|
|
|
375 |
*
|
|
|
376 |
* @param r
|
|
|
377 |
* le raffraichissable qui a demandé la mise à jour
|
| 2 |
aperonnet |
378 |
*/
|
| 82 |
david |
379 |
public void obtenirListeEntiteGeographique() {
|
| 12 |
david |
380 |
|
| 91 |
jpm |
381 |
observationModele.obtenirListeEntiteGeographique(filtres.getArbreEntiteGeographiqueObservationFiltreVue());
|
| 12 |
david |
382 |
|
|
|
383 |
}
|
| 82 |
david |
384 |
|
|
|
385 |
|
|
|
386 |
// U du CRUD
|
|
|
387 |
|
|
|
388 |
|
| 2 |
aperonnet |
389 |
|
| 54 |
david |
390 |
|
| 82 |
david |
391 |
public void modifierObservation(Observation obs) {
|
|
|
392 |
|
| 12 |
david |
393 |
|
| 82 |
david |
394 |
// On raffraichi la liste d'observation
|
|
|
395 |
observationModele.modifierObservation(listeObservation, obs) ;
|
| 91 |
jpm |
396 |
filtres.getArbreEntiteGeographiqueObservationFiltreVue().rafraichir(obs,true) ;
|
| 82 |
david |
397 |
|
|
|
398 |
}
|
| 12 |
david |
399 |
|
| 82 |
david |
400 |
|
|
|
401 |
|
|
|
402 |
// D du CRUD
|
|
|
403 |
|
|
|
404 |
|
| 94 |
jpm |
405 |
|
| 54 |
david |
406 |
/**
|
| 82 |
david |
407 |
* TODO : afficher un message du type "observation modifie".
|
|
|
408 |
* Lance la modification d'une observation
|
|
|
409 |
* @param obs : l'observation a modifier
|
| 54 |
david |
410 |
*/
|
|
|
411 |
|
| 82 |
david |
412 |
|
|
|
413 |
|
|
|
414 |
public void supprimerObservation(Rafraichissable r, String numeroOrdre) {
|
|
|
415 |
|
|
|
416 |
if(listeObservation.getSelectionModel().getCount() > 0)
|
|
|
417 |
{
|
|
|
418 |
if(Window.confirm("Êtes vous sur de vouloir supprimer cette observation ?")) {
|
|
|
419 |
observationModele.supprimerObservation(r,numeroOrdre) ;
|
|
|
420 |
}
|
|
|
421 |
}
|
|
|
422 |
|
| 2 |
aperonnet |
423 |
}
|
| 12 |
david |
424 |
|
| 82 |
david |
425 |
// Assistants de saisie
|
| 2 |
aperonnet |
426 |
/**
|
| 13 |
david |
427 |
*
|
|
|
428 |
* Lance un appel de recherche d'une liste de commune correspondant aux criteres de selectionne
|
|
|
429 |
* @param r : la vue demandeuse de donnee
|
|
|
430 |
* @param critere : les criteres de selection
|
|
|
431 |
*/
|
| 12 |
david |
432 |
|
| 13 |
david |
433 |
public void obtenirListeReferentielCommune(Rafraichissable r, String critere) {
|
| 12 |
david |
434 |
|
| 13 |
david |
435 |
observationModele.obtenirListeReferentielCommune(r,critere) ;
|
| 2 |
aperonnet |
436 |
|
| 12 |
david |
437 |
|
| 2 |
aperonnet |
438 |
}
|
| 20 |
david |
439 |
|
| 82 |
david |
440 |
|
|
|
441 |
|
| 20 |
david |
442 |
/**
|
|
|
443 |
*
|
|
|
444 |
* Lance un appel de recherche d'une liste de nom scientifique correspondant aux criteres de selectionne
|
|
|
445 |
* @param r : la vue demandeuse de donnee
|
|
|
446 |
* @param critere : les criteres de selection
|
|
|
447 |
*/
|
|
|
448 |
|
|
|
449 |
public void obtenirListeReferentielNom(Rafraichissable r, String critere) {
|
| 2 |
aperonnet |
450 |
|
| 94 |
jpm |
451 |
observationModele.obtenirListeReferentielNom(r,critere) ;
|
| 20 |
david |
452 |
}
|
| 82 |
david |
453 |
|
|
|
454 |
// Etat du syteme
|
|
|
455 |
|
| 20 |
david |
456 |
/**
|
| 82 |
david |
457 |
* C'est dans cette fonction que doivent être renvoyé les valeurs des filtres
|
|
|
458 |
* sous forme de tableau [nom, valeur]
|
|
|
459 |
* @return Les noms et valeurs des filtres
|
| 20 |
david |
460 |
*/
|
| 82 |
david |
461 |
public String[][] renvoyerFiltres()
|
|
|
462 |
{
|
| 91 |
jpm |
463 |
String[] filtresEntitesGeo = filtres.getArbreEntiteGeographiqueObservationFiltreVue().renvoyerValeursAFiltrer() ;
|
|
|
464 |
String chaineNomsFiltresGeo = filtresEntitesGeo[0] ;
|
|
|
465 |
String chaineValFiltresGeo = filtresEntitesGeo[1] ;
|
| 87 |
jpm |
466 |
|
| 91 |
jpm |
467 |
String[] filtresDate = filtres.getArbreDateObservationFiltreVue().renvoyerValeursAFiltrer() ;
|
|
|
468 |
String chaineNomsFiltresDate = filtresDate[0] ;
|
|
|
469 |
String chaineValFiltresDate = filtresDate[1] ;
|
|
|
470 |
|
|
|
471 |
String chaineNomsFiltres = chaineNomsFiltresGeo+","+chaineNomsFiltresDate ;
|
|
|
472 |
String chaineValFiltres = chaineValFiltresGeo+","+chaineValFiltresDate ;
|
|
|
473 |
|
| 87 |
jpm |
474 |
String[] nomsFiltres = chaineNomsFiltres.split(",") ;
|
|
|
475 |
String[] valsFiltres = chaineValFiltres.split(",") ;
|
| 91 |
jpm |
476 |
|
|
|
477 |
String [][] valeursFiltres = new String[nomsFiltres.length][2] ;
|
| 94 |
jpm |
478 |
|
|
|
479 |
listeObservation.afficherFiltres(chaineValFiltresGeo, chaineValFiltresDate) ;
|
| 91 |
jpm |
480 |
|
|
|
481 |
|
| 87 |
jpm |
482 |
if(nomsFiltres.length > 0)
|
|
|
483 |
{
|
|
|
484 |
|
| 89 |
jpm |
485 |
for(int i = 0 ; i < nomsFiltres.length ; i++)
|
| 87 |
jpm |
486 |
{
|
|
|
487 |
valeursFiltres[i][0] = nomsFiltres[i] ;
|
|
|
488 |
if(valsFiltres[i].equals("Inconnue"))
|
|
|
489 |
{
|
|
|
490 |
valeursFiltres[i][1] = "000null" ;
|
|
|
491 |
}
|
|
|
492 |
else
|
|
|
493 |
{
|
|
|
494 |
valeursFiltres[i][1] = valsFiltres[i] ;
|
|
|
495 |
}
|
|
|
496 |
}
|
|
|
497 |
|
|
|
498 |
return valeursFiltres ;
|
|
|
499 |
}
|
|
|
500 |
else
|
|
|
501 |
{
|
|
|
502 |
return valeursFiltres ;
|
|
|
503 |
}
|
| 20 |
david |
504 |
}
|
| 82 |
david |
505 |
|
| 41 |
jpm |
506 |
|
| 54 |
david |
507 |
/**
|
| 82 |
david |
508 |
* Retourne l'identifiant de l'utilisateur connecte
|
|
|
509 |
* @return : identifiant de l'utilisateur connecte
|
| 74 |
david |
510 |
*/
|
| 82 |
david |
511 |
public String getIdentifiant() {
|
| 74 |
david |
512 |
|
| 82 |
david |
513 |
return carnetEnLigneMediateur.getUtilisateur().getIdentifiant();
|
| 74 |
david |
514 |
|
| 77 |
jpm |
515 |
}
|
| 82 |
david |
516 |
|
|
|
517 |
|
| 74 |
david |
518 |
/**
|
| 54 |
david |
519 |
*
|
| 82 |
david |
520 |
* @return
|
| 54 |
david |
521 |
*
|
|
|
522 |
*/
|
|
|
523 |
|
| 82 |
david |
524 |
public Panel getPanneauPrincipalObservation() {
|
|
|
525 |
return panneauPrincipalObservation;
|
|
|
526 |
}
|
| 54 |
david |
527 |
|
|
|
528 |
|
| 41 |
jpm |
529 |
public void montrerContextMenu(EventObject e) {
|
|
|
530 |
|
| 107 |
aurelien |
531 |
MenuObservationVue mvo = new MenuObservationVue(this) ;
|
|
|
532 |
mvo.showAt(e.getXY()) ;
|
| 41 |
jpm |
533 |
|
|
|
534 |
}
|
|
|
535 |
|
|
|
536 |
public void doubleClicListeObservation(int rowIndex) {
|
|
|
537 |
|
|
|
538 |
|
|
|
539 |
}
|
|
|
540 |
|
| 54 |
david |
541 |
|
| 82 |
david |
542 |
|
|
|
543 |
// Getters
|
|
|
544 |
|
| 54 |
david |
545 |
public PanneauFiltresObservationVues getPanneauFiltres() {
|
|
|
546 |
|
|
|
547 |
return filtres;
|
|
|
548 |
|
|
|
549 |
}
|
| 86 |
jpm |
550 |
|
|
|
551 |
public void masquerChargementInfosObservations()
|
|
|
552 |
{
|
|
|
553 |
ExtElement masked = Ext.get(details.getId());
|
| 54 |
david |
554 |
|
| 86 |
jpm |
555 |
if (masked != null && !masked.isMasked()) {
|
|
|
556 |
informationRepartitionVue.raz() ;
|
|
|
557 |
imageGeneriqueVue.raz() ;
|
|
|
558 |
masked.mask("Chargement", true);
|
|
|
559 |
}
|
|
|
560 |
}
|
| 82 |
david |
561 |
|
| 86 |
jpm |
562 |
public void deMasquerChargementInfosObservations()
|
|
|
563 |
{
|
|
|
564 |
ExtElement masked = Ext.get(details.getId());
|
| 63 |
jpm |
565 |
|
| 86 |
jpm |
566 |
if (masked != null && masked.isMasked()) {
|
|
|
567 |
masked.unmask() ;
|
|
|
568 |
}
|
|
|
569 |
}
|
| 91 |
jpm |
570 |
|
|
|
571 |
|
|
|
572 |
public void obtenirDatesObservation() {
|
|
|
573 |
|
|
|
574 |
observationModele.obtenirDatesObservation(filtres.getArbreDateObservationFiltreVue()) ;
|
|
|
575 |
|
|
|
576 |
}
|
| 101 |
jpm |
577 |
|
|
|
578 |
|
|
|
579 |
public void exporterObservations() {
|
|
|
580 |
|
|
|
581 |
observationModele.exporterObservations() ;
|
|
|
582 |
|
|
|
583 |
}
|
| 104 |
jpm |
584 |
|
|
|
585 |
|
|
|
586 |
public void deconnecterUtilisateur() {
|
|
|
587 |
|
|
|
588 |
listeObservation.raz() ;
|
|
|
589 |
formulaireSaisieObservationVue.raz() ;
|
|
|
590 |
filtres.getArbreDateObservationFiltreVue().raz() ;
|
|
|
591 |
filtres.getArbreEntiteGeographiqueObservationFiltreVue().raz() ;
|
|
|
592 |
informationRepartitionVue.raz() ;
|
|
|
593 |
imageGeneriqueVue.raz() ;
|
|
|
594 |
mvz.raz() ;
|
|
|
595 |
|
|
|
596 |
}
|
|
|
597 |
|
|
|
598 |
|
|
|
599 |
public void supprimerLiaisonObsImage() {
|
|
|
600 |
|
|
|
601 |
String idObs = listeObservation.getIdSelectionnees()[0] ;
|
|
|
602 |
String idImg = mvz.getIdImage() ;
|
|
|
603 |
|
|
|
604 |
if(Window.confirm("Supprimer le lien entre l'image "+idImg+" et l'observations "+idObs+" ?"))
|
|
|
605 |
{
|
|
|
606 |
mvz.supprimerLiaisonImage() ;
|
|
|
607 |
observationModele.supprimerLiaisonImages(idImg,idObs) ;
|
|
|
608 |
}
|
|
|
609 |
|
|
|
610 |
}
|
| 107 |
aurelien |
611 |
|
|
|
612 |
public void supprimerObservations() {
|
|
|
613 |
|
|
|
614 |
if(Window.confirm("Êtes vous sur de vouloir supprimer les observations sélectionnées ?")) {
|
|
|
615 |
String[] numObs = listeObservation.getIdSelectionnees();
|
|
|
616 |
String numObsapl = "" ;
|
|
|
617 |
for(int i = 0 ; i < numObs.length ; i++) {
|
|
|
618 |
numObsapl += numObs[i]+"," ;
|
|
|
619 |
}
|
|
|
620 |
|
|
|
621 |
observationModele.supprimerListeObservation(listeObservation,numObsapl) ;
|
|
|
622 |
}
|
|
|
623 |
|
|
|
624 |
}
|
| 12 |
david |
625 |
|
| 2 |
aperonnet |
626 |
}
|