Subversion Repositories eFlore/Applications.cel

Rev

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

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