Subversion Repositories eFlore/Applications.cel

Rev

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

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