Subversion Repositories eFlore/Applications.cel

Rev

Rev 251 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 251 Rev 318
Line 20... Line 20...
20
import org.tela_botanica.client.modeles.ListeObservation;
20
import org.tela_botanica.client.modeles.ListeObservation;
21
import org.tela_botanica.client.modeles.ListeObservationAsynchroneDAO;
21
import org.tela_botanica.client.modeles.ListeObservationAsynchroneDAO;
22
import org.tela_botanica.client.modeles.ListeReferentielCommuneAsynchroneDAO;
22
import org.tela_botanica.client.modeles.ListeReferentielCommuneAsynchroneDAO;
23
import org.tela_botanica.client.modeles.ListeReferentielNomAsynchroneDAO;
23
import org.tela_botanica.client.modeles.ListeReferentielNomAsynchroneDAO;
24
import org.tela_botanica.client.modeles.MotsClesAsynchroneDAO;
24
import org.tela_botanica.client.modeles.MotsClesAsynchroneDAO;
25
import org.tela_botanica.client.modeles.MotsClesObsAsynchronesDAO;
-
 
26
import org.tela_botanica.client.modeles.NomRetenuAsynchroneDao;
25
import org.tela_botanica.client.modeles.NomRetenuAsynchroneDao;
27
import org.tela_botanica.client.modeles.NombreObservationAsynchroneDAO;
26
import org.tela_botanica.client.modeles.NombreObservationAsynchroneDAO;
28
import org.tela_botanica.client.modeles.Observation;
27
import org.tela_botanica.client.modeles.Observation;
29
import org.tela_botanica.client.modeles.ObservationAsynchroneDAO;
28
import org.tela_botanica.client.modeles.ObservationAsynchroneDAO;
30
import org.tela_botanica.client.modeles.TransmissionObservationAsynchroneDAO;
29
import org.tela_botanica.client.modeles.TransmissionObservationAsynchroneDAO;
31
import org.tela_botanica.client.vues.observation.ListeObservationVue;
30
import org.tela_botanica.client.vues.observation.ListeObservationVue;
Line 32... Line 31...
32
 
31
 
33
import com.google.gwt.json.client.JSONArray;
32
import com.google.gwt.json.client.JSONArray;
34
import com.google.gwt.json.client.JSONObject;
33
import com.google.gwt.json.client.JSONObject;
-
 
34
import com.google.gwt.maps.client.geom.LatLng;
35
import com.google.gwt.maps.client.geom.LatLng;
35
import com.google.gwt.user.client.Window;
36
import com.gwtext.client.data.Node;
36
import com.gwtext.client.data.Node;
37
import com.gwtext.client.data.Tree;
37
import com.gwtext.client.data.Tree;
38
import com.gwtext.client.widgets.map.LatLonPoint;
38
import com.gwtext.client.widgets.map.LatLonPoint;
Line 130... Line 130...
130
		 	criteres = observationMediateur.renvoyerFiltres() ;			
130
		 	criteres = observationMediateur.renvoyerFiltres() ;			
131
			// on rassemble les critères
131
			// on rassemble les critères
Line 132... Line 132...
132
			
132
			
133
			
-
 
134
			// on les crée un DAO auquel on les transmet et qui demande le nombre d'images correspondantes (pour les pages)
133
			
135
			
134
			// on les crée un DAO auquel on les transmet et qui demande le nombre d'images correspondantes (pour les pages)
Line 136... Line 135...
136
			NombreObservationAsynchroneDAO noaDAO = new NombreObservationAsynchroneDAO(this) ;
135
			NombreObservationAsynchroneDAO noaDAO = new NombreObservationAsynchroneDAO(this) ;
Line 368... Line 367...
368
		TransmissionObservationAsynchroneDAO toaDAO = new TransmissionObservationAsynchroneDAO(this);
367
		TransmissionObservationAsynchroneDAO toaDAO = new TransmissionObservationAsynchroneDAO(this);
369
		toaDAO.transmettreObservations(r, observationMediateur.getIdentifiant(), numObsapl, publier);
368
		toaDAO.transmettreObservations(r, observationMediateur.getIdentifiant(), numObsapl, publier);
Line 370... Line 369...
370
		
369
		
Line 371... Line -...
371
	}
-
 
372
 
-
 
373
	public void obtenirNuageMotsCles(Rafraichissable r) {
-
 
374
		
-
 
375
		MotsClesObsAsynchronesDAO mcoaDAO = new MotsClesObsAsynchronesDAO(this);
-
 
376
		mcoaDAO.obtenirMotsClesObservations(r);
-
 
377
		
-
 
378
	}
-
 
379
 
-
 
380
 
-
 
381
 
-
 
382
	public void ajouterMotsCles(Rafraichissable r,
-
 
383
			String numObsApl, String motsAAjouter) {
-
 
384
		
-
 
385
		MotsClesObsAsynchronesDAO moadDAO = new MotsClesObsAsynchronesDAO(this);
-
 
386
		moadDAO.ajouterMotsCles(r,numObsApl,motsAAjouter);
-
 
387
		
-
 
388
	}
-
 
389
 
-
 
390
 
370
	}
Line 391... Line 371...
391
 
371
 
392
	public void analyserHistorique(Rafraichissable r,String anum) {
372
	public void analyserHistorique(Rafraichissable r,String anum) {
Line 424... Line 404...
424
 
404
 
425
			// si le tableau est vide
405
			// si le tableau est vide
426
			if (taillemax == 0) {
406
			if (taillemax == 0) {
427
				// on crée un arbre vide
407
				// on crée un arbre vide
428
				TreeNode root = new TreeNode();
408
				TreeNode root = new TreeNode();
429
				root.setId("racine");
409
				root.setId("racine_obs");
430
				root.setText("Tags");
410
				root.setText("Tags");
431
				String[] usObj = { "Tags", "racine" };
411
				String[] usObj = { "Tags", "racine_obs" };
432
				root.setUserObject(usObj);
412
				root.setUserObject(usObj);
433
				arbreMotsCles.setRootNode(root);
413
				arbreMotsCles.setRootNode(root);
Line 434... Line 414...
434
			}
414
			}
Line 448... Line 428...
448
 
428
 
Line 449... Line 429...
449
					String[] usObj = { mot_cle, id_noeud };
429
					String[] usObj = { mot_cle, id_noeud };
450
 
430
 
451
					// et on construit l'arbre à partir de la racine (qui est
431
					// et on construit l'arbre à partir de la racine (qui est
452
					// toujoursl e premier élément)
432
					// toujoursl e premier élément)
453
					if (id_noeud.equals("racine")) {
433
					if (id_noeud.equals("racine_obs")) {
454
						TreeNode root = new TreeNode();
434
						TreeNode root = new TreeNode();
455
						root.setId(id_noeud);
435
						root.setId(id_noeud);
456
						root.setText(mot_cle);
436
						root.setText(mot_cle);
Line 468... Line 448...
468
						node.setUserObject(usObj);
448
						node.setUserObject(usObj);
469
						parentNode.appendChild(node);
449
						parentNode.appendChild(node);
470
					}
450
					}
471
				}
451
				}
472
			}
452
			}
-
 
453
			
473
			// enfin on met à jour l'arbre des mots clés contenu dans le modèle
454
			// enfin on met à jour l'arbre des mots clés contenu dans le modèle
474
			rafraichirArbreMotsCles(arbreMotsCles);
455
			//rafraichirArbreMotsCles(arbreMotsCles);
475
			// et on notifie le médiateur de la mise à jour en lui passant une
456
			// et on notifie le médiateur de la mise à jour en lui passant une
476
			// copie des données
457
			// copie des données
477
			observationMediateur.rafraichirArbreMotsCles(arbreMotsCles);
458
			observationMediateur.rafraichirArbreMotsCles(arbreMotsCles);
478
		}
459
		}
Line 484... Line 465...
484
	 * 
465
	 * 
485
	 * @param o
466
	 * @param o
486
	 *            le nouvel arbre de mots clés
467
	 *            le nouvel arbre de mots clés
487
	 */
468
	 */
488
	public void rafraichirArbreMotsCles(Object o) {
469
	public void rafraichirArbreMotsCles(Object o) {
489
		observationMediateur.transmettreDonnees(o);
-
 
490
		arbreMotsCles = (com.gwtext.client.data.Tree) o;
470
		arbreMotsCles = (com.gwtext.client.data.Tree) o;
491
	}
471
	}
Line 492... Line 472...
492
 
472
 
493
	/**
473
	/**
Line 528... Line 508...
528
	 * @param motsClesEnCours
508
	 * @param motsClesEnCours
529
	 *            les mots clés à appliquer aux images
509
	 *            les mots clés à appliquer aux images
530
	 * @param arbreMC
510
	 * @param arbreMC
531
	 *            l'arbre de mots clés en cours
511
	 *            l'arbre de mots clés en cours
532
	 */
512
	 */
533
	public void mettreAjourMotsCles(String[] ids, String motsClesEnCours,
513
	public void mettreAjourMotsCles(String motsClesEnCours, String[] idsObsALier) {
534
			com.gwtext.client.data.Tree arbreMC) {
-
 
535
		for (int i = 0; i < ids.length; i++) {
514
		for (int i = 0; i < idsObsALier.length; i++) {
536
			if (cacheObservation.containsKey(ids[i])) {
515
			if (cacheObservation.containsKey(idsObsALier[i])) {
537
				Observation o = (Observation) cacheObservation.get(ids[i]);
516
				Observation o = (Observation) cacheObservation.get(idsObsALier[i]);
538
				o.setMotsCles(motsClesEnCours);
517
				o.setMotsCles(motsClesEnCours);
Line 539... Line 518...
539
 
518
 
540
				ObservationAsynchroneDAO oDao = new ObservationAsynchroneDAO(this);
519
				ObservationAsynchroneDAO oDao = new ObservationAsynchroneDAO(this);
541
				oDao.modifier(this,observationMediateur.getIdentifiant(),o);
520
				oDao.modifier(this,observationMediateur.getIdentifiant(),o);
542
			}
521
			}
543
		}
-
 
544
 
-
 
545
		rafraichirArbreMotsCles(arbreMC);
522
		}
Line 546... Line 523...
546
	}
523
	}
547
	
524
	
548
	/**
525
	/**
Line 567... Line 544...
567
			String[] parentUsObj = (String[]) n.getParentNode().getUserObject();
544
			String[] parentUsObj = (String[]) n.getParentNode().getUserObject();
568
			parentId = parentUsObj[1];
545
			parentId = parentUsObj[1];
569
		} else {
546
		} else {
570
			parentId = "racine";
547
			parentId = "racine";
571
		}
548
		}
572
 
549
		
573
		rafraichirArbreMotsCles(arbreMC);
550
		rafraichirArbreMotsCles(arbreMC);
Line 574... Line 551...
574
 
551
 
575
		String nouveauMotCle = "&identifiant=" + getIdentifiant() + "&motcle="
552
		String nouveauMotCle = "&identifiant=" + getIdentifiant() + "&motcle="
576
				+ motCle + "&id=" + id + "&parent=" + parentId;
553
				+ motCle + "&id=" + id + "&parent=" + parentId;
Line 590... Line 567...
590
 
567
 
Line 591... Line 568...
591
		MotsClesAsynchroneDAO MCDao = new MotsClesAsynchroneDAO(this);
568
		MotsClesAsynchroneDAO MCDao = new MotsClesAsynchroneDAO(this);
592
 
569
 
-
 
570
		String[] usObj = (String[]) n.getUserObject();
-
 
571
		String id = usObj[1];
Line 593... Line 572...
593
		String[] usObj = (String[]) n.getUserObject();
572
		
Line 594... Line 573...
594
		String id = usObj[1];
573
		rafraichirArbreMotsCles(arbreMC);
Line 650... Line 629...
650
			String[] parentUsObj = (String[]) n.getParentNode().getUserObject();
629
			String[] parentUsObj = (String[]) n.getParentNode().getUserObject();
651
			parentId = parentUsObj[1];
630
			parentId = parentUsObj[1];
652
		} else {
631
		} else {
653
			parentId = "racine";
632
			parentId = "racine";
654
		}
633
		}
655
 
634
		
656
		rafraichirArbreMotsCles(arbreMC);
635
		rafraichirArbreMotsCles(arbreMC);
Line 657... Line 636...
657
 
636
 
658
		String motCleModifie = "&motcle=" + motCle + "&id=" + id + "&parent="
637
		String motCleModifie = "&motcle=" + motCle + "&id=" + id + "&parent="
659
				+ parentId;
638
				+ parentId;