Subversion Repositories eFlore/Applications.cel

Rev

Rev 80 | Rev 86 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80 Rev 82
Line 1... Line 1...
1
package org.tela_botanica.client.observation;
1
package org.tela_botanica.client.observation;
Line -... Line 2...
-
 
2
 
-
 
3
 
2
 
4
// TODO : systematiser les onQuelquechose, appelle depuis les vues
3
 
5
 
4
import org.tela_botanica.client.CarnetEnLigneMediateur;
6
import org.tela_botanica.client.CarnetEnLigneMediateur;
5
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
6
import org.tela_botanica.client.modeles.ListeObservation;
8
import org.tela_botanica.client.modeles.ListeObservation;
Line 14... Line 16...
14
 
16
 
15
import com.google.gwt.core.client.GWT;
17
import com.google.gwt.core.client.GWT;
16
import com.google.gwt.user.client.Window;
18
import com.google.gwt.user.client.Window;
17
import com.gwtext.client.core.EventObject;
19
import com.gwtext.client.core.EventObject;
18
import com.gwtext.client.core.RegionPosition;
-
 
19
import com.gwtext.client.data.Record;
20
import com.gwtext.client.core.RegionPosition;
20
import com.gwtext.client.widgets.Panel;
21
import com.gwtext.client.widgets.Panel;
21
import com.gwtext.client.widgets.layout.BorderLayout;
22
import com.gwtext.client.widgets.layout.BorderLayout;
22
import com.gwtext.client.widgets.layout.BorderLayoutData;
23
import com.gwtext.client.widgets.layout.BorderLayoutData;
23
import com.gwtext.client.widgets.layout.RowLayout;
24
import com.gwtext.client.widgets.layout.RowLayout;
24
import com.gwtext.client.widgets.layout.RowLayoutData;
-
 
Line 25... Line 25...
25
import com.gwtext.client.widgets.layout.VerticalLayout;
25
import com.gwtext.client.widgets.layout.RowLayoutData;
26
 
26
 
27
 
27
 
Line 233... Line 233...
233
			{
233
			{
234
				estInstancie = true ;
234
				estInstancie = true ;
235
				thisMediateur = new ObservationMediateur(carnetEnLigneMediateur) ;
235
				thisMediateur = new ObservationMediateur(carnetEnLigneMediateur) ;
236
			}
236
			}
Line -... Line 237...
-
 
237
			
237
			
238
	
238
			return thisMediateur ;	
239
			return thisMediateur ;	
-
 
240
	}
-
 
241
 
-
 
242
	
-
 
243
	
-
 
244
	// ACTIONS  a entreprendre lors d'un evenement particulier 
-
 
245
	
-
 
246
	
-
 
247
	/**
-
 
248
	 * Lors du raffraichissement de la liste d'observation  
Line -... Line 249...
-
 
249
	 */
-
 
250
	
-
 
251
	
-
 
252
	public void onRafraichissementListeObservations() {
-
 
253
		
-
 
254
		obtenirListeEntiteGeographique();
-
 
255
		
-
 
256
		
-
 
257
		cacheObservation = listeObservation.getCacheListeObservation() ;
-
 
258
		if(cacheObservation.size() == 0)
-
 
259
		{
-
 
260
			formulaireSaisieObservationVue.viderChampsObservation() ;
-
 
261
		}
-
 
262
		carnetEnLigneMediateur.donneesRafraichies(cacheObservation) ;
-
 
263
 
-
 
264
		
-
 
265
	}
-
 
266
	
-
 
267
	/**
-
 
268
	 * 
-
 
269
	 * TODO : fonction plus generique, appelle sur un clic ou une selection de ligne, a appeller : SelectionnerObservation 
-
 
270
	 * est appelé lors d'un clic de souris sur un enregistrement de la liste le
-
 
271
	 * médiateur gère alors les conséquences
-
 
272
	 * 
-
 
273
	 * @param rowIndex
-
 
274
	 *            le numéro de ligne selectionné
-
 
275
	 */
-
 
276
	
-
 
277
	public void onClicListeObservation(int rowIndex, String ordreObservation) {
-
 
278
	
-
 
279
		
-
 
280
		Observation obs = cacheObservation.get(ordreObservation) ;
-
 
281
		
-
 
282
		// Affichage de la carte de repartition correspondante
-
 
283
		String numeroNomenclaturalSaisiObservation = obs.getNumeroNomenclaturalSaisi() ;
-
 
284
		
-
 
285
		observationModele.obtenirImageInformationRepartition(informationRepartitionVue,numeroNomenclaturalSaisiObservation) ;
-
 
286
 
-
 
287
		// affichage des détails dans le formulaire d'observation
-
 
288
		formulaireSaisieObservationVue.rafraichir(obs, false) ;
-
 
289
 
-
 
290
		// Affichage de l'image correspondante
-
 
291
				
-
 
292
		observationModele.obtenirImageGenerique(imageGeneriqueVue,numeroNomenclaturalSaisiObservation) ;
-
 
293
 
-
 
294
 
-
 
295
	}
-
 
296
	
-
 
297
	
-
 
298
 
-
 
299
 
-
 
300
	
-
 
301
	// ACCES au Modèle 
-
 
302
	
-
 
303
	
-
 
304
	// C du CRUD 
-
 
305
	
-
 
306
	
-
 
307
	
-
 
308
	/**
-
 
309
	 * TODO : afficher un message du type "observation ajouté".  
-
 
310
	 * Lance la creation d'une observation
-
 
311
	 * @param obs : l'observation saisie
-
 
312
	 */
-
 
313
	
-
 
314
	
-
 
315
	
-
 
316
	public void ajouterObservation(Observation obs) {
-
 
317
	
-
 
318
		
-
 
319
	  // On raffraichi la liste d'observation 
-
 
320
	  observationModele.ajouterObservation(listeObservation, obs) ;
-
 
321
		
-
 
322
	}
-
 
323
	
Line 239... Line 324...
239
	}
324
	
240
	
325
	
241
	
326
	// R du CRUD 
242
	
327
	
Line 251... Line 336...
251
		  observationModele.obtenirNombreObservation(listeObservation) ;
336
		  observationModele.obtenirNombreObservation(listeObservation) ;
Line 252... Line 337...
252
		
337
		
Line -... Line 338...
-
 
338
	}
-
 
339
 
-
 
340
	
-
 
341
	
-
 
342
	public void obtenirListeObservation() {
253
	}
343
		obtenirListeObservation(listeObservation);
254
 
344
	}
255
	
345
	
256
	/**
-
 
257
	 * Demande au modele le detail  dess Observations à afficher
346
	/**
Line 258... Line -...
258
	 * TODO : grouper cette demande avec la demande d'affichage de liste ? 
-
 
259
	 * @param r : la vue demandeuse de donnee
-
 
260
	 */
-
 
261
 
-
 
262
 
-
 
263
	public void obtenirListeObservation() {
-
 
264
		
-
 
265
		listeObservation.masquerChargement() ;
-
 
Line 266... Line 347...
266
		formulaireSaisieObservationVue.viderChampsObservation() ;
347
	 * Demande au modele le detail  des Observations à afficher
Line 267... Line 348...
267
		observationModele.obtenirListeObservation(listeObservation,listeObservation.getTaillePage(),listeObservation.getPageEncours()) ;
348
	 * TODO : grouper cette demande avec la demande d'affichage de liste ? 
268
			
349
	 */
269
	}	
350
 
270
	
351
	
Line -... Line 352...
-
 
352
	public void obtenirListeObservation(Rafraichissable r) {
271
	public void obtenirListeObservation(Rafraichissable r) {
353
		
272
		
354
		listeObservation.masquerChargement() ;
-
 
355
		formulaireSaisieObservationVue.viderChampsObservation() ;
273
		listeObservation.masquerChargement() ;
356
		observationModele.obtenirListeObservation(r,listeObservation.getTaillePage(),listeObservation.getPageEncours()) ;
274
		formulaireSaisieObservationVue.viderChampsObservation() ;
357
	}
275
		observationModele.obtenirListeObservation(r,listeObservation.getTaillePage(),listeObservation.getPageEncours()) ;
358
	
276
	}
359
 
277
	
-
 
278
	/**
-
 
Line -... Line 360...
-
 
360
	/**
Line 279... Line -...
279
	 * C'est dans cette fonction que doivent être renvoyé les valeurs des filtres
-
 
280
	 * sous forme de tableau [nom, valeur]
361
	 * Envoie au modèle une demande pour obtenir l'arbre des localites
-
 
362
	 * 
281
	 * @return Les noms et valeurs des filtres
363
	 * @param r
-
 
364
	 *            le raffraichissable qui a demandé la mise à jour
-
 
365
	 */
-
 
366
	public void obtenirListeEntiteGeographique() {
Line 282... Line -...
282
	 */
-
 
283
	public String[][] renvoyerFiltres()
-
 
284
	{
-
 
285
		String[][] valeursFiltres = { {"",""} } ;
-
 
286
		
367
		
287
		
-
 
288
		return valeursFiltres ;
-
 
Line -... Line 368...
-
 
368
		observationModele.obtenirListeEntiteGeographique(filtres.getarbreEntiteGeographiqueObservationFiltreVue());
-
 
369
		
-
 
370
	}
-
 
371
	
289
	}
372
	
-
 
373
	// U du CRUD
290
 
374
	
-
 
375
	
-
 
376
 
-
 
377
	
291
 
378
	public void modifierObservation(Observation obs) {
292
	
379
	
293
	/**
-
 
-
 
380
		
-
 
381
	  // On raffraichi la liste d'observation 
294
	 * Retourne l'identifiant de l'utilisateur connecte
382
	  observationModele.modifierObservation(listeObservation, obs) ;
295
	 * @return : identifiant de l'utilisateur connecte
-
 
296
	 */
383
		
Line -... Line 384...
-
 
384
	}
-
 
385
	
-
 
386
	
-
 
387
	
297
	public String getIdentifiant() {
388
	// D du CRUD
-
 
389
	
-
 
390
	
298
		
391
	/**
-
 
392
	 * TODO : afficher un message du type "observation modifie".  
-
 
393
	 * Lance la modification d'une observation
-
 
394
	 * @param obs : l'observation a modifier
299
		return carnetEnLigneMediateur.getUtilisateur().getIdentifiant();
395
	 */
Line -... Line 396...
-
 
396
	
-
 
397
	
-
 
398
	
Line -... Line 399...
-
 
399
	public void supprimerObservation(Rafraichissable r, String numeroOrdre) {
300
	
400
		
301
	}
-
 
302
 
401
		if(listeObservation.getSelectionModel().getCount() > 0)
303
 
402
		{
304
	/**
403
			if(Window.confirm("Êtes vous sur de vouloir supprimer cette observation ?")) {
305
	 * 
404
			observationModele.supprimerObservation(r,numeroOrdre) ;
306
	 * @return
405
			}
Line 326... Line 425...
326
		observationModele.obtenirListeReferentielCommune(r,critere) ;
425
		observationModele.obtenirListeReferentielCommune(r,critere) ;
Line 327... Line 426...
327
 
426
 
Line -... Line 427...
-
 
427
		
-
 
428
	}
328
		
429
	
329
	}
430
	
330
	
431
	
331
	/**
432
	/**
332
	 *  
433
	 *  
Line 339... Line 440...
339
		
440
		
Line 340... Line 441...
340
		observationModele.obtenirListeReferentielNom(r,critere) ;
441
		observationModele.obtenirListeReferentielNom(r,critere) ;
341
 
-
 
342
		
-
 
343
	}
-
 
344
 
-
 
345
	
-
 
346
	/**
-
 
347
	 * TODO : afficher un message du type "observation ajouté".  
-
 
Line -... Line 442...
-
 
442
 
-
 
443
		
Line 348... Line 444...
348
	 * Lance la creation d'une observation
444
	}
Line -... Line 445...
-
 
445
	
-
 
446
	
-
 
447
 
-
 
448
 
-
 
449
	
-
 
450
	// Etat du syteme
-
 
451
	
-
 
452
	/**
Line 349... Line -...
349
	 * @param obs : l'observation saisie
-
 
350
	 */
-
 
Line -... Line 453...
-
 
453
	 * C'est dans cette fonction que doivent être renvoyé les valeurs des filtres
351
	
454
	 * sous forme de tableau [nom, valeur]
352
	
-
 
353
	
455
	 * @return Les noms et valeurs des filtres
Line 354... Line 456...
354
	public void ajouterObservation(Observation obs) {
456
	 */
355
	
-
 
356
		
457
	public String[][] renvoyerFiltres()
357
	  // On raffraichi la liste d'observation 
458
	{
358
	  observationModele.ajouterObservation(listeObservation, obs) ;
459
		String[][] valeursFiltres = { {"",""} } ;
359
		
-
 
360
	}
-
 
361
	
-
 
362
	
460
		
363
	
-
 
364
	/**
-
 
365
	 * TODO : afficher un message du type "observation modifie".  
-
 
366
	 * Lance la modification d'une observation
-
 
Line 367... Line -...
367
	 * @param obs : l'observation a modifier
-
 
-
 
461
		
Line 368... Line -...
368
	 */
-
 
369
	
-
 
370
	
-
 
371
	
-
 
372
	public void modifierObservation(Observation obs) {
-
 
373
	
-
 
374
		
-
 
375
	  // On raffraichi la liste d'observation 
-
 
376
	  observationModele.modifierObservation(listeObservation, obs) ;
-
 
377
		
462
		return valeursFiltres ;
378
	}
463
	}
379
	
464
 
380
	public void supprimerObservation(Rafraichissable r, String numeroOrdre) {
465
	
381
		
466
	/**
382
		if(listeObservation.getSelectionModel().getCount() > 0)
-
 
383
		{
-
 
384
			if(Window.confirm("Êtes vous sur de vouloir supprimer cette observation ?")) {
467
	 * Retourne l'identifiant de l'utilisateur connecte
385
			observationModele.supprimerObservation(r,numeroOrdre) ;
468
	 * @return : identifiant de l'utilisateur connecte
386
			}
-
 
387
		}
-
 
388
		
469
	 */
Line 389... Line 470...
389
	}
470
	public String getIdentifiant() {
-
 
471
		
-
 
472
		return carnetEnLigneMediateur.getUtilisateur().getIdentifiant();
Line 390... Line -...
390
	
-
 
391
	
-
 
392
	/**
-
 
393
	 * 
-
 
394
	 * TODO : fonction plus generique, appelle sur un clic ou une selection de ligne, a appeller : SelectionnerObservation 
-
 
395
	 * est appelé lors d'un clic de souris sur un enregistrement de la liste le
-
 
396
	 * médiateur gère alors les conséquences
-
 
Line 397... Line -...
397
	 * 
-
 
398
	 * @param rowIndex
-
 
Line 399... Line -...
399
	 *            le numéro de ligne selectionné
-
 
400
	 */
-
 
401
	
-
 
Line 402... Line -...
402
	public void clicListeObservation(int rowIndex, String ordreObservation) {
-
 
403
	
-
 
404
		
-
 
Line 405... Line 473...
405
		Observation obs = cacheObservation.get(ordreObservation) ;
473
	
Line 433... Line 501...
433
		
501
		
Line -... Line 502...
-
 
502
		
-
 
503
	}
-
 
504
 
434
		
505
 
Line 435... Line 506...
435
	}
506
	
Line 436... Line 507...
436
 
507
	// Getters 
Line 437... Line -...
437
 
-
 
438
	public PanneauFiltresObservationVues getPanneauFiltres() {
-
 
439
		
-
 
440
		return filtres;
-
 
441
		
-
 
442
	}
-
 
443
 
-
 
444
 
-
 
445
	/**
-
 
446
	 * Envoie au modèle une demande pour obtenir l'arbre des localites
-
 
447
	 * 
-
 
Line 448... Line 508...
448
	 * @param r
508
	
449
	 *            le raffraichissable qui a demandé la mise à jour
-
 
450
	 */
-
 
451
	public void obtenirListeEntiteGeographique() {
-
 
452
		
-
 
453
		observationModele.obtenirListeEntiteGeographique(filtres.getarbreEntiteGeographiqueObservationFiltreVue());
-
 
Line 454... Line -...
454
		
-
 
455
	}
-
 
456
 
-
 
457
 
-
 
458
	public void donneesRafraichies(Object nouvelleDonnees) {
-
 
459
		
-
 
460
		carnetEnLigneMediateur.donneesRafraichies(nouvelleDonnees) ;
-
 
461
		
-
 
462
	}
-
 
463
 
-
 
464
 
-
 
Line 465... Line 509...
465
	public void rafraichirCacheObservation(Object nouvelleDonnees) {
509
	public PanneauFiltresObservationVues getPanneauFiltres() {