Subversion Repositories eFlore/Applications.cel

Rev

Rev 205 | Rev 218 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 205 Rev 216
Line 3... Line 3...
3
// TODO Detecter redim et supprimer ajuster
3
// TODO Detecter redim et supprimer ajuster
Line 4... Line 4...
4
 
4
 
Line 5... Line 5...
5
import java.util.Iterator;
5
import java.util.Iterator;
-
 
6
 
6
 
7
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
8
import org.tela_botanica.client.modeles.ListeObservation;
8
import org.tela_botanica.client.modeles.ListeReferentielCommune;
9
import org.tela_botanica.client.modeles.ListeReferentielCommune;
9
import org.tela_botanica.client.modeles.ListeReferentielNom;
10
import org.tela_botanica.client.modeles.ListeReferentielNom;
10
import org.tela_botanica.client.modeles.Observation;
11
import org.tela_botanica.client.modeles.Observation;
11
import org.tela_botanica.client.modeles.ReferentielCommune;
12
import org.tela_botanica.client.modeles.ReferentielCommune;
Line -... Line 13...
-
 
13
import org.tela_botanica.client.modeles.ReferentielNom;
12
import org.tela_botanica.client.modeles.ReferentielNom;
14
import org.tela_botanica.client.observation.ObservationMediateur;
13
import org.tela_botanica.client.observation.ObservationMediateur;
15
 
14
 
16
import com.google.gwt.user.client.Window;
15
import com.gwtext.client.core.EventCallback;
17
import com.gwtext.client.core.EventCallback;
16
import com.gwtext.client.core.EventObject;
18
import com.gwtext.client.core.EventObject;
Line 32... Line 34...
32
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
34
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
33
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
35
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
34
import com.gwtext.client.widgets.event.PanelListenerAdapter;
36
import com.gwtext.client.widgets.event.PanelListenerAdapter;
35
import com.gwtext.client.widgets.form.ComboBox;
37
import com.gwtext.client.widgets.form.ComboBox;
36
import com.gwtext.client.widgets.form.DateField;
38
import com.gwtext.client.widgets.form.DateField;
-
 
39
import com.gwtext.client.widgets.form.Field;
37
import com.gwtext.client.widgets.form.FormPanel;
40
import com.gwtext.client.widgets.form.FormPanel;
38
import com.gwtext.client.widgets.form.TextArea;
41
import com.gwtext.client.widgets.form.TextArea;
39
import com.gwtext.client.widgets.form.TextField;
42
import com.gwtext.client.widgets.form.TextField;
40
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
43
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
41
import com.gwtext.client.widgets.layout.AnchorLayoutData;
44
import com.gwtext.client.widgets.layout.AnchorLayoutData;
Line 71... Line 74...
71
	private String numeroOrdre = null;
74
	private String numeroOrdre = null;
Line 72... Line 75...
72
 
75
 
Line 73... Line 76...
73
	// Pour remise a zero partielle lors d'une validation
76
	// Pour remise a zero partielle lors d'une validation
74
	
77
	
-
 
78
	private  enum Champs {
-
 
79
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT ;
-
 
80
	    
-
 
81
	    public String toString() {
-
 
82
	    	
-
 
83
	    	switch(this) {
-
 
84
	    	case DATE:
-
 
85
	    		return "date";
-
 
86
	    		
-
 
87
	    	case COMMUNE:
-
 
88
	    		return "commune";
-
 
89
	    	
-
 
90
    		case LIEUDIT:
-
 
91
    			return "lieu dit";
-
 
92
	    	
-
 
93
    		case STATION:
-
 
94
    			return "station";
-
 
95
	    	
-
 
96
    		case MILIEU:
-
 
97
    			return "milieu";
-
 
98
	    	
-
 
99
    		case COMMENT:
-
 
100
    			return "commentaire";
-
 
101
	    	
-
 
102
	    	case ESPECE:
-
 
103
	    		return "espèce";
-
 
104
	    	
-
 
105
	    	case TOUT:
-
 
106
	    		return "date, commune, lieu dit, station, milieu, espèce, commentaire";
-
 
107
	    	}
75
	private  enum Champs {
108
			return TOUT.toString();
Line 76... Line 109...
76
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT 
109
	    }
Line 86... Line 119...
86
	private boolean selectionEspece=false;
119
	private boolean selectionEspece=false;
Line 87... Line 120...
87
	
120
	
88
	private boolean modification = false ;
121
	private boolean modification = false ;
Line -... Line 122...
-
 
122
	private Toolbar bt = null ;
-
 
123
	
-
 
124
	private final String VALEURS_MULTIPLES = "(Valeurs multiples)";
-
 
125
	private final String modeleMessageModif = "commune lieu dit station milieu date espece commentaire";
-
 
126
	private boolean communeModifiee = false;
-
 
127
	private boolean LieuDitModifie = false;
-
 
128
	private boolean StationModifiee = false;
-
 
129
	private boolean milieuModifie = false;
-
 
130
	private boolean dateModifiee = false;
-
 
131
	private boolean especeModifiee = false;
-
 
132
	private boolean commModifie = false;
89
	private Toolbar bt = null ;
133
	
90
	
134
	
91
	private final int KEY_ALT = 18;
135
	private final int KEY_ALT = 18;
92
	private final int KEY_BACKSPACE = 8;
136
	private final int KEY_BACKSPACE = 8;
93
	private final int KEY_CTRL = 17;
137
	private final int KEY_CTRL = 17;
Line 122... Line 166...
122
	private Panel panneauIntermediaire;
166
	private Panel panneauIntermediaire;
Line 123... Line 167...
123
 
167
 
Line 124... Line 168...
124
	private Panel panneauPremierColonne;
168
	private Panel panneauPremierColonne;
-
 
169
 
-
 
170
	private Panel panneauSecondeColonne;
Line 125... Line 171...
125
 
171
 
126
	private Panel panneauSecondeColonne;
172
	private boolean masseModification =false ;
127
	
173
	
128
	/**
174
	/**
Line 281... Line 327...
281
	        public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight) {
327
	        public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight) {
282
	        	panneauIntermediaire.setWidth(rawWidth);
328
	        	panneauIntermediaire.setWidth(rawWidth);
283
	        	panneauIntermediaire.setHeight(rawHeight);
329
	        	panneauIntermediaire.setHeight(rawHeight);
284
	     }});
330
	     }});
Line 285... Line -...
285
		
-
 
286
		
331
		
Line 287... Line 332...
287
		// on ajoute les listeners
332
		// on ajoute les listeners
Line 288... Line 333...
288
		
333
		
Line 289... Line 334...
289
		
334
		
290
		ajouterListeners() ;
335
		ajouterListeners() ;
291
		
-
 
292
	}
-
 
293
	
-
 
294
	private void ajouterListeners()
-
 
295
	{	
336
		
Line 296... Line 337...
296
		
337
	}
297
		
338
	
298
		
339
	private void ajouterListeners()
Line 337... Line 378...
337
	    	    	        break;
378
	    	    	        break;
Line 338... Line 379...
338
	    	    		
379
	    	    		
Line 339... Line 380...
339
	    	    	    	case KEY_ENTER:
380
	    	    	    	case KEY_ENTER:
-
 
381
	    	    	    	  
340
	    	    	    	  
382
		    	    	    	 if (selectionCommune) {
341
		    	    	    	 if (selectionCommune) {
383
		    	    	    		 communeModifiee= true;
342
		    	    	    		 selectionCommune=false;
384
		    	    	    		 selectionCommune=false;
Line 343... Line 385...
343
		    	    	    	 }
385
		    	    	    	 }
Line 350... Line 392...
350
	    	    	       
392
	    	    	       
Line 351... Line 393...
351
		    	    	    default:
393
		    	    	    default:
352
		    	    	    	  
394
		    	    	    	  
-
 
395
		    	    	    	  departement="";
Line 353... Line 396...
353
		    	    	    	  departement="";
396
		    	    	    	  obtenirListeReferentielCommune();
354
		    	    	    	  obtenirListeReferentielCommune();
397
		    	    	    	  communeModifiee= true;
355
		    	    	    	  	    	    	        
398
		    	    	    	  	    	    	        
356
		    	    	    break;
399
		    	    	    break;
Line 361... Line 404...
361
		    
404
		    
Line 362... Line 405...
362
		    date.addKeyPressListener(new EventCallback() {
405
		    date.addKeyPressListener(new EventCallback() {
363
 
406
 
-
 
407
				public void execute(EventObject e) {
364
				public void execute(EventObject e) {
408
					// TODO Auto-generated method stub
Line 365... Line 409...
365
					// TODO Auto-generated method stub
409
					dateModifiee = true;
366
					switch(e.getKey()) {
410
					switch(e.getKey()) {
367
	  	    	      
411
	  	    	      
Line 376... Line 420...
376
		    
420
		    
Line 377... Line 421...
377
		    station.addKeyPressListener(new EventCallback() {
421
		    station.addKeyPressListener(new EventCallback() {
378
 
422
 
-
 
423
				public void execute(EventObject e) {
379
				public void execute(EventObject e) {
424
					// TODO Auto-generated method stub
Line 380... Line 425...
380
					// TODO Auto-generated method stub
425
					StationModifiee = true;
381
					switch(e.getKey()) {
426
					switch(e.getKey()) {
382
	  	    	      
427
	  	    	      
Line 433... Line 478...
433
		    	    	        break;
478
		    	    	        break;
Line 434... Line 479...
434
		    	    	      
479
		    	    	      
Line 435... Line 480...
435
		    	    	      case KEY_ENTER:
480
		    	    	      case KEY_ENTER:
-
 
481
		    	    	    	  
436
		    	    	    	  
482
			    	    	    	if(selectionEspece) {
437
			    	    	    	if(selectionEspece) {
483
			    	    	    		especeModifiee = true;
438
			    	    	    		 selectionEspece=false;
484
			    	    	    		selectionEspece=false;
439
			    	    	    	}
485
			    	    	    	}
440
			    	    	    	else {
486
			    	    	    	else {
Line 445... Line 491...
445
		    	    	       
491
		    	    	       
Line 446... Line 492...
446
		    	    	      default:
492
		    	    	      default:
447
		    	    	    	  
493
		    	    	    	  
-
 
494
		    	    	    	  numeroNom="";
Line 448... Line 495...
448
		    	    	    	  numeroNom="";
495
		    	    	    	  obtenirListeReferentielNom();
449
		    	    	    	  obtenirListeReferentielNom();
496
		    	    	    	  especeModifiee = true;
Line 461... Line 508...
461
		    
508
		    
Line 462... Line 509...
462
			lieudit.addKeyPressListener(new EventCallback() {
509
			lieudit.addKeyPressListener(new EventCallback() {
463
 
510
 
-
 
511
				public void execute(EventObject e) {
464
				public void execute(EventObject e) {
512
					// TODO Auto-generated method stub
Line 465... Line 513...
465
					// TODO Auto-generated method stub
513
					LieuDitModifie = true;
466
					switch(e.getKey()) {
514
					switch(e.getKey()) {
467
	  	    	      
515
	  	    	      
Line 476... Line 524...
476
			
524
			
Line 477... Line 525...
477
			milieu.addKeyPressListener(new EventCallback() {
525
			milieu.addKeyPressListener(new EventCallback() {
478
 
526
 
-
 
527
				public void execute(EventObject e) {
479
				public void execute(EventObject e) {
528
					// TODO Auto-generated method stub
Line 480... Line 529...
480
					// TODO Auto-generated method stub
529
					milieuModifie = true;
481
					switch(e.getKey()) {
530
					switch(e.getKey()) {
482
	  	    	      
531
	  	    	      
Line 487... Line 536...
487
	  	    	      default:
536
	  	    	      default:
488
					}
537
					}
489
				}
538
				}
490
		    });
539
		    });
Line 491... Line 540...
491
			
540
			
Line 492... Line 541...
492
			/*comment.addKeyPressListener(new EventCallback() {
541
			comment.addKeyPressListener(new EventCallback() {
493
 
542
 
494
				public void execute(EventObject e) {
543
				public void execute(EventObject e) {
495
					// TODO Auto-generated method stub
-
 
496
					switch(e.getKey()) {
-
 
497
	  	    	      
-
 
498
	  	    	      case KEY_ENTER:	  	    	    	  
-
 
499
	  	    	    		validerSaisie(Champs.COMMENT); 	    	    		 
-
 
500
	  	    	    	  break;
-
 
501
	  	    	       
-
 
502
	  	    	      default:
544
					// TODO Auto-generated method stub
503
					}
545
					commModifie = true;
Line 504... Line 546...
504
				}
546
				}
Line 505... Line 547...
505
		    });*/
547
		    });
Line 506... Line 548...
506
 
548
 
-
 
549
		  
-
 
550
 
-
 
551
		boutonOK.addListener(new ButtonListenerAdapter() {
507
		  
552
			
-
 
553
			public void onClick(Button button, EventObject e) {
508
 
554
		
509
		boutonOK.addListener(new ButtonListenerAdapter() {
555
				if(modification) {
510
			
556
					if(masseModification) {
511
			public void onClick(Button button, EventObject e) {
557
							modifierObservationEnMasse(null);
Line 553... Line 599...
553
	 */
599
	 */
Line 554... Line 600...
554
	
600
	
Line 555... Line 601...
555
	private void validerSaisie(Champs champs) {
601
	private void validerSaisie(Champs champs) {
-
 
602
		
-
 
603
		if(modification) {
-
 
604
			if(masseModification) {
556
		
605
					modifierObservationEnMasse(champs);
-
 
606
			} else {
557
		if(modification) {
607
				modifierObservation();
-
 
608
			}
558
			modifierObservation() ;
609
			
559
		
610
			raz(champs);
560
		}
611
		}
561
		else {
612
		else {
562
			ajouterObservation();
613
			ajouterObservation();
Line 670... Line 721...
670
			{
721
			{
671
				Observation obs = (Observation)nouvelleDonnees ;
722
				Observation obs = (Observation)nouvelleDonnees ;
672
				afficherDetailsObservation(obs) ;
723
				afficherDetailsObservation(obs) ;
673
			}
724
			}
Line -... Line 725...
-
 
725
			
-
 
726
			if(nouvelleDonnees instanceof ListeObservation) {
-
 
727
				ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
-
 
728
				calculerAfficherDifferences(listeObs);
-
 
729
			}
674
			
730
			
Line 675... Line 731...
675
			// Sur Mise à jour ou suppression d'une suppression ?
731
			// Sur Mise à jour ou suppression d'une suppression ?
676
			
732
			
677
			if(nouvelleDonnees instanceof String)
733
			if(nouvelleDonnees instanceof String)
Line 686... Line 742...
686
				espece.setValue(anumNom[0]);
742
				espece.setValue(anumNom[0]);
687
				setModification("false");
743
				setModification("false");
688
			}
744
			}
Line 689... Line 745...
689
 
745
 
690
	}
-
 
691
	
-
 
692
 
746
	}
Line 693... Line 747...
693
	public void obtenirListeReferentielCommune() {
747
	public void obtenirListeReferentielCommune() {
694
		
748
		
Line 738... Line 792...
738
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());	
792
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());	
739
		observationMediateur.ajouterObservation(obs);
793
		observationMediateur.ajouterObservation(obs);
740
	}
794
	}
Line 741... Line 795...
741
	
795
	
742
	private void modifierObservation() {
-
 
743
		
796
	private void modifierObservation() {
744
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
797
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
745
		obs.setNumeroOrdre(numeroOrdre);
-
 
Line -... Line 798...
-
 
798
		obs.setNumeroOrdre(numeroOrdre);
-
 
799
		
746
		observationMediateur.modifierObservation(obs);
800
		observationMediateur.modifierObservation(obs);
747
		
801
 
Line 748... Line 802...
748
		selecteurMode.setValue("création");
802
		selecteurMode.setValue("création");
Line -... Line 803...
-
 
803
		setModification("false");
-
 
804
		
-
 
805
	}
-
 
806
	
-
 
807
	private void modifierObservationEnMasse(Champs champModifie) {
-
 
808
		String communeM = null;
-
 
809
		String departementM = null;
-
 
810
		String lieuDitM = null;
-
 
811
		String stationM = null;
-
 
812
		String milieuM = null;
-
 
813
		String dateM = null;
-
 
814
		String especeM = null;
-
 
815
		String commM = null; 
-
 
816
		
-
 
817
		String champs = modeleMessageModif;
-
 
818
			
-
 
819
		if(communeModifiee) {
-
 
820
			communeM = commune.getText();
-
 
821
		} else {
-
 
822
			champs = champs.replaceAll("commune ", "");
-
 
823
		}
-
 
824
		
-
 
825
		if(LieuDitModifie) {
-
 
826
			lieuDitM = lieudit.getText();
-
 
827
		}else {
-
 
828
			champs = champs.replaceAll("lieu dit ", "");
-
 
829
		}
-
 
830
		
-
 
831
		if(StationModifiee) {
-
 
832
			stationM = station.getText();
-
 
833
		}else {
-
 
834
			champs = champs.replaceAll("station ", "");
-
 
835
		}
-
 
836
 
-
 
837
		if(milieuModifie) {
-
 
838
			milieuM = milieu.getText();
-
 
839
		}else {
-
 
840
			champs = champs.replaceAll("milieu ", "");
-
 
841
		}
-
 
842
 
-
 
843
		if(dateModifiee) {
-
 
844
			dateM = date.getRawValue();
-
 
845
		}else {
-
 
846
			champs = champs.replaceAll("date ", "");
-
 
847
		}
-
 
848
 
-
 
849
		if(especeModifiee) {
-
 
850
			especeM = espece.getText();
-
 
851
		}else {
-
 
852
			champs = champs.replaceAll("espece ", "");
-
 
853
		}
-
 
854
 
-
 
855
		if(commModifie) {
-
 
856
			commM = comment.getText();
-
 
857
		}else {
-
 
858
			champs = champs.replaceAll("commentaire", "");
-
 
859
		}
-
 
860
		
-
 
861
		String message = "Voulez vous modifier les champs suivants : "+champs+" pour les observations selectionnées ?" ;
-
 
862
		
-
 
863
		if(champs.trim().equals("")) {
-
 
864
			Window.alert("Aucun champ n'a été modifié");
-
 
865
		} else {
-
 
866
			Observation obs = new Observation(especeM,numeroNom,communeM,departementM,lieuDitM,stationM,milieuM, commM,dateM);
-
 
867
			obs.setNumeroOrdre(numeroOrdre);
-
 
868
			if(Window.confirm(message)) {
-
 
869
				observationMediateur.modifierObservationEnMasse(obs);
749
		setModification("false");
870
			}
Line 750... Line 871...
750
		
871
		}
751
	}
872
	}
Line 752... Line 873...
752
	
873
	
753
	private void supprimerObservation() {
874
	private void supprimerObservation() {
754
		
875
		
755
			observationMediateur.supprimerObservation(this, numeroOrdre);
876
		observationMediateur.supprimerObservation(this, numeroOrdre);
756
	}
-
 
-
 
877
	}
757
 
878
 
758
	
879
	
759
	public void afficherDetailsObservation(Observation obs)
880
	public void afficherDetailsObservation(Observation obs)
760
	{
881
	{
761
		raz() ;
882
		raz() ;
-
 
883
		String idLoc ;
-
 
884
		if(obs.getIdentifiantLocalite() != VALEURS_MULTIPLES) {
-
 
885
			idLoc =obs.getIdentifiantLocalite().replaceAll(" ","/");
Line 762... Line 886...
762
		char g ;
886
			idLoc = idLoc.replaceAll("%","");
763
		
887
			idLoc = idLoc.replaceAll("\"","");
764
		String idLoc =obs.getIdentifiantLocalite().replaceAll(" ","/");
888
			idLoc = idLoc.replace('\\',' ');
765
		idLoc = idLoc.replaceAll("%","");
889
			idLoc = idLoc.trim();
Line 788... Line 912...
788
		}
912
		}
789
		if(!obs.getCommentaire().equals("null") && !obs.getCommentaire().equals("000null")) {
913
		if(!obs.getCommentaire().equals("null") && !obs.getCommentaire().equals("000null")) {
790
			comment.setValue(obs.getCommentaire()) ;
914
			comment.setValue(obs.getCommentaire()) ;
791
		}
915
		}
792
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
916
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
793
			if(!idLoc.equals("000null")) {
917
			if(!idLoc.equals("000null") && !idLoc.equals(VALEURS_MULTIPLES)) {
794
				commune.setValue(obs.getLocalite()+" ("+idLoc+")") ;
918
				commune.setValue(obs.getLocalite()+" ("+idLoc+")") ;
795
			}
919
			}
796
			else
920
			else
797
			{
921
			{
798
				commune.setValue(obs.getLocalite());
922
				commune.setValue(obs.getLocalite());
Line 882... Line 1006...
882
			setTitle("Modification") ;
1006
			setTitle("Modification") ;
883
			boutonAnnuler.setText("Supprimer") ;
1007
			boutonAnnuler.setText("Supprimer") ;
884
			modification = true ;
1008
			modification = true ;
885
			selecteurMode.removeClass("x-selec-crea") ;
1009
			selecteurMode.removeClass("x-selec-crea") ;
886
			selecteurMode.setCls("x-selec-modif") ;
1010
			selecteurMode.setCls("x-selec-modif") ;
887
			
-
 
-
 
1011
			observationMediateur.onModeModification();
888
		}
1012
		}
889
		else
1013
		else
890
		{
1014
		{
891
 
-
 
892
			boutonOK.setText("Ajouter") ;
1015
			boutonOK.setText("Ajouter") ;
893
			setTitle("Saisir") ;
1016
			setTitle("Saisir") ;
894
			boutonAnnuler.setText("Réinitialiser") ;
1017
			boutonAnnuler.setText("Réinitialiser") ;
895
			modification = false ;
1018
			modification = false ;
896
			selecteurMode.removeClass("x-selec-modif") ;
1019
			selecteurMode.removeClass("x-selec-modif") ;
Line 906... Line 1029...
906
	public boolean getModification()
1029
	public boolean getModification()
907
	{
1030
	{
908
		return modification ;
1031
		return modification ;
909
	}
1032
	}
Line -... Line 1033...
-
 
1033
	
-
 
1034
	/**
-
 
1035
	 * renvoie vrai si on est en mode modification de masse, faux sinon
-
 
1036
	 * @return
-
 
1037
	 */
-
 
1038
	public boolean getMasseModification()
-
 
1039
	{
-
 
1040
		return masseModification ;
-
 
1041
	}
910
	
1042
	
Line 911... Line 1043...
911
	public boolean verifierFormatDate(String date) {
1043
	public boolean verifierFormatDate(String date) {
912
		
1044
		
913
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
1045
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
914
		if(date.matches(regex) && !date.equals("0000-00-00")) {
1046
		if(date.matches(regex) && !date.equals("0000-00-00")) {
915
			return true ;
1047
			return true ;
916
		}
1048
		}
917
		else {
1049
		else {
918
			return false;
1050
			return false;
919
		}
-
 
Line -... Line 1051...
-
 
1051
		}
-
 
1052
	}
-
 
1053
 
-
 
1054
	public void setMasseModification(boolean masseModification) {
-
 
1055
		this.masseModification = masseModification;
-
 
1056
		if(masseModification) {
-
 
1057
			reinitialiserValeurModifiees();
-
 
1058
		}
-
 
1059
	}
-
 
1060
	
-
 
1061
	private void calculerAfficherDifferences(ListeObservation listeObs) {
-
 
1062
		
-
 
1063
		String departement = null;
-
 
1064
		String commune = null;
-
 
1065
		String lieuDit = null;
-
 
1066
		String station = null;
-
 
1067
		String milieu = null;
-
 
1068
		String espece = null;
-
 
1069
		String date = null;
-
 
1070
		String notes = null;
-
 
1071
		
-
 
1072
		String ordreObs = "";
-
 
1073
		
-
 
1074
		for(Iterator<String> it = listeObs.keySet().iterator();it.hasNext();) {
-
 
1075
			Observation obsEnCours = listeObs.get(it.next());
-
 
1076
			departement = comparerDifferencesChamps(departement, obsEnCours.getIdentifiantLocalite());
-
 
1077
			commune = comparerDifferencesChamps(commune, obsEnCours.getLocalite());
-
 
1078
			lieuDit = comparerDifferencesChamps(lieuDit, obsEnCours.getLieudit());
-
 
1079
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
-
 
1080
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
-
 
1081
			espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi()); 
-
 
1082
			date = comparerDifferencesChamps(date, obsEnCours.getDate());
-
 
1083
			notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
-
 
1084
			
-
 
1085
			ordreObs += obsEnCours.getNumeroOrdre()+",";
-
 
1086
		}
-
 
1087
		
-
 
1088
		Observation obs=new Observation(espece,numeroNom,commune,departement,lieuDit,station,milieu, notes,date);
-
 
1089
		obs.setNumeroOrdre(ordreObs);
-
 
1090
		rafraichir(obs, false);
-
 
1091
		
-
 
1092
	}
-
 
1093
	
-
 
1094
	private String comparerDifferencesChamps(String valeurActuelle, String nouvelleValeur) {
-
 
1095
		
-
 
1096
		String retour = "000null";
-
 
1097
		
-
 
1098
			if(valeurActuelle == null) {
-
 
1099
				retour = nouvelleValeur;
-
 
1100
			} else {
-
 
1101
				if(valeurActuelle.equals(nouvelleValeur)) {
-
 
1102
					retour = valeurActuelle;
-
 
1103
				} else {
-
 
1104
					retour = VALEURS_MULTIPLES;
-
 
1105
				}
-
 
1106
			}
-
 
1107
		return retour;
-
 
1108
	}
-
 
1109
	
-
 
1110
	private void reinitialiserValeurModifiees() {
-
 
1111
		
-
 
1112
		communeModifiee = false;
-
 
1113
		LieuDitModifie = false;
-
 
1114
		StationModifiee = false;
-
 
1115
		milieuModifie = false;
-
 
1116
		dateModifiee = false;
-
 
1117
		especeModifiee = false;
-
 
1118
		commModifie = false;
-
 
1119
	}
-
 
1120
	
-
 
1121
	private Field obtenirCorrespondanceChampsEnum(Champs champ) {
-
 
1122
		switch(champ) {
-
 
1123
    	case DATE:
-
 
1124
    		return date;
-
 
1125
    		
-
 
1126
    	case COMMUNE:
-
 
1127
    		return commune;
-
 
1128
    	
-
 
1129
		case LIEUDIT:
-
 
1130
			return lieudit;
-
 
1131
    	
-
 
1132
		case STATION:
-
 
1133
			return station;
-
 
1134
    	
-
 
1135
		case MILIEU:
-
 
1136
			return milieu;
-
 
1137
    	
-
 
1138
		case COMMENT:
-
 
1139
			return comment;
-
 
1140
    	
-
 
1141
    	case ESPECE:
-
 
1142
    		return espece;
920
	}
1143
    	}