Subversion Repositories eFlore/Applications.cel

Rev

Rev 168 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
195 david 1
package org.tela_botanica.client.vues.observation;
54 david 2
 
90 jpm 3
import java.util.Comparator;
68 david 4
import java.util.Iterator;
5
 
54 david 6
import org.tela_botanica.client.interfaces.Filtrable;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
68 david 8
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
9
import org.tela_botanica.client.modeles.ListeEntiteGeographiqueObservation;
89 jpm 10
import org.tela_botanica.client.modeles.Observation;
54 david 11
import org.tela_botanica.client.observation.ObservationMediateur;
12
 
72 david 13
import com.google.gwt.core.client.GWT;
54 david 14
import com.gwtext.client.data.Node;
15
import com.gwtext.client.data.NodeTraversalCallback;
16
import com.gwtext.client.data.Tree;
17
import com.gwtext.client.widgets.Component;
18
import com.gwtext.client.widgets.Panel;
19
import com.gwtext.client.widgets.event.PanelListenerAdapter;
20
import com.gwtext.client.widgets.tree.TreeNode;
21
import com.gwtext.client.widgets.tree.TreePanel;
87 jpm 22
import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter;
85 jpm 23
import com.gwtext.client.widgets.tree.event.TreePanelListenerAdapter;
24
import com.gwtext.client.core.EventObject;
54 david 25
 
26
/**
27
 * fenêtre de recherche affichant l'arbre des mots clés en lecture et un bouton
28
 * cliquable
29
 *
30
 * @author aurelien
31
 *
32
 */
68 david 33
public class ArbreEntiteGeographiqueObservationFiltreVue extends Panel implements Rafraichissable,
54 david 34
		Filtrable {
35
 
36
	/**
37
	 * Le médiateur associé à la vue
38
	 */
39
	private ObservationMediateur	observationMediateur		= null;
40
 
41
	/**
42
	 * Les localites en cours
43
	 */
68 david 44
	private String entitesGeographiquesEncours = "";
54 david 45
 
46
	/**
47
	 * Le treepanel qui affiche l'arbre
48
	 */
68 david 49
	private TreePanel arbreEntitesGeographiques = null;
54 david 50
 
68 david 51
 
52
 
54 david 53
	/**
68 david 54
	 * La structure de donnees qui stocke l'arbre. Utilisee a ce niveau car trop liee a la vue
55
	 */
56
 
57
	private Tree donneeEntitesGeographiques = new Tree();;
58
 
59
	/**
54 david 60
	 * booléen d'initialisation
61
	 */
62
	private boolean estInstancie = false;
63
 
64
	/**
65
	 * booléen d'etat
66
	 */
67
	private boolean filtreModifie = false;
85 jpm 68
 
69
	private boolean arbreCharge = false ;
70
 
86 jpm 71
	private String nomFiltre = "" ;
72
 
54 david 73
	/**
74
	 * Constructeur sans argument (privé car ne doit pas être utilisé)
75
	 */
76
	@SuppressWarnings("unused")
68 david 77
	private ArbreEntiteGeographiqueObservationFiltreVue() {
54 david 78
		super();
79
	}
80
 
81
	/**
82
	 * Constructeur avec paramètres
83
	 *
84
	 * @param im
85
	 *            le médiateur à associer
86
	 */
68 david 87
	public ArbreEntiteGeographiqueObservationFiltreVue(ObservationMediateur obs) {
54 david 88
 
89
		// on crée le panel
168 aurelien 90
		super("Localités");
54 david 91
 
92
		this.observationMediateur = obs;
93
 
68 david 94
		arbreEntitesGeographiques = new TreePanel();
54 david 95
 
96
		this.setPaddings(5);
97
 
98
		this.setCollapsible(true);
99
		this.setAutoWidth(true);
128 aurelien 100
 
101
		if (GWT.isScript()) {
102
			setAutoScroll(true);
103
		}
54 david 104
 
105
 
106
		// on ajoute les listeners
107
		ajouterListenersPanel();
108
		estInstancie = false;
109
	}
110
 
111
	/**
112
	 * Ajoute les listeners pour le rendu du panel
113
	 */
114
	private void ajouterListenersPanel() {
68 david 115
		  this.addListener(new PanelListenerAdapter() {
54 david 116
 
117
			// on instancie réellement les composants au moment du rendu pour
118
			// accélérer l'affichage
119
			// et éviter des bugs
120
			public void onRender(Component component) {
121
 
122
				// on interdit le drag and drop dans l'arbre
68 david 123
				arbreEntitesGeographiques.setEnableDD(false);
73 david 124
				arbreEntitesGeographiques.setId("x-view-tree-filter-entity");
72 david 125
				arbreEntitesGeographiques.setAutoWidth(false);
54 david 126
 
127
				// on crée une racine pour l'arbre
72 david 128
				TreeNode root = new TreeNode("Localités");
70 david 129
				root.setId("racine_entite");
72 david 130
				String[] usObject = { "Localités" };
54 david 131
				root.setUserObject(usObject);
132
 
68 david 133
				arbreEntitesGeographiques.setRootNode(root);
134
				arbreEntitesGeographiques.setRootVisible(true);
135
				arbreEntitesGeographiques.setBorder(false);
85 jpm 136
				root.setExpandable(true) ;
54 david 137
 
68 david 138
				add(arbreEntitesGeographiques);
54 david 139
 
140
				// on ajoute les listeners d'évenements
141
				ajouterListeners();
142
 
143
 
144
				// enfin on considère le composant comme instancié
145
				estInstancie = true;
146
 
68 david 147
 
54 david 148
			}
149
 
150
		});
151
	}
152
 
68 david 153
 
154
 
54 david 155
	/**
70 david 156
	 * ajoute les listeners pour les boutons et le cochage des entites
54 david 157
	 */
158
	private void ajouterListeners() {
85 jpm 159
 
160
		arbreEntitesGeographiques.addListener(new TreePanelListenerAdapter() {
161
 
162
			public void onClick(TreeNode node, EventObject e) {
163
 
86 jpm 164
				nomFiltre = "" ;
87 jpm 165
				entitesGeographiquesEncours = "" ;
166
				String nomPere = "" ;
167
				String nomGrandPere = "" ;
85 jpm 168
 
169
				switch(node.getDepth())
170
				{
171
					case 0:
172
						if(!arbreCharge)
173
						{
128 aurelien 174
							arbreEntitesGeographiques.getRootNode().expand();
85 jpm 175
						}
86 jpm 176
						else
177
						{
178
							observationMediateur.obtenirNombreObservation() ;
179
						}
85 jpm 180
						return ;
87 jpm 181
					case 3: nomFiltre += "lieudit,location,id_location";
182
						nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
183
						nomGrandPere = ((String[])node.getParentNode().getParentNode().getUserObject())[0] ;
184
						entitesGeographiquesEncours += node.getText()+","+nomPere+","+nomGrandPere ;
85 jpm 185
						break;
87 jpm 186
					case 2: nomFiltre += "location,id_location";
187
						nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
188
						entitesGeographiquesEncours += node.getText()+","+nomPere ;
85 jpm 189
						break;
87 jpm 190
					case 1: nomFiltre += "id_location";
191
						entitesGeographiquesEncours += node.getText() ;
85 jpm 192
						break;
193
					default:
194
						break;
195
				}
196
 
197
				filtreModifie = true ;
86 jpm 198
				observationMediateur.obtenirNombreObservation() ;
85 jpm 199
 
200
			}
201
 
202
		}) ;
87 jpm 203
 
204
		arbreEntitesGeographiques.getRootNode().addListener(new TreeNodeListenerAdapter() {
205
 
206
			public void onExpand(Node node) {
207
				if(!arbreCharge)
208
				{
209
					observationMediateur.obtenirListeEntiteGeographique() ;
210
					arbreCharge = true ;
211
				}
212
			}
213
 
214
		}) ;
54 david 215
	}
140 aurelien 216
 
217
	public void initialiser() {
218
 
219
		arbreCharge = false ;
220
		arbreEntitesGeographiques.collapseAll();
221
		// on vide l'ancien arbre
222
		Node[] rootChild = arbreEntitesGeographiques.getRootNode().getChildNodes();
223
		for (int i = 0; i < rootChild.length; i++) {
224
 
225
			rootChild[i].remove();
226
		}
227
 
228
		arbreEntitesGeographiques.getRootNode().addListener(new TreeNodeListenerAdapter() {
229
 
230
			public void onExpand(Node node) {
231
				if(!arbreCharge)
232
				{
233
					observationMediateur.obtenirListeEntiteGeographique() ;
234
					arbreCharge = true ;
235
				}
236
			}
237
 
238
		}) ;
239
	}
54 david 240
 
241
	/**
242
	 * Méthode héritée de l'interface rafraichissable
243
	 */
244
	public void rafraichir(Object nouvelleDonnees,
245
			boolean repandreRaffraichissement) {
246
 
128 aurelien 247
 
68 david 248
		if (nouvelleDonnees instanceof ListeEntiteGeographiqueObservation) {
249
 
89 jpm 250
			String id_location=null;
251
			String location=null;
252
			String lieuDit=null;
68 david 253
 
254
			ListeEntiteGeographiqueObservation data = (ListeEntiteGeographiqueObservation) nouvelleDonnees ;
255
 
256
				// on crée un arbre vide
166 aurelien 257
				Tree nouvelArbre = new Tree() ;
68 david 258
				TreeNode root = new TreeNode();
72 david 259
				root.setId("racine_entite");
260
				root.setText("Localités");
89 jpm 261
				String[] usObjRoot = { "Localités"};
262
				root.setUserObject(usObjRoot);
166 aurelien 263
				nouvelArbre.setRootNode(root);
68 david 264
 
83 david 265
			// on la parse et on récupère les informations qui nous interessent
68 david 266
			for (Iterator<String> it= data.keySet().iterator(); it.hasNext();) {
267
 
268
				EntiteGeographiqueObservation ent=(EntiteGeographiqueObservation) data.get(it.next());
269
 
89 jpm 270
				id_location=ent.getIdLocation();
128 aurelien 271
				id_location = id_location.replaceAll("\"", "");
140 aurelien 272
				id_location = id_location.replace('\\',' ');
273
				id_location = id_location.trim();
89 jpm 274
				location=ent.getLocation();
275
				lieuDit=ent.getLieuDit();
73 david 276
 
128 aurelien 277
				if(id_location.contains("000null") || id_location.equals(null) || (id_location.trim()).equals("")) {
89 jpm 278
					id_location="Inconnue" ;
85 jpm 279
				}
73 david 280
 
128 aurelien 281
				if(location.contains("000null") || location.equals(null) || (location.trim().equals(""))) {
89 jpm 282
					location="Inconnue" ;
283
				}
68 david 284
 
128 aurelien 285
				if(lieuDit.contains("000null") || lieuDit.equals(null) || (lieuDit.trim().equals(""))) {
89 jpm 286
					lieuDit="Inconnue" ;
287
				}
288
 
166 aurelien 289
				Node noeudMemeId = nouvelArbre.getNodeById(""+id_location);
290
 
89 jpm 291
				// si la région existe déjà
292
					if(noeudMemeId != null)
293
					{
294
						// on teste si la localité existe
166 aurelien 295
						Node noeudMemeLoc = nouvelArbre.getNodeById(""+(id_location+location));
89 jpm 296
						if(noeudMemeLoc != null)
85 jpm 297
						{
89 jpm 298
							// enfin on teste si le lieu dit existe
166 aurelien 299
							Node noeudMemeLieu = nouvelArbre.getNodeById(""+(id_location+location+lieuDit));
89 jpm 300
							if(noeudMemeLieu != null)
301
							{
302
								// tous les noeuds existent déjà, normalement ça ne devrait pas arriver
303
							}
304
							else
305
							{
306
								// enfin on ne crée que le noeud du lieu dit
307
								TreeNode node_lieu = new TreeNode();
308
								node_lieu.setId(""+(id_location+location+lieuDit));
309
								node_lieu.setText(lieuDit);
310
								noeudMemeLoc.appendChild(node_lieu) ;
166 aurelien 311
								String[] usObj = {lieuDit,id_location+location+lieuDit};
89 jpm 312
								node_lieu.setUserObject(usObj);
313
							}
85 jpm 314
						}
89 jpm 315
						else
316
						{
317
							TreeNode node_loc = new TreeNode();
318
							node_loc.setId(""+(id_location+location));
319
							node_loc.setText(location);
320
							noeudMemeId.appendChild(node_loc) ;
166 aurelien 321
							String[] usObj = {location,id_location+location};
89 jpm 322
							node_loc.setUserObject(usObj);
323
 
324
							TreeNode node_lieu = new TreeNode();
325
							node_lieu.setId(""+(id_location+location+lieuDit));
326
							node_lieu.setText(lieuDit);
327
							node_loc.appendChild(node_lieu) ;
166 aurelien 328
							String[] usObj2 = {lieuDit,id_location+location+lieuDit};
89 jpm 329
							node_lieu.setUserObject(usObj2);
330
 
331
						}
68 david 332
					}
89 jpm 333
					else
334
					{
335
						TreeNode node_id_loc = new TreeNode();
336
						node_id_loc.setId(""+id_location);
337
						node_id_loc.setText(id_location);
338
						root.appendChild(node_id_loc) ;
166 aurelien 339
						String[] usObj = {id_location,id_location};
89 jpm 340
						node_id_loc.setUserObject(usObj);
341
 
342
						TreeNode node_loc = new TreeNode();
343
						node_loc.setId(""+(id_location+location));
344
						node_loc.setText(location);
345
						node_id_loc.appendChild(node_loc) ;
166 aurelien 346
						String[] usObj2 = {location,id_location+location};
89 jpm 347
						node_loc.setUserObject(usObj2);
348
 
349
						TreeNode node_lieu = new TreeNode();
350
						node_lieu.setId(""+(id_location+location+lieuDit));
351
						node_lieu.setText(lieuDit);
352
						node_loc.appendChild(node_lieu) ;
166 aurelien 353
						String[] usObj3 = {lieuDit,id_location+location+lieuDit};
89 jpm 354
						node_lieu.setUserObject(usObj3);
355
					}
109 aurelien 356
 
357
					root.sort(comparerNoeuds()) ;
358
					doLayout();
89 jpm 359
 
68 david 360
				}
361
 
89 jpm 362
				// on vide tous les noeuds
363
				arbreEntitesGeographiques.getRootNode().eachChild(new NodeTraversalCallback() {
364
 
365
					public boolean execute(Node node) {
366
 
367
						node.remove();
368
						return true;
369
					}
370
 
371
				});
166 aurelien 372
				copierFilsNoeud(root, arbreEntitesGeographiques.getRootNode());
54 david 373
 
89 jpm 374
 
375
				// si l'arbre n'était pas encore considéré comme instancié
376
				if (!estInstancie) {
377
					// on signale que oui
378
					estInstancie = true;
54 david 379
				}
89 jpm 380
 
381
				// l'état du filtre est réinitialisé
382
				filtreModifie = false;
109 aurelien 383
 
89 jpm 384
				//show() ;
166 aurelien 385
				arbreEntitesGeographiques.doLayout();
54 david 386
 
387
			}
89 jpm 388
 
389
		if(nouvelleDonnees instanceof Observation)
128 aurelien 390
		{
391
			// si l'arbre n'est pas encore chargé, on ne tient pas compte de l'ajout
392
			// l'arbre complet sera de toute façon renvoyé plus tard lors du premier chargement
393
			// de l'arbre
394
			if(!arbreCharge) {
395
				return;
396
			}
397
 
89 jpm 398
			Observation obs = (Observation)nouvelleDonnees ;
399
 
400
			String id_location= obs.getIdentifiantLocalite();
128 aurelien 401
			id_location = id_location.replaceAll("\"", "");
140 aurelien 402
			id_location = id_location.replace('\\',' ');
403
			id_location = id_location.trim();
404
 
89 jpm 405
			String location=obs.getLocalite();
406
			String lieuDit=obs.getLieudit();
407
 
408
			Node root = arbreEntitesGeographiques.getRootNode() ;
409
 
128 aurelien 410
			if(id_location.contains("000null") || id_location.equals(null) || (id_location.trim()).equals("")) {
89 jpm 411
				id_location="Inconnue" ;
412
			}
413
 
128 aurelien 414
			if(location.contains("000null") || location.equals(null) || (location.trim().equals(""))) {
89 jpm 415
				location="Inconnue" ;
416
			}
417
 
128 aurelien 418
			if(lieuDit.contains("000null") || lieuDit.equals(null) || (lieuDit.trim().equals(""))) {
89 jpm 419
				lieuDit="Inconnue" ;
420
			}
421
 
166 aurelien 422
			Node noeudMemeId = arbreEntitesGeographiques.getNodeById(""+id_location);
89 jpm 423
			// si la région existe déjà
424
				if(noeudMemeId != null)
425
				{
426
					// on teste si la localité existe
166 aurelien 427
					Node noeudMemeLoc = arbreEntitesGeographiques.getNodeById(""+(id_location+location));
89 jpm 428
					if(noeudMemeLoc != null)
429
					{
430
						// enfin on teste si le lieu dit existe
166 aurelien 431
						Node noeudMemeLieu = arbreEntitesGeographiques.getNodeById(""+(id_location+location+lieuDit));
89 jpm 432
						if(noeudMemeLieu != null)
433
						{
434
							// tous les noeuds existent déjà, normalement ça ne devrait pas arriver
435
						}
436
						else
437
						{
438
							// enfin on ne crée que le noeud du lieu dit
439
							TreeNode node_lieu = new TreeNode();
440
							node_lieu.setId(""+(id_location+location+lieuDit));
441
							node_lieu.setText(lieuDit);
166 aurelien 442
							String[] usObj = {lieuDit,id_location+location+lieuDit};
89 jpm 443
							node_lieu.setUserObject(usObj);
444
							noeudMemeLoc.appendChild(node_lieu) ;
109 aurelien 445
 
446
							root.sort(comparerNoeuds()) ;
89 jpm 447
						}
448
					}
449
					else
450
					{
451
						TreeNode node_loc = new TreeNode();
452
						node_loc.setId(""+(id_location+location));
453
						node_loc.setText(location);
166 aurelien 454
						String[] usObj = {location,id_location+location};
89 jpm 455
						node_loc.setUserObject(usObj);
456
						noeudMemeId.appendChild(node_loc) ;
457
 
458
						TreeNode node_lieu = new TreeNode();
459
						node_lieu.setId(""+(id_location+location+lieuDit));
460
						node_lieu.setText(lieuDit);
166 aurelien 461
						String[] usObj2 = {lieuDit,id_location+location+lieuDit};
89 jpm 462
						node_lieu.setUserObject(usObj2);
463
						node_loc.appendChild(node_lieu) ;
464
 
109 aurelien 465
						root.sort(comparerNoeuds()) ;
466
 
89 jpm 467
					}
468
			}
469
			else
470
			{
91 jpm 471
				// TODO: Pourquoi l'ajout ne marche que sur la racine ?
472
 
89 jpm 473
				TreeNode node_id_loc = new TreeNode();
474
				node_id_loc.setId(""+id_location);
475
				node_id_loc.setText(id_location);
166 aurelien 476
				String[] usObj = {id_location,id_location};
89 jpm 477
				node_id_loc.setUserObject(usObj);
478
				root.appendChild(node_id_loc) ;
479
 
480
				TreeNode node_loc = new TreeNode();
481
				node_loc.setId(""+(id_location+location));
482
				node_loc.setText(location);
166 aurelien 483
				String[] usObj2 = {location,id_location+location};
89 jpm 484
				node_loc.setUserObject(usObj2);
485
				node_id_loc.appendChild(node_loc) ;
486
 
487
				TreeNode node_lieu = new TreeNode();
488
				node_lieu.setId(""+(id_location+location+lieuDit));
489
				node_lieu.setText(lieuDit);
166 aurelien 490
				String[] usObj3 = {lieuDit,id_location+location+lieuDit};
89 jpm 491
				node_lieu.setUserObject(usObj3);
492
				node_loc.appendChild(node_lieu) ;
90 jpm 493
 
494
				root.sort(comparerNoeuds()) ;
89 jpm 495
 
109 aurelien 496
			}
89 jpm 497
				arbreEntitesGeographiques.doLayout() ;
498
		}
68 david 499
	}
54 david 500
 
501
 
502
	/**
503
	 * Accesseur pour le panneau contenant l'arbre
504
	 *
505
	 * @return le panneau de l'arbre des mots clés
506
	 */
507
	public TreePanel getArbreMotsCles() {
68 david 508
		return arbreEntitesGeographiques;
54 david 509
	}
510
 
511
	/**
512
	 * Méthode héritée de Filtrable renvoie le nom du filtre
513
	 */
514
	public String renvoyerNomFiltre() {
515
 
516
		return "Localités";
517
	}
518
 
519
	/**
520
	 * Renvoie un tableau contenant le nom du champ à filtrer et la valeur
521
	 *
522
	 * @return un tableau contenant le nom du champ à filtrer et sa valeur
523
	 */
524
	public String[] renvoyerValeursAFiltrer() {
525
 
526
		valider();
85 jpm 527
 
86 jpm 528
		String valeursFiltrees[] = {nomFiltre, entitesGeographiquesEncours } ;
54 david 529
 
530
		return valeursFiltrees;
531
	}
532
 
533
	/**
534
	 * Fonction récursive qui prend deux noeuds d'arbre en paramètre et crée un
535
	 * copie du sous arbre du premier noeud, qu'elle concatène au deuxième
536
	 *
537
	 * @param ndPereOriginal
538
	 *            le père des noeuds de l'arbre original
539
	 * @param ndPereCopie
540
	 *            le père qui va recevoir les copies
541
	 */
542
	private void copierFilsNoeud(Node ndPereOriginal, TreeNode ndPereCopie) {
543
		if (ndPereCopie != null && ndPereOriginal != null) {
544
			Node[] ndNodeFils = ndPereOriginal.getChildNodes();
545
 
546
			for (int i = 0; i < ndNodeFils.length; i++) {
547
 
548
				String[] usObj = (String[]) ndNodeFils[i].getUserObject();
549
				TreeNode child = new TreeNode(usObj[0]);
550
				child.setUserObject(usObj);
166 aurelien 551
				child.setId(""+usObj[1]);
54 david 552
				ndPereCopie.appendChild(child);
553
 
554
				if (!ndNodeFils[i].isLeaf()) {
555
					copierFilsNoeud(ndNodeFils[i], child);
556
				}
557
 
558
			}
559
		}
560
	}
561
 
562
	/**
563
	 * Méthode héritée de Filtrable Renvoie l'état du filtre (modifié ou non)
564
	 */
565
	public boolean renvoyerEtatFiltre() {
566
 
567
		return filtreModifie;
568
	}
569
 
570
	public void valider() {
86 jpm 571
 
54 david 572
		if (estInstancie) {
86 jpm 573
 
54 david 574
		}
575
	}
90 jpm 576
 
577
	public Comparator<TreeNode> comparerNoeuds()
578
	{
579
		return new Comparator<TreeNode>() {
54 david 580
 
90 jpm 581
			public int compare(TreeNode o1, TreeNode o2) {
582
 
109 aurelien 583
				if(o1.getText().equals("Inconnue")) {
584
					return -1 ;
585
				}
586
 
587
				if(o2.getText().equals("Inconnue")) {
588
					return 1 ;
589
				}
590
 
591
				if(o1.getDepth() == 1 && o2.getDepth() == 1)
91 jpm 592
				{
109 aurelien 593
					String l1 = o1.getText() ;
594
					String l2 = o2.getText() ;
595
					if(l1.length() == 1) {
596
						l1 = "0"+l1;
597
					}
91 jpm 598
 
109 aurelien 599
					if(l2.length() == 1) {
600
						l2 = "0"+l2;
601
					}
602
 
128 aurelien 603
					Integer n1 = 0;
604
					Integer n2 = 0;
109 aurelien 605
 
128 aurelien 606
					try{
607
						n1 = Integer.parseInt(l1) ;
608
						n2 = Integer.parseInt(l2) ;
609
					} catch(NumberFormatException ne)  {
610
						n1 = 0;
611
						n2 = 0;
612
					}
613
 
91 jpm 614
					return n1.compareTo(n2) ;
615
				}
616
				else
94 jpm 617
				{
91 jpm 618
					String n1 = o1.getText() ;
619
					String n2 = o2.getText() ;
90 jpm 620
 
91 jpm 621
					return n1.compareTo(n2) ;
622
				}
90 jpm 623
			}
624
		} ;
625
	}
104 jpm 626
 
627
	public void raz() {
628
 
629
		arbreCharge = false ;
140 aurelien 630
		arbreEntitesGeographiques.collapseAll();
104 jpm 631
		arbreEntitesGeographiques.clear() ;
632
 
633
		// on crée une racine pour l'arbre
634
		TreeNode root = new TreeNode("Localités");
635
		root.setId("racine_entite");
636
		String[] usObject = { "Localités" };
637
		root.setUserObject(usObject);
638
 
639
		arbreEntitesGeographiques.setRootNode(root);
640
 
641
		arbreEntitesGeographiques.getRootNode().addListener(new TreeNodeListenerAdapter() {
642
 
643
			public void onExpand(Node node) {
644
				if(!arbreCharge)
645
				{
646
					observationMediateur.obtenirDatesObservation() ;
647
					arbreCharge = true ;
648
				}
649
			}
650
 
651
		}) ;
652
 
653
		arbreCharge = false ;
654
 
655
		this.doLayout() ;
656
 
657
	}
91 jpm 658
 
54 david 659
}