Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 248 Rev 264
Line 4... Line 4...
4
 
4
 
5
import java.util.Date;
5
import java.util.Date;
Line 6... Line 6...
6
import java.util.Iterator;
6
import java.util.Iterator;
-
 
7
 
7
 
8
import org.tela_botanica.client.interfaces.Rafraichissable;
8
import org.tela_botanica.client.interfaces.Rafraichissable;
9
import org.tela_botanica.client.modeles.Configuration;
9
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
10
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
10
import org.tela_botanica.client.modeles.ListeObservation;
11
import org.tela_botanica.client.modeles.ListeObservation;
11
import org.tela_botanica.client.modeles.ListeReferentielCommune;
12
import org.tela_botanica.client.modeles.ListeReferentielCommune;
Line 86... Line 87...
86
	private ComboBox  commune = null;
87
	private ComboBox  commune = null;
87
	private String departement = null;
88
	private String departement = null;
88
	private ComboBox  espece = null;
89
	private ComboBox  espece = null;
89
	private String numeroNom = null;
90
	private String numeroNom = null;
90
	private String numeroOrdre = null;
91
	private String numeroOrdre = null;
-
 
92
	
-
 
93
	private String referentielGeo = null;
Line 91... Line 94...
91
 
94
 
Line 92... Line 95...
92
	// Pour remise a zero partielle lors d'une validation
95
	// Pour remise a zero partielle lors d'une validation
93
	
96
	
Line 94... Line 97...
94
	private  enum Champs {
97
	private  enum Champs {
Line 95... Line 98...
95
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT ;
98
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT, LATITUDE, LONGITUDE ;
96
	    
99
	    
Line 115... Line 118...
115
    		case COMMENT:
118
    		case COMMENT:
116
    			return "commentaire";
119
    			return "commentaire";
Line 117... Line 120...
117
	    	
120
	    	
118
	    	case ESPECE:
121
	    	case ESPECE:
-
 
122
	    		return "espèce";
-
 
123
	    		
-
 
124
	    	case LATITUDE:
-
 
125
	    		return "latitude";
-
 
126
	    		
-
 
127
	    	case LONGITUDE:
Line 119... Line 128...
119
	    		return "espèce";
128
	    		return "longitude";
120
	    	
129
	    	
121
	    	case TOUT:
130
	    	case TOUT:
122
	    		return "date, commune, lieu dit, station, milieu, espèce, commentaire";
131
	    		return "date, commune, lieu dit, station, milieu, espèce, commentaire, latitude, longitude";
123
	    	}
132
	    	}
124
			return TOUT.toString();
133
			return TOUT.toString();
Line 134... Line 143...
134
	
143
	
135
	private boolean modification = false ;
144
	private boolean modification = false ;
Line 136... Line 145...
136
	private Toolbar bt = null ;
145
	private Toolbar bt = null ;
137
	
146
	
138
	private final String VALEURS_MULTIPLES = "(Valeurs multiples)";
147
	private final String VALEURS_MULTIPLES = "(Valeurs multiples)";
139
	private final String modeleMessageModif = "commune:lieu-dit:station:milieu:date:espece:commentaire";
148
	private final String modeleMessageModif = "commune:lieu-dit:station:milieu:latitude:longitude:date:espece:commentaire";
140
	private boolean communeModifiee = false;
149
	private boolean communeModifiee = false;
141
	private boolean lieuDitModifie = false;
150
	private boolean lieuDitModifie = false;
142
	private boolean stationModifiee = false;
151
	private boolean stationModifiee = false;
Line 196... Line 205...
196
	private HTML accesformulaire;
205
	private HTML accesformulaire;
Line 197... Line 206...
197
 
206
 
Line 198... Line 207...
198
	private HTML basculerverscarto;
207
	private HTML basculerverscarto;
-
 
208
	
-
 
209
	private boolean longlatAjoutee;
-
 
210
 
-
 
211
	private boolean latModifiee;
Line 199... Line 212...
199
	
212
 
200
	private boolean longlatAjoutee;
213
	private boolean longModifiee;
201
	
214
	
202
	/**
215
	/**
Line 274... Line 287...
274
	    station = new TextField("Station", "station");  
287
	    station = new TextField("Station", "station");  
275
	    station.setAllowBlank(true);
288
	    station.setAllowBlank(true);
276
	    //station.setTabIndex(3);
289
	    //station.setTabIndex(3);
277
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));  
290
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));  
Line 278... Line -...
278
	    
-
 
279
	    longitude = new TextField("X", "x", 100);
-
 
280
		longitude.setAllowBlank(true);
-
 
281
		
291
	    
282
		latitude = new TextField("Y", "y", 100);
292
		latitude = new TextField("X", "x", 100);
283
		latitude.setAllowBlank(true);
293
		latitude.setAllowBlank(true);
-
 
294
	    
-
 
295
	    longitude = new TextField("Y", "y", 100);
-
 
296
		longitude.setAllowBlank(true);
284
	
297
			
285
		// Panneau de type plusieurs champs de formulaire sur une meme ligne, où seront renseignés X/Y
298
		// Panneau de type plusieurs champs de formulaire sur une meme ligne, où seront renseignés X/Y
286
		coordPanel = new MultiFieldPanel(); 
299
		coordPanel = new MultiFieldPanel(); 
287
		coordPanel.setVisible(false);
-
 
288
		coordPanel.addToRow(longitude, new ColumnLayoutData(0.5));  
300
		coordPanel.setVisible(false);
-
 
301
		coordPanel.addToRow(latitude, new ColumnLayoutData(0.5)); 
289
		coordPanel.addToRow(latitude, new ColumnLayoutData(0.5)); 
302
		coordPanel.addToRow(longitude, new ColumnLayoutData(0.5));  
Line 290... Line 303...
290
		coordPanel.setBorder(false);
303
		coordPanel.setBorder(false);
-
 
304
		
Line 291... Line 305...
291
		
305
		  //création du champs coordonnées	
292
		  //création du champs coordonnées
306
		referentielGeo = Configuration.getReferentielGeo();
293
		
307
		
294
		coordonnees = new TextField("Coordonnées", "", 0);
308
		coordonnees = new TextField("Coordonnées ("+referentielGeo+")", "", 0);
Line 295... Line 309...
295
		coordonnees.setMaxLength(0);
309
		coordonnees.setMaxLength(0);
Line 342... Line 356...
342
 
356
 
Line 343... Line 357...
343
			});
357
			});
344
			
358
			
345
			
359
			
Line 346... Line 360...
346
			  //création du lien "Accès carto" dans le formulaire			
360
			  //création du lien "Accès carto" dans le formulaire			
347
			basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"6\">Selection depuis la carto</a>");
361
			basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"6\">Selection depuis une carte</a>");
348
			basculerverscarto.addStyleName("lien");
362
			basculerverscarto.addStyleName("lien");
Line 403... Line 417...
403
	    comment = new TextArea("Notes", "comment");  
417
	    comment = new TextArea("Notes", "comment");  
404
	    comment.setAllowBlank(true);
418
	    comment.setAllowBlank(true);
405
	    comment.setHeight(50);
419
	    comment.setHeight(50);
406
	    //comment.setTabIndex(7);
420
	    //comment.setTabIndex(7);
407
	    panneauSecondeColonne.add(comment, new AnchorLayoutData("95%") );
421
	    panneauSecondeColonne.add(comment, new AnchorLayoutData("95%") );
408
	   
-
 
409
	    
-
 
410
	    
-
 
Line 411... Line 422...
411
	    
422
	    
412
	    if (Window.getClientWidth()> Window.getClientHeight()) {
423
	    if (Window.getClientWidth()> Window.getClientHeight()) {
413
			panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
424
			panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
414
			panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
425
			panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
Line 786... Line 797...
786
		    	        default:
797
		    	        default:
787
						commModifie = true;
798
						commModifie = true;
788
					}
799
					}
789
				}
800
				}
790
		    });
801
		    });
-
 
802
			
-
 
803
			latitude.addKeyPressListener(new EventCallback() {
-
 
804
 
-
 
805
				public void execute(EventObject e) {
-
 
806
					switch(e.getKey()) { 
-
 
807
						case KEY_ALT:
-
 
808
			    	      case KEY_CTRL:
-
 
809
			    	      case KEY_DOWN:
-
 
810
			    	      case KEY_END:
-
 
811
			    	      case KEY_ESCAPE:
-
 
812
			    	      case KEY_HOME:
-
 
813
			    	      case KEY_LEFT:
-
 
814
			    	      case KEY_PAGEDOWN:
-
 
815
			    	      case KEY_PAGEUP:
-
 
816
			    	      case KEY_RIGHT:
-
 
817
			    	      case KEY_SHIFT:
-
 
818
			    	      case KEY_TAB:
-
 
819
			    	      case KEY_UP:
-
 
820
		    	    	
-
 
821
		    	        break;
-
 
822
		    	        
-
 
823
			    	      case KEY_ENTER:	  	    	    	  
-
 
824
	  	    	    		validerSaisie(Champs.LATITUDE); 	    	    		 
-
 
825
	  	    	    	  break;
-
 
826
 
-
 
827
		    	        default:
-
 
828
						latModifiee = true;
-
 
829
					}
-
 
830
				}
-
 
831
		    });
-
 
832
			
-
 
833
			longitude.addKeyPressListener(new EventCallback() {
-
 
834
 
-
 
835
				public void execute(EventObject e) {
-
 
836
					switch(e.getKey()) { 
-
 
837
						case KEY_ALT:
-
 
838
			    	      case KEY_CTRL:
-
 
839
			    	      case KEY_DOWN:
-
 
840
			    	      case KEY_END:
-
 
841
			    	      case KEY_ESCAPE:
-
 
842
			    	      case KEY_HOME:
-
 
843
			    	      case KEY_LEFT:
-
 
844
			    	      case KEY_PAGEDOWN:
-
 
845
			    	      case KEY_PAGEUP:
-
 
846
			    	      case KEY_RIGHT:
-
 
847
			    	      case KEY_SHIFT:
-
 
848
			    	      case KEY_TAB:
-
 
849
			    	      case KEY_UP:
-
 
850
		    	    	
-
 
851
		    	        break;
-
 
852
		    	        
-
 
853
			    	      case KEY_ENTER:	  	    	    	  
-
 
854
		  	    	    		validerSaisie(Champs.LONGITUDE); 	    	    		 
-
 
855
		  	    	    	  break;
-
 
856
 
-
 
857
		    	        default:
-
 
858
						longModifiee = true;
-
 
859
					}
-
 
860
				}
-
 
861
		    });
Line 791... Line 862...
791
 
862
 
Line 997... Line 1068...
997
	private void rafraichirCommuneEtCoord(EntiteGeographiqueObservation infosCom) {
1068
	private void rafraichirCommuneEtCoord(EntiteGeographiqueObservation infosCom) {
Line 998... Line 1069...
998
		
1069
		
Line 999... Line 1070...
999
		String nCommune = "";
1070
		String nCommune = "";
1000
 
1071
 
1001
		
1072
		
Line 1002... Line 1073...
1002
		if(infosCom.getLocation() != null && !infosCom.getLocation().equals("")) {
1073
		if(infosCom.getCommune() != null && !infosCom.getCommune().equals("")) {
1003
			nCommune += infosCom.getLocation();
1074
			nCommune += infosCom.getCommune();
1004
		}
1075
		}
1005
		
1076
		
Line 1006... Line 1077...
1006
		if(infosCom.getIdLocation() != null && !infosCom.getIdLocation().equals("")) {
1077
		if(infosCom.getIdLocalite() != null && !infosCom.getIdLocalite().equals("")) {
Line 1007... Line 1078...
1007
			nCommune += " ("+infosCom.getIdLocation()+")";
1078
			nCommune += " ("+infosCom.getIdLocalite()+")";
Line 1015... Line 1086...
1015
		}
1086
		}
Line 1016... Line 1087...
1016
 
1087
 
1017
		if(infosCom.getLon() != null && !infosCom.getLon().equals("")) {
1088
		if(infosCom.getLon() != null && !infosCom.getLon().equals("")) {
1018
			longitude.setValue(infosCom.getLon());
1089
			longitude.setValue(infosCom.getLon());
-
 
1090
		}
-
 
1091
		
-
 
1092
		coordPanel.setVisible(true);
-
 
1093
		
-
 
1094
		latModifiee = true;
1019
		}
1095
		longModifiee = true;
Line 1020... Line 1096...
1020
	}
1096
	}
Line 1021... Line 1097...
1021
 
1097
 
Line 1063... Line 1139...
1063
				}
1139
				}
1064
			}
1140
			}
1065
		}
1141
		}
Line 1066... Line 1142...
1066
 
1142
 
-
 
1143
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());	
-
 
1144
		
-
 
1145
		String[] coords = getValeurCoordonnees();
-
 
1146
		
-
 
1147
		obs.setCoordonneeX(coords[0]);
-
 
1148
		obs.setCoordonneeY(coords[1]);
1067
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());	
1149
		
1068
		observationMediateur.ajouterObservation(obs);
1150
		observationMediateur.ajouterObservation(obs);
Line 1069... Line 1151...
1069
	}
1151
	}
Line 1094... Line 1176...
1094
		}
1176
		}
Line 1095... Line 1177...
1095
		
1177
		
1096
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
1178
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
Line -... Line 1179...
-
 
1179
		obs.setNumeroOrdre(numeroOrdre);
-
 
1180
		
-
 
1181
		String[] coords = getValeurCoordonnees();
-
 
1182
		
-
 
1183
		obs.setCoordonneeX(coords[0]);
1097
		obs.setNumeroOrdre(numeroOrdre);
1184
		obs.setCoordonneeY(coords[1]);
Line 1098... Line 1185...
1098
		
1185
		
1099
		observationMediateur.modifierObservation(obs);
1186
		observationMediateur.modifierObservation(obs);
Line 1111... Line 1198...
1111
		String stationM = null;
1198
		String stationM = null;
1112
		String milieuM = null;
1199
		String milieuM = null;
1113
		String dateM = null;
1200
		String dateM = null;
1114
		String especeM = null;
1201
		String especeM = null;
1115
		String commM = null; 
1202
		String commM = null; 
-
 
1203
		String latM = null;
-
 
1204
		String longM = null;
Line 1116... Line 1205...
1116
		
1205
		
Line 1117... Line 1206...
1117
		String champs = modeleMessageModif;
1206
		String champs = modeleMessageModif;
1118
			
1207
			
Line 1182... Line 1271...
1182
			commM = comment.getText();
1271
			commM = comment.getText();
1183
		}else {
1272
		}else {
1184
			champs = champs.replaceAll(":commentaire", "");
1273
			champs = champs.replaceAll(":commentaire", "");
1185
		}
1274
		}
Line -... Line 1275...
-
 
1275
		
-
 
1276
		if(latModifiee) {
-
 
1277
			latM = latitude.getText();
-
 
1278
		}else {
-
 
1279
			champs = champs.replaceAll(":latitude", "");
-
 
1280
		}
-
 
1281
		
-
 
1282
		if(longModifiee) {
-
 
1283
			longM = longitude.getText();
-
 
1284
		}else {
-
 
1285
			champs = champs.replaceAll(":longitude", "");
-
 
1286
		}
1186
		
1287
		
1187
		champs = champs.replaceAll(":",", ");
1288
		champs = champs.replaceAll(":",", ");
1188
		if(champs.startsWith(",")) {
1289
		if(champs.startsWith(",")) {
1189
			champs = champs.replaceFirst(",", "");
1290
			champs = champs.replaceFirst(",", "");
Line 1194... Line 1295...
1194
		if(champs.trim().equals("")) {
1295
		if(champs.trim().equals("")) {
1195
			Window.alert("Aucun champ n'a été modifié");
1296
			Window.alert("Aucun champ n'a été modifié");
1196
		} else {
1297
		} else {
1197
			Observation obs = new Observation(especeM,numNomSelM,communeM,departementM,lieuDitM,stationM,milieuM, commM,dateM);
1298
			Observation obs = new Observation(especeM,numNomSelM,communeM,departementM,lieuDitM,stationM,milieuM, commM,dateM);
1198
			obs.setNumeroOrdre(numeroOrdre);
1299
			obs.setNumeroOrdre(numeroOrdre);
-
 
1300
			obs.setCoordonneeX(latM);
-
 
1301
			obs.setCoordonneeY(longM);
1199
			if(Window.confirm(message)) {
1302
			if(Window.confirm(message)) {
1200
				observationMediateur.modifierObservationEnMasse(obs);
1303
				observationMediateur.modifierObservationEnMasse(obs);
1201
				reinitialiserValeurModifiees();
1304
				reinitialiserValeurModifiees();
1202
			}
1305
			}
1203
		}
1306
		}
Line 1272... Line 1375...
1272
		}
1375
		}
1273
		if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000nu2ll")) {
1376
		if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000nu2ll")) {
1274
			numeroOrdre = obs.getNumeroOrdre() ;
1377
			numeroOrdre = obs.getNumeroOrdre() ;
1275
		}
1378
		}
Line -... Line 1379...
-
 
1379
		
-
 
1380
		if(!obs.getCoordonneeX().equals("null") && !obs.getCoordonneeX().equals("000null")
-
 
1381
				&& !obs.getCoordonneeY().equals("null") && !obs.getCoordonneeY().equals("000null")) {
-
 
1382
			latitude.setValue(obs.getCoordonneeX()) ;
-
 
1383
			longitude.setValue(obs.getCoordonneeY()) ;
1276
		
1384
		}	
Line 1277... Line 1385...
1277
	}
1385
	}
1278
	
1386
	
Line 1317... Line 1425...
1317
				espece.reset();
1425
				espece.reset();
1318
				numeroNom = "" ;
1426
				numeroNom = "" ;
1319
				numeroOrdre = "";
1427
				numeroOrdre = "";
1320
				break;
1428
				break;
Line -... Line 1429...
-
 
1429
				
-
 
1430
			case LATITUDE:
-
 
1431
				latitude.reset();
-
 
1432
				break;
-
 
1433
				
-
 
1434
			case LONGITUDE:
-
 
1435
				longitude.reset();
-
 
1436
				break;
1321
				
1437
				
1322
			case TOUT:
1438
			case TOUT:
1323
				commune.reset();
1439
				commune.reset();
1324
				date.reset() ;
1440
				date.reset() ;
1325
				lieudit.reset() ;
1441
				lieudit.reset() ;
Line 1351... Line 1467...
1351
			selecteurMode.setCls("x-selec-modif") ;
1467
			selecteurMode.setCls("x-selec-modif") ;
1352
			observationMediateur.onModeModification();
1468
			observationMediateur.onModeModification();
1353
		}
1469
		}
1354
		else
1470
		else
1355
		{
1471
		{
1356
			boutonOK.setText("Ajouter") ;
1472
			boutonOK.setText("Créer") ;
1357
			setTitle("Saisir") ;
1473
			setTitle("Saisir") ;
1358
			boutonAnnuler.setText("Réinitialiser") ;
1474
			boutonAnnuler.setText("Réinitialiser") ;
1359
			modification = false ;
1475
			modification = false ;
1360
			selecteurMode.removeClass("x-selec-modif") ;
1476
			selecteurMode.removeClass("x-selec-modif") ;
1361
			selecteurMode.setCls("x-selec-crea") ;
1477
			selecteurMode.setCls("x-selec-crea") ;
1362
			observationMediateur.onModeCreation();
1478
			observationMediateur.onModeCreation();
1363
			
-
 
1364
		}	
1479
		}	
1365
	}
1480
	}
Line 1366... Line 1481...
1366
	
1481
	
1367
	/**
1482
	/**
Line 1408... Line 1523...
1408
		String station = null;
1523
		String station = null;
1409
		String milieu = null;
1524
		String milieu = null;
1410
		String espece = null;
1525
		String espece = null;
1411
		String date = null;
1526
		String date = null;
1412
		String notes = null;
1527
		String notes = null;
-
 
1528
		String lat = null;
-
 
1529
		String lon = null;
Line 1413... Line 1530...
1413
		
1530
		
Line 1414... Line 1531...
1414
		String ordreObs = "";
1531
		String ordreObs = "";
1415
		
1532
		
Line 1421... Line 1538...
1421
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
1538
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
1422
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
1539
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
1423
			espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi()); 
1540
			espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi()); 
1424
			date = comparerDifferencesChamps(date, obsEnCours.getDate());
1541
			date = comparerDifferencesChamps(date, obsEnCours.getDate());
1425
			notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
1542
			notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
-
 
1543
			lat = comparerDifferencesChamps(lat, obsEnCours.getCoordonneeX());
-
 
1544
			lon = comparerDifferencesChamps(lon, obsEnCours.getCoordonneeY());
Line 1426... Line 1545...
1426
			
1545
			
1427
			ordreObs += obsEnCours.getNumeroOrdre()+",";
1546
			ordreObs += obsEnCours.getNumeroOrdre()+",";
Line 1428... Line 1547...
1428
		}
1547
		}
1429
		
1548
		
-
 
1549
		Observation obs=new Observation(espece,numeroNom,commune,departement,lieuDit,station,milieu, notes,date);
-
 
1550
		obs.setNumeroOrdre(ordreObs);
1430
		Observation obs=new Observation(espece,numeroNom,commune,departement,lieuDit,station,milieu, notes,date);
1551
		obs.setCoordonneeX(lat);
Line 1431... Line 1552...
1431
		obs.setNumeroOrdre(ordreObs);
1552
		obs.setCoordonneeY(lon);
Line 1432... Line 1553...
1432
		rafraichir(obs, false);
1553
		rafraichir(obs, false);
Line 1456... Line 1577...
1456
		stationModifiee = false;
1577
		stationModifiee = false;
1457
		milieuModifie = false;
1578
		milieuModifie = false;
1458
		dateModifiee = false;
1579
		dateModifiee = false;
1459
		especeModifiee = false;
1580
		especeModifiee = false;
1460
		commModifie = false;
1581
		commModifie = false;
-
 
1582
		latModifiee = false;
-
 
1583
		longModifiee = false;
1461
	}
1584
	}
Line 1462... Line 1585...
1462
	
1585
	
1463
	public void saisieTabindex()
1586
	public void saisieTabindex()
Line 1471... Line 1594...
1471
		coordonnees.setTabIndex(-1);
1594
		coordonnees.setTabIndex(-1);
1472
		coordonnees.addListener(new TextFieldListenerAdapter() {
1595
		coordonnees.addListener(new TextFieldListenerAdapter() {
Line 1473... Line 1596...
1473
 
1596
 
1474
			public void onFocus(Field field) {
1597
			public void onFocus(Field field) {
1475
				if(coordPanel.isVisible()) {
1598
				if(coordPanel.isVisible()) {
1476
					longitude.focus();
1599
					latitude.focus();
1477
				} else {
1600
				} else {
1478
					Ext.get("lien_carto").focus();
1601
					Ext.get("lien_carto").focus();
1479
				}
1602
				}
1480
			}	
1603
			}	
Line 1481... Line 1604...
1481
		});
1604
		});
1482
			
1605
			
1483
		longitude.setTabIndex(8);
1606
		latitude.setTabIndex(8);
1484
		latitude.setTabIndex(9);
1607
		longitude.setTabIndex(9);
1485
		comment.setTabIndex(10);
1608
		comment.setTabIndex(10);
1486
		date.setTabIndex(11);
1609
		date.setTabIndex(11);
1487
		espece.setTabIndex(12);
1610
		espece.setTabIndex(12);
Line 1516... Line 1639...
1516
		} catch (NumberFormatException ne) {
1639
		} catch (NumberFormatException ne) {
1517
			return null;
1640
			return null;
1518
		}
1641
		}
1519
	}
1642
	}
Line -... Line 1643...
-
 
1643
	
-
 
1644
	private String[] getValeurCoordonnees() {
-
 
1645
		double[] coDouble = coordonneesValides();
-
 
1646
		
-
 
1647
		if(coDouble != null) {
-
 
1648
			String[] coord = {coDouble[0]+"",coDouble[1]+""};
-
 
1649
			return coord;
-
 
1650
		} else {
-
 
1651
			String[] coord = {"000null","000null" };
-
 
1652
			return coord;
-
 
1653
		}
-
 
1654
	}
1520
	
1655
	
-
 
1656
	private String obtenirDepartementAPartirChampCommune() {
-
 
1657
		
-
 
1658
		String dep = "";
1521
	private String obtenirDepartementAPartirChampCommune() {
1659
		
-
 
1660
		if(departement.equals("000null") || departement.equals("")) {
1522
		if(departement.equals("000null") || departement.equals("")) {
1661
					
1523
			String[] depCom = commune.getText().split(" ");
1662
			String[] depCom = commune.getText().split(" ");
1524
			if(depCom.length > 1) {
1663
			if(depCom.length > 1) {
1525
				String dep = depCom[1].replace('(', ' ');
-
 
1526
				dep =dep.replace(')', ' ');
-
 
1527
				dep = dep.trim();
-
 
1528
				dep = dep.replace('\\',' ');
-
 
1529
				dep = dep.trim();
-
 
1530
				
-
 
1531
				try
1664
				dep = depCom[1].replace('(', ' ');
1532
				{
-
 
1533
					int nDep = Integer.parseInt(dep);
-
 
1534
					if(nDep > 0 && nDep < 110) {
-
 
1535
						departement = dep ;
-
 
1536
					}
-
 
1537
				}
-
 
1538
				catch(NumberFormatException e)
-
 
1539
				{
1665
			} else {
1540
					departement = "" ;
-
 
1541
				}
1666
				dep = "";
-
 
1667
			}
-
 
1668
		} else {
-
 
1669
			dep = departement;
-
 
1670
		}
-
 
1671
		
-
 
1672
		dep = dep.replace(')', ' ');
-
 
1673
		dep = dep.trim();
-
 
1674
		dep = dep.replace('\\',' ');
-
 
1675
		dep = dep.trim();
-
 
1676
		
-
 
1677
		try
-
 
1678
		{
-
 
1679
			int nDep = Integer.parseInt(dep);
-
 
1680
			if(nDep > 0 && nDep < 110) {
-
 
1681
				departement = dep ;
-
 
1682
			}
-
 
1683
			
-
 
1684
			if(departement.length() == 1) {
-
 
1685
				departement = "0"+departement;
-
 
1686
			}
-
 
1687
		}
-
 
1688
		catch(NumberFormatException e)
-
 
1689
		{
1542
			}
1690
			departement = "" ;
Line 1543... Line 1691...
1543
		}
1691
		}
1544
		
1692
		
Line 1545... Line 1693...
1545
		return departement;
1693
		return departement;
1546
	}
1694
	}
1547
	
1695
	
1548
	private Field obtenirCorrespondanceChampsEnum(Champs champ) {
1696
	/*private Field obtenirCorrespondanceChampsEnum(Champs champ) {
Line 1549... Line 1697...
1549
		switch(champ) {
1697
		switch(champ) {
Line 1567... Line 1715...
1567
    	
1715
    	
1568
    	case ESPECE:
1716
    	case ESPECE:
1569
    		return espece;
1717
    		return espece;
1570
    	}
1718
    	}
1571
		return null;
1719
		return null;
1572
	}
1720
	}*/