Subversion Repositories eFlore/Applications.cel

Rev

Rev 263 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 263 Rev 683
Line 149... Line 149...
149
	private void ajouterListeners() {
149
	private void ajouterListeners() {
Line 150... Line 150...
150
		
150
		
Line 151... Line 151...
151
		arbreEntitesGeographiques.addListener(new TreePanelListenerAdapter() {
151
		arbreEntitesGeographiques.addListener(new TreePanelListenerAdapter() {
-
 
152
			
-
 
153
			public void onClick(TreeNode node, EventObject e) {
-
 
154
				gererClicNoeud(node);
-
 
155
			}
-
 
156
			
-
 
157
		}) ;
-
 
158
		
-
 
159
		arbreEntitesGeographiques.getRootNode().addListener(new TreeNodeListenerAdapter() {
-
 
160
			
-
 
161
			public void onExpand(Node node) {
-
 
162
				if(!arbreCharge)
-
 
163
				{
-
 
164
					observationMediateur.obtenirListeEntiteGeographique() ;
-
 
165
					arbreCharge = true ;
-
 
166
				}
-
 
167
			}
-
 
168
			
-
 
169
		}) ;
-
 
170
	}
-
 
171
	
-
 
172
	private void gererClicNoeud(TreeNode node) {
-
 
173
		
-
 
174
		mettreAJourValeurEnCours(node);
-
 
175
		observationMediateur.obtenirNombreObservation() ;
-
 
176
	}
Line 152... Line 177...
152
			
177
	
153
			public void onClick(TreeNode node, EventObject e) {
178
	private void mettreAJourValeurEnCours(TreeNode node) {
154
				
179
		
155
				nomFiltre = "" ;
180
		nomFiltre = "" ;
Line 191... Line 216...
191
					default: 
216
			default: 
192
						break;
217
				break;
193
				}
218
		}
Line 194... Line 219...
194
				
219
		
195
				filtreModifie = true ;
-
 
196
				
-
 
197
				// Le filtre est modifie : on lance un rafraaaichissement de la liste des observations affichees
-
 
198
				
-
 
199
				observationMediateur.obtenirNombreObservation() ;
-
 
200
				
-
 
201
			}
-
 
202
			
-
 
203
		}) ;
-
 
204
		
-
 
205
		arbreEntitesGeographiques.getRootNode().addListener(new TreeNodeListenerAdapter() {
-
 
206
			
-
 
207
			public void onExpand(Node node) {
-
 
208
				if(!arbreCharge)
-
 
209
				{
-
 
210
					observationMediateur.obtenirListeEntiteGeographique() ;
-
 
211
					arbreCharge = true ;
-
 
212
				}
-
 
213
			}
-
 
214
			
-
 
215
		}) ;
220
		filtreModifie = true ;
Line 216... Line 221...
216
	}
221
	}
Line 217... Line 222...
217
	
222
	
Line 557... Line 562...
557
		}
562
		}
Line 558... Line 563...
558
				
563
				
559
		root.sort(comparerNoeuds()) ;
564
		root.sort(comparerNoeuds()) ;
Line -... Line 565...
-
 
565
	}
-
 
566
 
-
 
567
	@Override
-
 
568
	public void viderFiltre() {
-
 
569
		arbreEntitesGeographiques.getSelectionModel().clearSelections();
-
 
570
		entitesGeographiquesEncours ="";
-
 
571
	}
-
 
572
 
-
 
573
	public void viderFiltre(String nom) {
-
 
574
		
-
 
575
		final int profondeur = calculerProfondeurPourNomFiltre(nom);
-
 
576
		
-
 
577
		// on vide tous les noeuds
-
 
578
		arbreEntitesGeographiques.getRootNode().cascade(new NodeTraversalCallback() {
-
 
579
 
-
 
580
			public boolean execute(Node node) {
-
 
581
				
-
 
582
				boolean continuer = true;
-
 
583
				
-
 
584
				TreeNode noeudArbreEncours = (TreeNode)node;
-
 
585
				
-
 
586
				if(arbreEntitesGeographiques.getSelectionModel().isSelected(noeudArbreEncours)) {
-
 
587
					
-
 
588
					int profondeurDepart = noeudArbreEncours.getDepth();
-
 
589
					
-
 
590
					for(int profondeurNoeudArbreEncours = profondeurDepart; profondeurNoeudArbreEncours >= profondeur; profondeurNoeudArbreEncours--) {
-
 
591
						noeudArbreEncours = (TreeNode)noeudArbreEncours.getParentNode();
-
 
592
					}
-
 
593
					
-
 
594
					arbreEntitesGeographiques.getSelectionModel().select(noeudArbreEncours); 
-
 
595
					mettreAJourValeurEnCours(noeudArbreEncours);
-
 
596
					
-
 
597
					continuer = false;
-
 
598
				}
-
 
599
				
-
 
600
				return continuer;
-
 
601
			}
-
 
602
 
-
 
603
		});
-
 
604
	}
-
 
605
	
-
 
606
	private int calculerProfondeurPourNomFiltre(String nom) {
-
 
607
		
-
 
608
		int profondeur = 0;
-
 
609
		
-
 
610
		if(nom.equals("id_location")) {
-
 
611
			profondeur = 1;
-
 
612
		}
-
 
613
		
-
 
614
		if(nom.equals("location")) {
-
 
615
			profondeur = 2;
-
 
616
		}
-
 
617
		
-
 
618
		if(nom.equals("lieudit")) {
-
 
619
			profondeur = 3;
-
 
620
		}
-
 
621
		
-
 
622
		if(nom.equals("station")) {
-
 
623
			profondeur = 4;
-
 
624
		}
-
 
625
		
-
 
626
		return profondeur;
560
	}
627
	}