Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2558 Rev 2568
Line 14... Line 14...
14
import org.tela_botanica.client.modeles.dao.ListeReferentielChampsEtendusDAO;
14
import org.tela_botanica.client.modeles.dao.ListeReferentielChampsEtendusDAO;
15
import org.tela_botanica.client.modeles.objets.ChampEtendu;
15
import org.tela_botanica.client.modeles.objets.ChampEtendu;
16
import org.tela_botanica.client.modeles.objets.Configuration;
16
import org.tela_botanica.client.modeles.objets.Configuration;
17
import org.tela_botanica.client.modeles.objets.EntiteGeographiqueObservation;
17
import org.tela_botanica.client.modeles.objets.EntiteGeographiqueObservation;
18
import org.tela_botanica.client.modeles.objets.ListeObservation;
18
import org.tela_botanica.client.modeles.objets.ListeObservation;
19
import org.tela_botanica.client.modeles.objets.ListeReferentielCommune;
19
import org.tela_botanica.client.modeles.objets.ListeReferentielLocalite;
20
import org.tela_botanica.client.modeles.objets.ListeReferentielNom;
20
import org.tela_botanica.client.modeles.objets.ListeReferentielNom;
21
import org.tela_botanica.client.modeles.objets.Observation;
21
import org.tela_botanica.client.modeles.objets.Observation;
22
import org.tela_botanica.client.modeles.objets.Ontologies;
22
import org.tela_botanica.client.modeles.objets.Ontologies;
23
import org.tela_botanica.client.modeles.objets.ReferentielCommune;
23
import org.tela_botanica.client.modeles.objets.ReferentielLocalite;
24
import org.tela_botanica.client.modeles.objets.ReferentielNom;
24
import org.tela_botanica.client.modeles.objets.ReferentielNom;
25
import org.tela_botanica.client.modeles.objets.ListeReferentielPerso.TypesReferentiels;
25
import org.tela_botanica.client.modeles.objets.ListeReferentielPerso.TypesReferentiels;
26
import org.tela_botanica.client.observation.ObservationMediateur;
26
import org.tela_botanica.client.observation.ObservationMediateur;
27
import org.tela_botanica.client.util.AutoCompletionRefComboBox;
27
import org.tela_botanica.client.util.AutoCompletionRefComboBox;
28
import org.tela_botanica.client.util.ChampSaisieEtendu;
28
import org.tela_botanica.client.util.ChampSaisieEtendu;
Line 33... Line 33...
33
import com.google.gwt.event.dom.client.ClickHandler;
33
import com.google.gwt.event.dom.client.ClickHandler;
34
import com.google.gwt.user.client.Timer;
34
import com.google.gwt.user.client.Timer;
35
import com.google.gwt.user.client.Window;
35
import com.google.gwt.user.client.Window;
36
import com.google.gwt.user.client.ui.HTML;
36
import com.google.gwt.user.client.ui.HTML;
37
import com.google.gwt.user.client.ui.PopupPanel;
37
import com.google.gwt.user.client.ui.PopupPanel;
38
import com.google.maps.gwt.client.LatLng;
-
 
39
import com.gwtext.client.core.EventCallback;
38
import com.gwtext.client.core.EventCallback;
40
import com.gwtext.client.core.EventObject;
39
import com.gwtext.client.core.EventObject;
41
import com.gwtext.client.core.Ext;
40
import com.gwtext.client.core.Ext;
42
import com.gwtext.client.core.ExtElement;
41
import com.gwtext.client.core.ExtElement;
43
import com.gwtext.client.core.ListenerConfig;
42
import com.gwtext.client.core.ListenerConfig;
Line 94... Line 93...
94
	private DateField date = null;
93
	private DateField date = null;
95
	private ComboBox lieudit = null;
94
	private ComboBox lieudit = null;
96
	private ComboBox station = null;
95
	private ComboBox station = null;
97
	private ComboBox milieu = null;
96
	private ComboBox milieu = null;
98
	private TextField comment = null;
97
	private TextField comment = null;
99
	private ComboBox  commune = null;
98
	private ComboBox  localite = null;
Line -... Line 99...
-
 
99
	
100
	
100
	private String codeLocalite = null;
Line 101... Line 101...
101
	private String departement = null;
101
	private String pays = null;
102
	
102
	
103
	private ComboBox  espece = null;
103
	private ComboBox  espece = null;
104
	private String numeroNom = null;
-
 
105
	private String numeroOrdre = null;
104
	private String numeroNom = null;
106
	private String codeLoc = null;
105
	private String numeroOrdre = null;
Line 107... Line 106...
107
	private String referentielTaxo = null;
106
	private String referentielTaxo = null;
Line 108... Line 107...
108
	private String referentielGeo = null;
107
	private String referentielGeo = null;
109
 
108
 
Line 110... Line 109...
110
	// Pour remise a zero partielle lors d'une validation
109
	// Pour remise a zero partielle lors d'une validation
111
 
110
 
Line 112... Line 111...
112
	private  enum Champs {
111
	private  enum Champs {
113
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT, LATITUDE, LONGITUDE, ALTITUDE, ABONDANCE, CERTITUDE, REFERENTIELTAXO, PHENOLOGIE;
112
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, LOCALITE, ESPECE, TOUT, LATITUDE, LONGITUDE, ALTITUDE, ABONDANCE, CERTITUDE, REFERENTIELTAXO, PHENOLOGIE;
114
 
113
 
Line 115... Line 114...
115
	    @Override
114
	    @Override
116
		public String toString() {
115
		public String toString() {
Line 117... Line 116...
117
	    
116
	    
118
	    	switch(this) {
117
	    	switch(this) {
Line 119... Line 118...
119
	    	case DATE:
118
	    	case DATE:
Line 157... Line 156...
157
	    
156
	    
158
	    	case PHENOLOGIE:
157
	    	case PHENOLOGIE:
Line 159... Line 158...
159
	    		return "phenologie";
158
	    		return "phenologie";
160
	    
159
	    
161
	    	case TOUT:
160
	    	case TOUT:
162
	    		return "date, commune, lieu dit, station, milieu, espèce, commentaire, latitude, longitude, altitude, abondance, identification, referentiel, phenologie";
161
	    		return "date, localite, lieu dit, station, milieu, espèce, commentaire, latitude, longitude, altitude, abondance, identification, referentiel, phenologie";
163
	    	}
162
	    	}
164
			return TOUT.toString();
163
			return TOUT.toString();
Line 169... Line 168...
169
	private Button boutonOK = new Button("Créer");
168
	private Button boutonOK = new Button("Créer");
170
	private Button boutonModifier = new Button("Modifier");
169
	private Button boutonModifier = new Button("Modifier");
171
	private Button boutonSupprimer = new Button("Supprimer");
170
	private Button boutonSupprimer = new Button("Supprimer");
172
	private Button boutonAnnuler = new Button("Réinitialiser");
171
	private Button boutonAnnuler = new Button("Réinitialiser");
Line 173... Line 172...
173
 
172
 
174
	private boolean selectionCommune=false;
173
	private boolean selectionlocalite=false;
175
	private boolean selectionEspece=false;
174
	private boolean selectionEspece=false;
176
	private boolean selectionAbondance = false;
175
	private boolean selectionAbondance = false;
177
	private boolean selectionCertitude = false;
176
	private boolean selectionCertitude = false;
Line 178... Line 177...
178
	private boolean selectionPhenologie = false;
177
	private boolean selectionPhenologie = false;
Line 179... Line 178...
179
 
178
 
180
	private Toolbar bt = null ;
179
	private Toolbar bt = null ;
181
 
180
 
182
	private final String VALEURS_MULTIPLES = "(Valeurs multiples)";
181
	private final String VALEURS_MULTIPLES = "(Valeurs multiples)";
183
	private final String modeleMessageModif = "commune:lieu-dit:station:milieu:latitude:longitude:altitude:date:espece:commentaire:abondance:identification:referentiel:phenologie";
182
	private final String modeleMessageModif = "localite:lieu-dit:station:milieu:latitude:longitude:altitude:date:espece:commentaire:abondance:identification:referentiel:phenologie";
184
	private boolean communeModifiee = false;
183
	private boolean localiteModifiee = false;
185
	private boolean lieuDitModifie = false;
184
	private boolean lieuDitModifie = false;
186
	private boolean stationModifiee = false;
185
	private boolean stationModifiee = false;
Line 225... Line 224...
225
 
224
 
Line 226... Line 225...
226
	private TextField latitude;
225
	private TextField latitude;
Line 227... Line 226...
227
 
226
 
Line 228... Line 227...
228
	private TextField altitude;
227
	private TextField altitude;
Line 229... Line 228...
229
 
228
 
Line 230... Line 229...
230
	private MultiFieldPanel htmlCommunePanel = null;
229
	private MultiFieldPanel htmllocalitePanel = null;
Line 231... Line 230...
231
 
230
 
Line 232... Line 231...
232
	private MultiFieldPanel coordPanel;
231
	private MultiFieldPanel coordPanel;
Line 245... Line 244...
245
 
244
 
Line 246... Line 245...
246
	private boolean longModifiee;
245
	private boolean longModifiee;
Line 247... Line 246...
247
 
246
 
Line 248... Line 247...
248
	private boolean altModifiee;
247
	private boolean altModifiee;
Line 249... Line 248...
249
 
248
 
Line 250... Line 249...
250
	protected boolean rechercheCommuneEnCours = false;
249
	protected boolean recherchelocaliteEnCours = false;
Line 251... Line 250...
251
 
250
 
Line 324... Line 323...
324
		panneauSecondeColonne.setBorder(false);
323
		panneauSecondeColonne.setBorder(false);
Line 325... Line 324...
325
 
324
 
Line 326... Line 325...
326
		this.setPaddings(5) ;
325
		this.setPaddings(5) ;
327
 
326
 
Line 328... Line 327...
328
		// Accesskey pour debugging
327
		// Accesskey pour debugging
329
		commune = new ComboBox("Commune","commune\" accesskey=\"1");
328
		localite = new ComboBox("Localite","localite\" accesskey=\"1");
330
 
329
 
331
		final String resultTplCommune = "<div class=\"search-item-commune\">{commune}</div>";
330
		final String resultTpllocalite = "<div class=\"search-item-localite\">{localite}</div>";
332
		commune.setTpl(resultTplCommune);
331
		localite.setTpl(resultTpllocalite);
333
		commune.setMode(ComboBox.REMOTE);
332
		localite.setMode(ComboBox.REMOTE);
334
		commune.setItemSelector("div.search-item-commune");
333
		localite.setItemSelector("div.search-item-localite");
Line 335... Line 334...
335
		commune.setTypeAhead(true);
334
		localite.setTypeAhead(true);
336
		commune.setLoadingText("Recherche...");
335
		localite.setLoadingText("Recherche...");
337
		commune.setHideTrigger(true);
336
		localite.setHideTrigger(true);
338
 
337
 
339
		//création du lien "Accès carto" dans le formulaire
338
		//création du lien "Accès carto" dans le formulaire
Line 340... Line 339...
340
		String aideLienLocaliser = "Vous pouvez entrer une nom sous la forme commune (departement) ou bien commune (pays) "+
339
		String aideLienLocaliser = "Via une carte, obtenez les coordonnées (latitude/longitude) de votre observation, Vous pouvez entrer une nom sous la forme commune (departement) ou bien localite (pays) "+
341
									"avec un numéro de département sur 2 chiffres ou un code de pays àdeux lettres ";
340
									"avec un numéro de département sur 2 chiffres ou un code de pays à deux lettres (format iso 3166 1)";
342
		basculerverscarto = new HTML(" <a id=\"lien_carto\" title=\""+aideLienLocaliser+"\" href=\"#\" tabindex=\"2\">Localiser la zone</a>");
341
		basculerverscarto = new HTML(" <a id=\"lien_carto\" title=\""+aideLienLocaliser+"\" href=\"#\" tabindex=\"2\">Localiser la zone</a>");
343
		basculerverscarto.addStyleName("lien_actif");
342
		basculerverscarto.addStyleName("lien_actif");
Line 344... Line 343...
344
 
343
 
345
		//création info bulle sur le lien "accès carto"
344
		//création info bulle sur le lien "accès carto"
Line 346... Line 345...
346
		ToolTip tip2 = new ToolTip();
345
		ToolTip tip2 = new ToolTip();
347
		tip2.setHtml("Via une carte, obtenez les coordonnées (latitude/longitude) de votre observation ");
346
		tip2.setHtml(aideLienLocaliser);
348
		tip2.applyTo(basculerverscarto.getElement());
347
		tip2.applyTo(basculerverscarto.getElement());
Line 349... Line 348...
349
 
348
 
350
		//Sur une meme ligne, ajout de plusieurs champs
349
		//Sur une meme ligne, ajout de plusieurs champs
Line 351... Line 350...
351
		htmlCommunePanel = new MultiFieldPanel();
350
		htmllocalitePanel = new MultiFieldPanel();
Line 352... Line 351...
352
 
351
 
Line 353... Line 352...
353
		int largeurCommune = Window.getClientWidth()/4;
352
		int largeurlocalite = Window.getClientWidth()/4;
354
		htmlCommunePanel.addToRow(commune, largeurCommune);
353
		htmllocalitePanel.addToRow(localite, largeurlocalite);
Line 383... Line 382...
383
 
382
 
384
		altitude = new TextField("Alt (mètres)", "alt");
383
		altitude = new TextField("Alt (mètres)", "alt");
385
		altitude.setGrowMax(70);
384
		altitude.setGrowMax(70);
Line 386... Line 385...
386
		altitude.setAllowBlank(true);
385
		altitude.setAllowBlank(true);
Line 387... Line 386...
387
 
386
 
388
		lienSelectionCommune = new Label("");
387
		lienSelectionlocalite = new Label("");
389
 
388
 
Line 390... Line 389...
390
 
389
 
391
		lienSelectionCommune.setId("conteneur_selection_commune");
390
		lienSelectionlocalite.setId("conteneur_selection_localite");
392
		lienSelectionCommune.setStyleName("conteneur_selection_commune");
391
		lienSelectionlocalite.setStyleName("conteneur_selection_localite");
393
		lienSelectionCommune.addStyleName("lien_actif");
392
		lienSelectionlocalite.addStyleName("lien_actif");
Line 400... Line 399...
400
		final double largeur ;
399
		final double largeur ;
401
		largeur = 120;
400
		largeur = 120;
Line 402... Line 401...
402
 
401
 
403
		coordPanel.addToRow(latitude, new ColumnLayoutData(largeur));
402
		coordPanel.addToRow(latitude, new ColumnLayoutData(largeur));
404
		coordPanel.addToRow(longitude, new ColumnLayoutData(largeur));
403
		coordPanel.addToRow(longitude, new ColumnLayoutData(largeur));
405
		coordPanel.addToRow(lienSelectionCommune, new ColumnLayoutData(largeur));
404
		coordPanel.addToRow(lienSelectionlocalite, new ColumnLayoutData(largeur));
406
		lienSelectionCommune.addClass("lien_decale");
405
		lienSelectionlocalite.addClass("lien_decale");
Line 407... Line 406...
407
		coordPanel.setBorder(false);
406
		coordPanel.setBorder(false);
Line 408... Line 407...
408
 
407
 
Line 602... Line 601...
602
	        	panneauIntermediaire.setHeight(rawHeight);
601
	        	panneauIntermediaire.setHeight(rawHeight);
Line 603... Line 602...
603
	        
602
	        
604
	        	panneauPremierColonne.doLayout();
603
	        	panneauPremierColonne.doLayout();
Line 605... Line 604...
605
	        	panneauSecondeColonne.doLayout();
604
	        	panneauSecondeColonne.doLayout();
606
	        		        
605
	        		        
Line 607... Line 606...
607
	        	htmlCommunePanel.doLayout();
606
	        	htmllocalitePanel.doLayout();
608
	        	htmlPanel.doLayout();
607
	        	htmlPanel.doLayout();
609
	        
608
	        
Line 774... Line 773...
774
		lienCarto.addListener("click", new EventCallback() {
773
		lienCarto.addListener("click", new EventCallback() {
Line 775... Line 774...
775
 
774
 
776
			@Override
775
			@Override
Line 777... Line 776...
777
			public void execute(EventObject e) {
776
			public void execute(EventObject e) {
778
 
777
 
779
				if(commune.getValue() != null && !commune.getValue().equals("")) {
778
				if(localite.getValue() != null && !localite.getValue().equals("")) {
780
					obtenirInformationCommune();
779
					obtenirInformationLocalite();
781
					longlatAjoutee = true;
780
					longlatAjoutee = true;
782
				} else {
781
				} else {
783
					Window.alert("Veuillez renseigner une commune et un numéro de département sous la forme : Commune (departement)");
782
					Window.alert("Veuillez renseigner une localite suivie d'un numéro de département ou une localité suivie d'un code de pays à deux lettres \n Sous la forme : localite (departement) ou Localité (Pays)");
784
				}
783
				}
Line 785... Line 784...
785
			}
784
			}
Line 786... Line 785...
786
		});
785
		});
Line 787... Line 786...
787
 
786
 
788
		if(!Ext.isIE() && Window.getClientWidth() < 1200) {
787
		if(!Ext.isIE() && Window.getClientWidth() < 1200) {
789
 
788
 
790
			int largeurN = (int)largeur;
789
			int largeurN = (int)largeur;
791
 
790
 
Line 792... Line 791...
792
			latitude.setWidth(largeurN+"px");
791
			latitude.setWidth(largeurN+"px");
793
			longitude.setWidth(largeurN+"px");
792
			longitude.setWidth(largeurN+"px");
794
			lienSelectionCommune.setWidth(largeurN+"px");
793
			lienSelectionlocalite.setWidth(largeurN+"px");
795
		}
794
		}
Line 796... Line 795...
796
	}
795
	}
797
 
796
 
798
	private void ajouterListeners()
797
	private void ajouterListeners()
799
	{
798
	{
Line 800... Line 799...
800
		// Listener completion communne
799
		// Listener completion communne
Line 801... Line 800...
801
		final Rafraichissable r = this;
800
		final Rafraichissable r = this;
802
		  
801
		  
Line 826... Line 825...
826
		tCoord = new Timer() {
825
		tCoord = new Timer() {
Line 827... Line 826...
827
 
826
 
828
			@Override
827
			@Override
829
			public void run() {
828
			public void run() {
830
	        	double[] coord = coordonneesValides();
829
	        	double[] coord = coordonneesValides();
831
	        	if(!rechercheCommuneEnCours && coord != null && (longModifiee || latModifiee)) {
830
	        	if(!recherchelocaliteEnCours && coord != null && (longModifiee || latModifiee)) {
832
	        		rechercheCommuneEnCours = true;
831
	        		recherchelocaliteEnCours = true;
833
	        		Ext.get(lienSelectionCommune.getElement()).mask("recherche");
832
	        		Ext.get(lienSelectionlocalite.getElement()).mask("recherche");
834
	        		observationMediateur.obtenirInformationCoord(r,coord[0], coord[1]);
833
	        		observationMediateur.obtenirInformationCoord(r,coord[0], coord[1]);
835
	        	}
834
	        	}
Line 836... Line 835...
836
			}
835
			}
Line 837... Line 836...
837
 
836
 
838
		};
837
		};
839
 
838
 
840
		ajouterListenerChampEvenementsClavier(commune, listenerConfigCommune);
839
		ajouterListenerChampEvenementsClavier(localite, listenerConfiglocalite);
841
	    ajouterListenerChampEvenementsClavier(date);
840
	    ajouterListenerChampEvenementsClavier(date);
842
		ajouterListenerChampEvenementsClavier(selecteurReferentielTaxo);
841
		ajouterListenerChampEvenementsClavier(selecteurReferentielTaxo);
Line 888... Line 887...
888
		});
887
		});
Line 889... Line 888...
889
 
888
 
890
		this.addListener(new ContainerListenerAdapter() {
889
		this.addListener(new ContainerListenerAdapter() {
891
			@Override
890
			@Override
892
			public void onAfterLayout(Container self) {
891
			public void onAfterLayout(Container self) {
893
				commune.focus();
892
				localite.focus();
894
			}
893
			}
895
		});
894
		});
Line 896... Line 895...
896
	}
895
	}
897
 
896
 
898
	private void ajouterListenerChampsCombobox() {
897
	private void ajouterListenerChampsCombobox() {
899
		commune.addListener(new ComboBoxListenerAdapter() {
898
		localite.addListener(new ComboBoxListenerAdapter() {
900
            @Override
899
            @Override
901
			public void onSelect(ComboBox comboBox, Record record, int index) {
900
			public void onSelect(ComboBox comboBox, Record record, int index) {
902
                commune.setValue(record.getAsString("commune"));
-
 
903
                departement=record.getAsString("departement");
901
                localite.setValue(record.getAsString("localite"));
904
                codeLoc=record.getAsString("codeInsee");
902
                codeLocalite=record.getAsString("departement");
905
                selectionCommune=true;
903
                selectionlocalite=true;
Line 906... Line 904...
906
                commune.collapse();
904
                localite.collapse();
907
            }
905
            }
908
 
906
 
Line 1056... Line 1054...
1056
 
1054
 
1057
		if(champ.equals(date)) {
1055
		if(champ.equals(date)) {
1058
			validerSaisie(Champs.DATE);
1056
			validerSaisie(Champs.DATE);
Line 1059... Line 1057...
1059
		}
1057
		}
1060
 
1058
 
1061
		if(champ.equals(commune)) {
1059
		if(champ.equals(localite)) {
1062
			if(champ.equals(commune)) {
1060
			if(champ.equals(localite)) {
1063
				if (selectionCommune) {
1061
				if (selectionlocalite) {
1064
		    		 communeModifiee= true;
1062
		    		 localiteModifiee= true;
1065
		    		 selectionCommune=false;
1063
		    		 selectionlocalite=false;
1066
		    	 }
1064
		    	 }
1067
		    	else {
1065
		    	else {
1068
		    		validerSaisie(Champs.COMMUNE);
1066
		    		validerSaisie(Champs.LOCALITE);
1069
		    	 }
1067
		    	 }
1070
			}
1068
			}
Line 1126... Line 1124...
1126
 
1124
 
1127
		if(champ.equals(date)) {
1125
		if(champ.equals(date)) {
1128
			dateModifiee = true;
1126
			dateModifiee = true;
Line 1129... Line 1127...
1129
		}
1127
		}
1130
 
1128
 
1131
		if(champ.equals(commune)) {
1129
		if(champ.equals(localite)) {
1132
			departement="";
1130
			codeLocalite="";
1133
	    	commune.collapse();
1131
	    	localite.collapse();
1134
	    	obtenirListeReferentielCommune();
1132
	    	obtenirListeReferentiellocalite();
1135
	    	communeModifiee= true;
1133
	    	localiteModifiee= true;
Line 1136... Line 1134...
1136
		}
1134
		}
1137
	}
1135
	}
Line 1166... Line 1164...
1166
	}
1164
	}
Line 1167... Line 1165...
1167
 
1165
 
1168
	@Override
1166
	@Override
Line 1169... Line 1167...
1169
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
1167
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
1170
 
1168
 
1171
		// si l'on a reçu une liste du referentiel commune (completion referentiel commune)
1169
		// si l'on a reçu une liste du referentiel localite (completion referentiel localite)
1172
		if(nouvelleDonnees instanceof ListeReferentielCommune)
1170
		if(nouvelleDonnees instanceof ListeReferentielLocalite)
1173
		{
1171
		{
1174
			ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
1172
			ListeReferentielLocalite data = (ListeReferentielLocalite) nouvelleDonnees ;
Line 1175... Line 1173...
1175
			Object[][] communeData = new Object[data.size()][3];
1173
			Object[][] localiteData = new Object[data.size()][3];
1176
			int i = 0 ;
1174
			int i = 0 ;
1177
 
1175
 
1178
			// on la parse et on récupère les informations quiç nous interessent
1176
			// on la parse et on récupère les informations quiç nous interessent
Line 1179... Line 1177...
1179
			for (Iterator it = data.keySet().iterator(); it.hasNext();)
1177
			for (Iterator it = data.keySet().iterator(); it.hasNext();)
1180
			{
1178
			{
1181
				ReferentielCommune ref=data.get(it.next());
1179
				ReferentielLocalite ref=data.get(it.next());
1182
 
1180
 
1183
				communeData[i][0]= ref.getCommune();
1181
				localiteData[i][0]= ref.getLocalite();
Line 1184... Line 1182...
1184
				communeData[i][1]= ref.getDepartement();
1182
				localiteData[i][1]= ref.getCodeLocalite();
1185
				communeData[i][2]= ref.getCodeInsee();
1183
				localiteData[i][2]= ref.getCodeInsee();
1186
				i++ ;
1184
				i++ ;
1187
			}
1185
			}
Line 1188... Line 1186...
1188
 
1186
 
Line 1189... Line 1187...
1189
			// creation du store
1187
			// creation du store
Line 1190... Line 1188...
1190
			FieldDef defCommune = new StringFieldDef("commune");
1188
			FieldDef deflocalite = new StringFieldDef("localite");
1191
			FieldDef defDepartement = new StringFieldDef("departement");
1189
			FieldDef defDepartement = new StringFieldDef("departement");
Line 1192... Line 1190...
1192
			FieldDef defCodeInsee = new StringFieldDef("codeInsee");
1190
			FieldDef defCodeInsee = new StringFieldDef("codeInsee");
1193
 
1191
 
1194
			FieldDef[] defTab = { defCommune, defDepartement, defCodeInsee};
1192
			FieldDef[] defTab = { deflocalite, defDepartement, defCodeInsee};
Line 1195... Line 1193...
1195
 
1193
 
Line 1196... Line 1194...
1196
			RecordDef rd = new RecordDef(defTab);
1194
			RecordDef rd = new RecordDef(defTab);
Line 1273... Line 1271...
1273
		}
1271
		}
Line 1274... Line 1272...
1274
 
1272
 
1275
		if(nouvelleDonnees instanceof EntiteGeographiqueObservation)
1273
		if(nouvelleDonnees instanceof EntiteGeographiqueObservation)
1276
		{
1274
		{
1277
			EntiteGeographiqueObservation infosComm = (EntiteGeographiqueObservation)nouvelleDonnees ;
1275
			EntiteGeographiqueObservation infosComm = (EntiteGeographiqueObservation)nouvelleDonnees ;
1278
			if(rechercheCommuneEnCours) {
1276
			if(recherchelocaliteEnCours) {
1279
				afficherIndicationCommune(infosComm);
1277
				afficherIndicationlocalite(infosComm);
1280
			} else {
1278
			} else {
1281
				rafraichirCommuneEtCoord(infosComm);
1279
				rafraichirlocaliteEtCoord(infosComm);
1282
			}
1280
			}
1283
		}
1281
		}
Line 1284... Line 1282...
1284
	}
1282
	}
1285
 
1283
 
Line 1286... Line 1284...
1286
	private void afficherIndicationCommune(
1284
	private void afficherIndicationlocalite(
1287
			final EntiteGeographiqueObservation infosCom) {
1285
			final EntiteGeographiqueObservation infosCom) {
1288
 
1286
 
1289
		String nCommune = "";
1287
		String nlocalite = "";
1290
		if(infosCom != null && infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().trim().isEmpty()){
1288
		if(infosCom != null && infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().trim().isEmpty()){
1291
			nCommune += infosCom.getZoneGeo();
1289
			nlocalite += infosCom.getZoneGeo();
1292
			if(!infosCom.getIdZoneGeo().trim().isEmpty()) {
-
 
1293
				if(Util.estUnNombre(infosCom.getIdZoneGeo())) {
-
 
1294
					nCommune += " ("+Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo())+")";
1290
			if(!infosCom.getIdZoneGeo().trim().isEmpty()) {
-
 
1291
				if(Util.estUnNombre(infosCom.getIdZoneGeo())) {
-
 
1292
					nlocalite += " ("+Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo())+")";
1295
				} else if(infosCom.getPays() != null && infosCom.getPays().trim().isEmpty()) {
1293
				}
Line 1296... Line 1294...
1296
					nCommune += " ("+infosCom.getPays()+")";
1294
			} else if(infosCom.getPays() != null && !infosCom.getPays().trim().isEmpty()) {
1297
				}
1295
				nlocalite += " ("+infosCom.getPays()+")";
Line 1298... Line 1296...
1298
			}
1296
			}
1299
 
1297
 
1300
			lienSelectionCommune.setHtml("<a id=\"lien_selection_commune\" tabindex=\"9\">"+nCommune+"</a>");
1298
			lienSelectionlocalite.setHtml("<a id=\"lien_selection_localite\" tabindex=\"9\">"+nlocalite+"</a>");
1301
			lienSelectionCommune.setStyleName("img-curseur-depl");
1299
			lienSelectionlocalite.setStyleName("img-curseur-depl");
1302
 
1300
 
1303
			Ext.get("lien_selection_commune").addListener("click",new EventCallback() {
1301
			Ext.get("lien_selection_localite").addListener("click",new EventCallback() {
Line 1304... Line 1302...
1304
				@Override
1302
				@Override
1305
				public void execute(EventObject e) {
1303
				public void execute(EventObject e) {
1306
					rafraichirCommune(infosCom);
1304
					rafraichirlocalite(infosCom);
1307
				}
1305
				}
1308
			});
1306
			});
1309
 
1307
 
1310
			Ext.get("lien_selection_commune").addListener("keypress",new EventCallback() {
1308
			Ext.get("lien_selection_localite").addListener("keypress",new EventCallback() {
1311
				@Override
1309
				@Override
Line 1312... Line 1310...
1312
				public void execute(EventObject e) {
1310
				public void execute(EventObject e) {
1313
					if(e.getCharCode() == KEY_ENTER) {
1311
					if(e.getCharCode() == KEY_ENTER) {
1314
						rafraichirCommune(infosCom);
1312
						rafraichirlocalite(infosCom);
1315
					}
1313
					}
1316
				}
1314
				}
1317
			});
1315
			});
Line 1318... Line 1316...
1318
 
1316
 
1319
			Ext.get("lien_selection_commune").addListener("focus",new EventCallback() {
1317
			Ext.get("lien_selection_localite").addListener("focus",new EventCallback() {
1320
				@Override
1318
				@Override
1321
				public void execute(EventObject e) {
1319
				public void execute(EventObject e) {
1322
					Ext.get("lien_selection_commune").toggleClass("lien_sel");
1320
					Ext.get("lien_selection_localite").toggleClass("lien_sel");
1323
				}
1321
				}
Line 1324... Line 1322...
1324
			});
1322
			});
1325
 
1323
 
1326
			Ext.get("lien_selection_commune").addListener("blur",new EventCallback() {
1324
			Ext.get("lien_selection_localite").addListener("blur",new EventCallback() {
1327
				@Override
1325
				@Override
1328
				public void execute(EventObject e) {
1326
				public void execute(EventObject e) {
1329
					Ext.get("lien_selection_commune").toggleClass("lien_sel");
1327
					Ext.get("lien_selection_localite").toggleClass("lien_sel");
1330
				}
1328
				}
Line 1331... Line 1329...
1331
			});
1329
			});
1332
 
1330
 
1333
		} else {
1331
		} else {
Line 1334... Line 1332...
1334
			if(rechercheCommuneEnCours) {
1332
			if(recherchelocaliteEnCours) {
1335
				lienSelectionCommune.setHtml("<span id=\"aucune_selection_commune\"> Erreur de localisation </span>");
1333
				lienSelectionlocalite.setHtml("<span id=\"aucune_selection_localite\"> Erreur de localisation </span>");
Line 1336... Line 1334...
1336
			} else {
1334
			} else {
1337
				lienSelectionCommune.setHtml("<span id=\"aucune_selection_commune\"> </span>");
1335
				lienSelectionlocalite.setHtml("<span id=\"aucune_selection_localite\"> </span>");
1338
			}
1336
			}
Line 1339... Line 1337...
1339
		}
1337
		}
1340
 
1338
 
1341
		Ext.get(lienSelectionCommune.getElement()).unmask();
1339
		Ext.get(lienSelectionlocalite.getElement()).unmask();
1342
		rechercheCommuneEnCours = false;
1340
		recherchelocaliteEnCours = false;
1343
	}
1341
	}
1344
 
1342
 
1345
	private void rafraichirCommune(EntiteGeographiqueObservation infosCom) {
1343
	private void rafraichirlocalite(EntiteGeographiqueObservation infosCom) {
Line 1346... Line 1344...
1346
		String nCommune = "";
1344
		String nlocalite = "";
-
 
1345
 
-
 
1346
		if(infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().equals("")) {
1347
 
1347
			nlocalite += infosCom.getZoneGeo();
-
 
1348
		}
1348
		if(infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().equals("")) {
1349
		
1349
			nCommune += infosCom.getZoneGeo();
1350
		if(Util.estUnNombre(infosCom.getIdZoneGeo())) {
1350
		}
1351
			String codeGeoFormate = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
Line 1351... Line 1352...
1351
		
1352
			nlocalite += " ("+codeGeoFormate+")";
1352
		if(Util.estUnNombre(infosCom.getIdZoneGeo())) {
1353
			codeLocalite = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
Line 1353... Line 1354...
1353
			String codeGeoFormate = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
1354
		} else if(infosCom.getPays() != null && !infosCom.getPays().trim().isEmpty()) {
1354
			nCommune += " ("+codeGeoFormate+")";
1355
			nlocalite += " ("+infosCom.getPays()+")";
1355
			departement = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
1356
		}
1356
		} else if(infosCom.getPays() != null && infosCom.getPays().trim().isEmpty()) {
1357
		
Line 1357... Line 1358...
1357
			nCommune += " ("+infosCom.getPays()+")";
1358
		if (!nlocalite.equals("")) {
Line 1379... Line 1380...
1379
		longModifiee = true;
1380
		longModifiee = true;
Line 1380... Line 1381...
1380
 
1381
 
1381
		coordPanel.setVisible(true);
1382
		coordPanel.setVisible(true);
Line 1382... Line 1383...
1382
	}
1383
	}
Line 1383... Line 1384...
1383
 
1384
 
1384
	public void obtenirListeReferentielCommune() {
1385
	public void obtenirListeReferentiellocalite() {
Line 1385... Line 1386...
1385
 
1386
 
Line 1386... Line 1387...
1386
	 String com=commune.getText();
1387
	 String com=localite.getText();
Line 1387... Line 1388...
1387
	 com=com.replaceAll("%","");
1388
	 com=com.replaceAll("%","");
1388
 
1389
 
Line 1416... Line 1417...
1416
			Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
1417
			Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
1417
			date.setInvalidText("Date invalide");
1418
			date.setInvalidText("Date invalide");
1418
			return;
1419
			return;
1419
		}
1420
		}
Line 1420... Line -...
1420
 
-
 
1421
		if(departement != null) {
-
 
1422
			if(departement.equals("000null") || departement.equals("")) {
-
 
1423
				String[] depCom = commune.getText().split(" ");
-
 
1424
				if(depCom.length > 1) {
-
 
1425
					String dep = depCom[1].replace('(', ' ');
1421
 
1426
					dep =dep.replace(')', ' ');
-
 
1427
					dep = dep.trim();
-
 
1428
					dep = dep.replace('\\',' ');
-
 
1429
					dep = dep.trim();
-
 
1430
 
-
 
1431
					try
-
 
1432
					{
-
 
1433
						int nDep = Integer.parseInt(dep);
-
 
1434
						if(nDep > 0 && nDep < 110) {
-
 
1435
							departement = dep ;
-
 
1436
						}
-
 
1437
					}
-
 
1438
					catch(NumberFormatException e)
-
 
1439
					{
-
 
1440
						departement = "" ;
-
 
1441
					}
-
 
1442
				}
-
 
1443
			}
-
 
Line 1444... Line 1422...
1444
		}
1422
		affecterCodeLocaliteOuPays();
Line 1445... Line 1423...
1445
 
1423
 
Line 1446... Line 1424...
1446
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
1424
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
-
 
1425
 
1447
 
1426
		Observation obs=new Observation(espece.getText(),numeroNom,localite.getText(),codeLocalite,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
1448
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
1427
 
1449
 
1428
		String[] coords = getValeurCoordonnees();
Line 1450... Line 1429...
1450
		String[] coords = getValeurCoordonnees();
1429
		obs.setPays(pays);
Line 1472... Line 1451...
1472
			Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
1451
			Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
1473
			date.setInvalidText("Date invalide");
1452
			date.setInvalidText("Date invalide");
1474
			return;
1453
			return;
1475
		}
1454
		}
Line 1476... Line -...
1476
 
-
 
1477
		if(departement.equals("000null") || departement.equals("")) {
-
 
1478
			String[] depCom = commune.getText().split(" ");
-
 
1479
			if(depCom.length > 1) {
-
 
1480
				String dep = depCom[1].replace('(', ' ');
-
 
1481
				dep =dep.replace(')', ' ');
-
 
1482
				dep = dep.trim();
1455
 
1483
				dep = dep.replace('\\',' ');
-
 
1484
				dep = dep.trim();
-
 
1485
 
-
 
1486
				try
-
 
1487
				{
-
 
1488
					int nDep = Integer.parseInt(dep);
-
 
1489
					if(nDep > 0 && nDep < 110) {
-
 
1490
						departement = dep ;
-
 
1491
					}
-
 
1492
				}
-
 
1493
				catch(NumberFormatException e)
-
 
1494
				{
-
 
1495
					departement = "" ;
-
 
1496
				}
-
 
1497
			}
-
 
1498
		}
1456
		affecterCodeLocaliteOuPays();
1499
 
1457
		
Line 1500... Line 1458...
1500
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
1458
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
1501
 
1459
 
Line 1502... Line 1460...
1502
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
1460
		Observation obs=new Observation(espece.getText(),numeroNom,localite.getText(),codeLocalite,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
Line -... Line 1461...
-
 
1461
		obs.setNumeroOrdre(numeroOrdre);
1503
		obs.setNumeroOrdre(numeroOrdre);
1462
 
1504
 
1463
		String[] coords = getValeurCoordonnees();
1505
		String[] coords = getValeurCoordonnees();
1464
 
Line 1506... Line 1465...
1506
 
1465
		obs.setPays(pays);
Line 1515... Line 1474...
1515
		obs.setChampsEtendus(getValeursChampsEtendus());
1474
		obs.setChampsEtendus(getValeursChampsEtendus());
Line 1516... Line 1475...
1516
 
1475
 
1517
		observationMediateur.modifierObservation(obs);
1476
		observationMediateur.modifierObservation(obs);
Line -... Line 1477...
-
 
1477
	}
-
 
1478
 
-
 
1479
	private void affecterCodeLocaliteOuPays() {
-
 
1480
		
-
 
1481
		codeLocalite = "";
-
 
1482
		pays = "";
-
 
1483
		
-
 
1484
		// Soit un numéro de département, soit un code de pays à deux lettres
-
 
1485
		String[] codeCom = localite.getText().split(" ");
-
 
1486
		if(codeCom.length > 1) {
-
 
1487
			String codeLoc = codeCom[1].replace('(', ' ');
-
 
1488
			codeLoc = codeLoc.replace(')', ' ').trim().replace('\\',' ').trim();
-
 
1489
 
-
 
1490
			if(Util.estUnNombre(codeLoc)) {
-
 
1491
				codeLocalite = codeLoc ;
-
 
1492
			} else {
-
 
1493
				pays = codeLoc;
-
 
1494
			}
-
 
1495
		}
1518
	}
1496
	}
Line 1519... Line 1497...
1519
 
1497
 
-
 
1498
	private void modifierObservationEnMasse(Champs champModifie) {
1520
	private void modifierObservationEnMasse(Champs champModifie) {
1499
 
1521
 
1500
		//TODO: factoriser
1522
		//TODO: factoriser
1501
		String paysM = null;
1523
		String communeM = null;
1502
		String localiteM = null;
1524
		String departementM = null;
1503
		String codeLocaliteM = null;
1525
		String numNomSelM = null;
1504
		String numNomSelM = null;
1526
		String lieuDitM = null;
1505
		String lieuDitM = null;
Line 1537... Line 1516...
1537
		String referentielTaxoM = null;
1516
		String referentielTaxoM = null;
1538
		String phenologieM = null;
1517
		String phenologieM = null;
Line 1539... Line 1518...
1539
 
1518
 
Line 1540... Line 1519...
1540
		String champs = modeleMessageModif;
1519
		String champs = modeleMessageModif;
-
 
1520
 
1541
 
1521
		if(localiteModifiee && ! localite.getRawValue().equals(VALEURS_MULTIPLES)) {
-
 
1522
			
-
 
1523
			localiteM = localite.getText();	
-
 
1524
			
-
 
1525
			// Soit un numéro de département, soit un code de pays à deux lettres
-
 
1526
			String[] codeCom = localite.getText().split(" ");
-
 
1527
			if(codeCom.length > 1) {
Line 1542... Line -...
1542
		if(communeModifiee && ! commune.getRawValue().equals(VALEURS_MULTIPLES)) {
-
 
1543
			communeM = commune.getText();
-
 
1544
 
1528
				String codeLoc = codeCom[1].replace('(', ' ');
1545
			if(departement.equals("000null") || departement.equals("")) {
-
 
1546
				String[] depCom = commune.getText().split(" ");
1529
				codeLoc = codeLoc.replace(')', ' ').trim().replace('\\',' ').trim();
1547
				if(depCom.length > 1) {
-
 
1548
					String dep = depCom[1].replace('(', ' ');
-
 
1549
					dep =dep.replace(')', ' ');
-
 
1550
					dep = dep.trim();
-
 
1551
					dep = dep.replace('\\',' ');
1530
 
1552
					dep = dep.trim();
-
 
1553
 
-
 
1554
					try {
1531
				if(Util.estUnNombre(codeLoc)) {
1555
						int nDep = Integer.parseInt(dep);
-
 
1556
						if(nDep > 0 && nDep < 110) {
-
 
1557
							departement = dep ;
-
 
1558
						}
-
 
1559
					}
-
 
1560
					catch(NumberFormatException e) {
1532
					codeLocaliteM = codeLoc ;
1561
						departement = "" ;
1533
				} else {
1562
					}
-
 
1563
				}
1534
					paysM = codeLoc;
1564
			}
1535
				}
1565
			departementM = departement;
1536
			}
1566
		}
1537
		}
Line 1567... Line 1538...
1567
		else {
1538
		else {
1568
			champs = champs.replaceAll("commune", "");
1539
			champs = champs.replaceAll("localite", "");
1569
		}
1540
		}
Line 1656... Line 1627...
1656
		String message = "Voulez vous modifier le(s) champ(s) suivant(s) : "+champs+"   pour les observations selectionnées ?" ;
1627
		String message = "Voulez vous modifier le(s) champ(s) suivant(s) : "+champs+"   pour les observations selectionnées ?" ;
Line 1657... Line 1628...
1657
 
1628
 
1658
		if(champs.trim().equals("")) {
1629
		if(champs.trim().equals("")) {
1659
			Window.alert("Aucun champ n'a été modifié");
1630
			Window.alert("Aucun champ n'a été modifié");
1660
		} else {
1631
		} else {
-
 
1632
			Observation obs = new Observation(especeM,numNomSelM,localiteM,codeLocaliteM,lieuDitM,stationM,milieuM, commM,dateM);
1661
			Observation obs = new Observation(especeM,numNomSelM,communeM,departementM,lieuDitM,stationM,milieuM, commM,dateM);
1633
			obs.setPays(paysM);
1662
			obs.setNumeroOrdre(numeroOrdre);
1634
			obs.setNumeroOrdre(numeroOrdre);
1663
			obs.setLatitude(latM);
1635
			obs.setLatitude(latM);
1664
			obs.setLongitude(longM);
1636
			obs.setLongitude(longM);
1665
			obs.setAltitude(altM);
1637
			obs.setAltitude(altM);
Line 1695... Line 1667...
1695
			idLoc = obs.getIdentifiantLocalite();
1667
			idLoc = obs.getIdentifiantLocalite();
1696
			if(idLoc.length() == 5) {
1668
			if(idLoc.length() == 5) {
1697
				idLoc = idLoc.substring(0,2);
1669
				idLoc = idLoc.substring(0,2);
1698
			}
1670
			}
1699
		}
1671
		}
-
 
1672
		
-
 
1673
		if(obs.getIdentifiantLocalite().isEmpty() && !obs.getPays().isEmpty()) {
-
 
1674
			idLoc = obs.getPays();
-
 
1675
		}
Line 1700... Line 1676...
1700
 
1676
 
1701
		if(!obs.getDate().equals("null") && !obs.getDate().equals("000null") && !obs.getDate().equals(VALEURS_MULTIPLES)) {
1677
		if(!obs.getDate().equals("null") && !obs.getDate().equals("000null") && !obs.getDate().equals(VALEURS_MULTIPLES)) {
1702
			String[] dateEtHeure = obs.getDate().split(" ", 2);
1678
			String[] dateEtHeure = obs.getDate().split(" ", 2);
1703
			if(verifierFormatDate(dateEtHeure[0])) {
1679
			if(verifierFormatDate(dateEtHeure[0])) {
Line 1726... Line 1702...
1726
 
1702
 
1727
		}
1703
		}
1728
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
1704
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
1729
			if(!idLoc.equals("000null") && !idLoc.equals("")) {
1705
			if(!idLoc.equals("000null") && !idLoc.equals("")) {
1730
				if(!idLoc.equals(VALEURS_MULTIPLES)) {
1706
				if(!idLoc.equals(VALEURS_MULTIPLES)) {
1731
					commune.setValue(obs.getLocalite()+" ("+idLoc+")") ;
1707
					localite.setValue(obs.getLocalite()+" ("+idLoc+")") ;
1732
				} else {
1708
				} else {
1733
					commune.setValue(VALEURS_MULTIPLES);
1709
					localite.setValue(VALEURS_MULTIPLES);
1734
				}
1710
				}
1735
			}
1711
			}
1736
			else
1712
			else
1737
			{
1713
			{
1738
				commune.setValue(obs.getLocalite());
1714
				localite.setValue(obs.getLocalite());
1739
			}
1715
			}
1740
		}
1716
		}
1741
		if(!obs.getIdentifiantLocalite().equals("null") && !obs.getIdentifiantLocalite().equals("000null")) {
1717
		if(!obs.getIdentifiantLocalite().equals("null") && !obs.getIdentifiantLocalite().equals("000null")) {
1742
			departement = idLoc;
1718
			codeLocalite = idLoc;
1743
		}
1719
		}
1744
		if(!obs.getNomSaisi().equals("null") && !obs.getNomSaisi().equals("000null")) {
1720
		if(!obs.getNomSaisi().equals("null") && !obs.getNomSaisi().equals("000null")) {
1745
			espece.setValue(obs.getNomSaisi()) ;
1721
			espece.setValue(obs.getNomSaisi()) ;
1746
		}
1722
		}
Line 1927... Line 1903...
1927
 
1903
 
1928
			case COMMENT:
1904
			case COMMENT:
1929
				comment.reset() ;
1905
				comment.reset() ;
Line 1930... Line 1906...
1930
				break;
1906
				break;
1931
 
1907
 
1932
			case COMMUNE:
1908
			case LOCALITE:
-
 
1909
				localite.reset() ;
1933
				commune.reset() ;
1910
				codeLocalite ="";
1934
				departement ="";
1911
				pays="";
1935
				latitude.reset();
1912
				latitude.reset();
Line 1936... Line 1913...
1936
				longitude.reset();
1913
				longitude.reset();
Line 1942... Line 1919...
1942
				numeroOrdre = "";
1919
				numeroOrdre = "";
1943
				break;
1920
				break;
Line 1944... Line 1921...
1944
 
1921
 
1945
			case LATITUDE:
1922
			case LATITUDE:
1946
				latitude.reset();
1923
				latitude.reset();
1947
				afficherIndicationCommune(null);
1924
				afficherIndicationlocalite(null);
Line 1948... Line 1925...
1948
				break;
1925
				break;
1949
 
1926
 
1950
			case LONGITUDE:
1927
			case LONGITUDE:
1951
				longitude.reset();
1928
				longitude.reset();
Line 1952... Line 1929...
1952
				afficherIndicationCommune(null);
1929
				afficherIndicationlocalite(null);
1953
				break;
1930
				break;
1954
 
1931
 
Line 1971... Line 1948...
1971
			case PHENOLOGIE:
1948
			case PHENOLOGIE:
1972
				selecteurStadePheno.setValue("");
1949
				selecteurStadePheno.setValue("");
1973
				break;
1950
				break;
Line 1974... Line 1951...
1974
 
1951
 
1975
			case TOUT:
1952
			case TOUT:
1976
				commune.reset();
1953
				localite.reset();
1977
				date.reset() ;
1954
				date.reset() ;
1978
				lieudit.reset() ;
1955
				lieudit.reset() ;
1979
				station.reset() ;
1956
				station.reset() ;
1980
				milieu.reset() ;
1957
				milieu.reset() ;
1981
				comment.reset() ;
1958
				comment.reset() ;
1982
				milieu.reset() ;
1959
				milieu.reset() ;
1983
				latitude.reset();
1960
				latitude.reset();
1984
				longitude.reset();
1961
				longitude.reset();
-
 
1962
				altitude.reset();
1985
				altitude.reset();
1963
				pays="";
1986
				departement ="";
1964
				codeLocalite ="";
1987
				espece.reset();
1965
				espece.reset();
1988
				selecteurAbondance.clearValue();
1966
				selecteurAbondance.clearValue();
1989
				selecteurCertitude.clearValue();
1967
				selecteurCertitude.clearValue();
1990
				selecteurReferentielTaxo.clearValue();
1968
				selecteurReferentielTaxo.clearValue();
1991
				selecteurStadePheno.clearValue();
1969
				selecteurStadePheno.clearValue();
1992
				referentielTaxo = "";
1970
				referentielTaxo = "";
1993
				numeroNom = "" ;
1971
				numeroNom = "" ;
1994
				numeroOrdre = "";
1972
				numeroOrdre = "";
1995
				afficherIndicationCommune(null);
1973
				afficherIndicationlocalite(null);
Line 1996... Line 1974...
1996
				break;
1974
				break;
Line 1997... Line 1975...
1997
 
1975
 
Line 2025... Line 2003...
2025
		return selectionMultiple;
2003
		return selectionMultiple;
2026
	}
2004
	}
Line 2027... Line 2005...
2027
 
2005
 
Line -... Line 2006...
-
 
2006
	private void calculerAfficherDifferences(ListeObservation listeObs) {
2028
	private void calculerAfficherDifferences(ListeObservation listeObs) {
2007
 
2029
 
2008
		String codeLocalite = null;
2030
		String departement = null;
2009
		String pays = null;
2031
		String commune = null;
2010
		String localite = null;
2032
		String lieuDit = null;
2011
		String lieuDit = null;
2033
		String station = null;
2012
		String station = null;
2034
		String milieu = null;
2013
		String milieu = null;
Line 2045... Line 2024...
2045
 
2024
 
Line 2046... Line 2025...
2046
		String ordreObs = "";
2025
		String ordreObs = "";
2047
 
2026
 
-
 
2027
		for(Iterator<String> it = listeObs.keySet().iterator();it.hasNext();) {
2048
		for(Iterator<String> it = listeObs.keySet().iterator();it.hasNext();) {
2028
			Observation obsEnCours = listeObs.get(it.next());
2049
			Observation obsEnCours = listeObs.get(it.next());
2029
			pays = comparerDifferencesChamps(pays, obsEnCours.getPays());
2050
			departement = comparerDifferencesChamps(departement, obsEnCours.getIdentifiantLocalite());
2030
			codeLocalite = comparerDifferencesChamps(codeLocalite, obsEnCours.getIdentifiantLocalite());
2051
			commune = comparerDifferencesChamps(commune, obsEnCours.getLocalite());
2031
			localite = comparerDifferencesChamps(localite, obsEnCours.getLocalite());
2052
			lieuDit = comparerDifferencesChamps(lieuDit, obsEnCours.getLieudit());
2032
			lieuDit = comparerDifferencesChamps(lieuDit, obsEnCours.getLieudit());
2053
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
2033
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
2054
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
2034
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
Line 2064... Line 2044...
2064
			phenologie = comparerDifferencesChamps(phenologie, obsEnCours.getPhenologie());
2044
			phenologie = comparerDifferencesChamps(phenologie, obsEnCours.getPhenologie());
Line 2065... Line 2045...
2065
 
2045
 
2066
			ordreObs += obsEnCours.getNumeroOrdre()+",";
2046
			ordreObs += obsEnCours.getNumeroOrdre()+",";
Line 2067... Line 2047...
2067
		}
2047
		}
-
 
2048
 
2068
 
2049
		Observation obs=new Observation(espece,numeroNom,localite,codeLocalite,lieuDit,station,milieu, notes,date);
2069
		Observation obs=new Observation(espece,numeroNom,commune,departement,lieuDit,station,milieu, notes,date);
2050
		obs.setPays(pays);
2070
		obs.setNumeroOrdre(ordreObs);
2051
		obs.setNumeroOrdre(ordreObs);
2071
		obs.setLatitude(lat);
2052
		obs.setLatitude(lat);
2072
		obs.setLongitude(lon);
2053
		obs.setLongitude(lon);
Line 2093... Line 2074...
2093
			}
2074
			}
2094
		return retour;
2075
		return retour;
2095
	}
2076
	}
Line 2096... Line 2077...
2096
 
2077
 
2097
	private void reinitialiserValeurModifiees() {
2078
	private void reinitialiserValeurModifiees() {
2098
		communeModifiee = false;
2079
		localiteModifiee = false;
2099
		lieuDitModifie = false;
2080
		lieuDitModifie = false;
2100
		stationModifiee = false;
2081
		stationModifiee = false;
2101
		milieuModifie = false;
2082
		milieuModifie = false;
2102
		dateModifiee = false;
2083
		dateModifiee = false;
Line 2111... Line 2092...
2111
		phenologieModifiee = false;
2092
		phenologieModifiee = false;
2112
	}
2093
	}
Line 2113... Line 2094...
2113
 
2094
 
2114
	public void saisieTabindex()
2095
	public void saisieTabindex()
2115
	{
2096
	{
2116
		commune.setTabIndex(1);
2097
		localite.setTabIndex(1);
2117
		lieudit.setTabIndex(3);
2098
		lieudit.setTabIndex(3);
2118
		station.setTabIndex(4);
2099
		station.setTabIndex(4);
2119
		milieu.setTabIndex(5);
2100
		milieu.setTabIndex(5);
2120
		coordonnees.setTabIndex(-1);
2101
		coordonnees.setTabIndex(-1);
Line 2193... Line 2174...
2193
				observationMediateur.afficherFenetreCarto();
2174
				observationMediateur.afficherFenetreCarto();
2194
			}
2175
			}
2195
		}
2176
		}
2196
	}
2177
	}
Line 2197... Line 2178...
2197
 
2178
 
2198
	private void obtenirInformationCommune() {
2179
	private void obtenirInformationLocalite() {
2199
		String idLoc = "";
2180
		String idLoc = "";
2200
		if(departement != null && !departement.isEmpty()) {
2181
		if(codeLocalite != null && !codeLocalite.isEmpty()) {
2201
			idLoc = departement;
2182
			idLoc = codeLocalite;
2202
		} else {
2183
		} else {
2203
			idLoc = Util.obtenirIdLocAPartirChaineCommune(commune.getText());
2184
			idLoc = Util.obtenirIdLocAPartirChaineLocalite(localite.getText());
2204
			if(Util.estUnNombre(idLoc)) {
2185
			if(Util.estUnNombre(idLoc)) {
2205
				idLoc = Util.formaterDepartement(idLoc);
2186
				idLoc = Util.formaterDepartement(idLoc);
2206
			}
2187
			}
2207
		}
2188
		}
2208
		observationMediateur.obtenirInformationCommune(getCommuneSansIdLoc(), idLoc);
2189
		observationMediateur.obtenirInformationLocalite(getlocaliteSansIdLoc(), idLoc);
Line 2209... Line 2190...
2209
	}
2190
	}
2210
 
2191
 
Line 2232... Line 2213...
2232
			String[] coord = {"","" };
2213
			String[] coord = {"","" };
2233
			return coord;
2214
			return coord;
2234
		}
2215
		}
2235
	}
2216
	}
Line 2236... Line 2217...
2236
 
2217
 
Line 2237... Line 2218...
2237
	public String getCommune() {
2218
	public String getlocalite() {
Line 2238... Line 2219...
2238
 
2219
 
2239
		String valeurCommune = "";
2220
		String valeurlocalite = "";
2240
 
2221
 
2241
		if(commune.getValue() != null) {
2222
		if(localite.getValue() != null) {
2242
			valeurCommune = commune.getValue();
2223
			valeurlocalite = localite.getValue();
Line 2243... Line 2224...
2243
		}
2224
		}
2244
		return valeurCommune;
2225
		return valeurlocalite;
2245
	}
2226
	}
Line 2246... Line 2227...
2246
 
2227
 
2247
	public String getCommuneSansIdLoc() {
2228
	public String getlocaliteSansIdLoc() {
2248
		return Util.supprimerChaineIdLocalite(getCommune());
2229
		return Util.supprimerChaineIdLocalite(getlocalite());
Line 2282... Line 2263...
2282
	public String getReferentielTaxo() {
2263
	public String getReferentielTaxo() {
2283
		String codeCourt = getValeurChampListeLibre(selecteurReferentielTaxo);
2264
		String codeCourt = getValeurChampListeLibre(selecteurReferentielTaxo);
2284
		return Ontologies.getInfosReferentielNomParCode(codeCourt).getCodeVersionComplet();
2265
		return Ontologies.getInfosReferentielNomParCode(codeCourt).getCodeVersionComplet();
2285
	}
2266
	}
Line 2286... Line 2267...
2286
 
2267
 
2287
	public boolean communeInitialisee() {
2268
	public boolean localiteInitialisee() {
2288
		return communeModifiee;
2269
		return localiteModifiee;
Line 2289... Line 2270...
2289
	}
2270
	}
2290
 
2271
 
2291
	public void redimensionnerFormulaire() {
2272
	public void redimensionnerFormulaire() {