Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2553 Rev 2558
Line 95... Line 95...
95
	private ComboBox lieudit = null;
95
	private ComboBox lieudit = null;
96
	private ComboBox station = null;
96
	private ComboBox station = null;
97
	private ComboBox milieu = null;
97
	private ComboBox milieu = null;
98
	private TextField comment = null;
98
	private TextField comment = null;
99
	private ComboBox  commune = null;
99
	private ComboBox  commune = null;
-
 
100
	
100
	private String departement = null;
101
	private String departement = null;
-
 
102
	
101
	private ComboBox  espece = null;
103
	private ComboBox  espece = null;
102
	private String numeroNom = null;
104
	private String numeroNom = null;
103
	private String numeroOrdre = null;
105
	private String numeroOrdre = null;
104
	private String codeInseeCommune = null;
106
	private String codeLoc = null;
105
	private String referentielTaxo = null;
107
	private String referentielTaxo = null;
106
	private String referentielGeo = null;
108
	private String referentielGeo = null;
Line 107... Line 109...
107
 
109
 
Line 333... Line 335...
333
		commune.setTypeAhead(true);
335
		commune.setTypeAhead(true);
334
		commune.setLoadingText("Recherche...");
336
		commune.setLoadingText("Recherche...");
335
		commune.setHideTrigger(true);
337
		commune.setHideTrigger(true);
Line 336... Line 338...
336
 
338
 
-
 
339
		//création du lien "Accès carto" dans le formulaire
-
 
340
		String aideLienLocaliser = "Vous pouvez entrer une nom sous la forme commune (departement) ou bien commune (pays) "+
337
		//création du lien "Accès carto" dans le formulaire
341
									"avec un numéro de département sur 2 chiffres ou un code de pays àdeux lettres ";
338
		basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"2\">Localiser la commune</a>");
342
		basculerverscarto = new HTML(" <a id=\"lien_carto\" title=\""+aideLienLocaliser+"\" href=\"#\" tabindex=\"2\">Localiser la zone</a>");
Line 339... Line 343...
339
		basculerverscarto.addStyleName("lien_actif");
343
		basculerverscarto.addStyleName("lien_actif");
340
 
344
 
341
		//création info bulle sur le lien "accès carto"
345
		//création info bulle sur le lien "accès carto"
Line 770... Line 774...
770
		lienCarto.addListener("click", new EventCallback() {
774
		lienCarto.addListener("click", new EventCallback() {
Line 771... Line 775...
771
 
775
 
772
			@Override
776
			@Override
Line 773... Line 777...
773
			public void execute(EventObject e) {
777
			public void execute(EventObject e) {
774
 
778
 
775
				if(commune.getValue() != null && !commune.getValue().equals("") && !getDepartement().equals("")) {
779
				if(commune.getValue() != null && !commune.getValue().equals("")) {
776
					obtenirInformationCommune();
-
 
777
					longlatAjoutee = true;
780
					obtenirInformationCommune();
778
 
781
					longlatAjoutee = true;
779
				} else {
782
				} else {
780
					Window.alert("Veuillez renseigner une commune et un numéro de département sous la forme : Commune (departement)");
783
					Window.alert("Veuillez renseigner une commune et un numéro de département sous la forme : Commune (departement)");
781
				}
784
				}
Line 896... Line 899...
896
		commune.addListener(new ComboBoxListenerAdapter() {
899
		commune.addListener(new ComboBoxListenerAdapter() {
897
            @Override
900
            @Override
898
			public void onSelect(ComboBox comboBox, Record record, int index) {
901
			public void onSelect(ComboBox comboBox, Record record, int index) {
899
                commune.setValue(record.getAsString("commune"));
902
                commune.setValue(record.getAsString("commune"));
900
                departement=record.getAsString("departement");
903
                departement=record.getAsString("departement");
901
                codeInseeCommune=record.getAsString("codeInsee");
904
                codeLoc=record.getAsString("codeInsee");
902
                selectionCommune=true;
905
                selectionCommune=true;
903
                commune.collapse();
906
                commune.collapse();
904
            }
907
            }
Line 905... Line 908...
905
 
908
 
Line 1282... Line 1285...
1282
 
1285
 
1283
	private void afficherIndicationCommune(
1286
	private void afficherIndicationCommune(
Line 1284... Line 1287...
1284
			final EntiteGeographiqueObservation infosCom) {
1287
			final EntiteGeographiqueObservation infosCom) {
1285
 
1288
 
1286
		String nCommune = "";
1289
		String nCommune = "";
1287
		if(infosCom != null && !infosCom.getZoneGeo().trim().equals("")){
1290
		if(infosCom != null && infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().trim().isEmpty()){
-
 
1291
			nCommune += infosCom.getZoneGeo();
1288
			nCommune += infosCom.getZoneGeo();
1292
			if(!infosCom.getIdZoneGeo().trim().isEmpty()) {
-
 
1293
				if(Util.estUnNombre(infosCom.getIdZoneGeo())) {
-
 
1294
					nCommune += " ("+Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo())+")";
-
 
1295
				} else if(infosCom.getPays() != null && infosCom.getPays().trim().isEmpty()) {
-
 
1296
					nCommune += " ("+infosCom.getPays()+")";
Line 1289... Line 1297...
1289
			if(!infosCom.getIdZoneGeo().trim().equals(""))
1297
				}
1290
			nCommune += " ("+Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo())+")";
1298
			}
Line 1291... Line 1299...
1291
 
1299
 
Line 1338... Line 1346...
1338
		String nCommune = "";
1346
		String nCommune = "";
Line 1339... Line 1347...
1339
 
1347
 
1340
		if(infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().equals("")) {
1348
		if(infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().equals("")) {
1341
			nCommune += infosCom.getZoneGeo();
1349
			nCommune += infosCom.getZoneGeo();
1342
		}
1350
		}
1343
 
1351
		
1344
		if(infosCom.getIdZoneGeo() != null && !infosCom.getIdZoneGeo().equals("")) {
1352
		if(Util.estUnNombre(infosCom.getIdZoneGeo())) {
1345
			String codeGeoFormate = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
1353
			String codeGeoFormate = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
1346
			nCommune += " ("+codeGeoFormate+")";
1354
			nCommune += " ("+codeGeoFormate+")";
-
 
1355
			departement = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
-
 
1356
		} else if(infosCom.getPays() != null && infosCom.getPays().trim().isEmpty()) {
1347
			departement = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
1357
			nCommune += " ("+infosCom.getPays()+")";
-
 
1358
		}
1348
		}
1359
		
1349
		if (! nCommune.equals("")) {
1360
		if (! nCommune.equals("")) {
1350
			commune.setValue(nCommune);
1361
			commune.setValue(nCommune);
1351
			communeModifiee = true;
1362
			communeModifiee = true;
1352
		}
1363
		}
Line 1353... Line 1364...
1353
	}
1364
	}
1354
 
1365
 
1355
	// Se déclenche au retour de la "localisation sur la carte"
1366
	// Se déclenche au retour de la "localisation sur la carte"
1356
	private void rafraichirCommuneEtCoord(EntiteGeographiqueObservation infosCom) {
1367
	private void rafraichirCommuneEtCoord(EntiteGeographiqueObservation infosCom) {
1357
 
1368
		
1358
		rafraichirCommune(infosCom);
1369
		rafraichirCommune(infosCom);
1359
		if(infosCom.getLat() != null && !infosCom.getLat().equals("")) {
1370
		if(infosCom.getLat() != null && !infosCom.getLat().equals("")) {
Line 2157... Line 2168...
2157
				case "bdtxa" :
2168
				case "bdtxa" :
2158
					lat = 14.6;
2169
					lat = 14.6;
2159
					lon = -61.08334;
2170
					lon = -61.08334;
2160
					zoom = 7;
2171
					zoom = 7;
2161
					break;
2172
					break;
-
 
2173
				case "lbf" :
-
 
2174
					lat = 33.53;
-
 
2175
					lon = 35.30;
-
 
2176
					zoom = 7;
-
 
2177
					break;
2162
				case "bdtfx" :
2178
				case "bdtfx" :
2163
				default:
2179
				default:
2164
					lat = 47.0504;
2180
					lat = 47.0504;
2165
					lon = 2.2347;
2181
					lon = 2.2347;
2166
					zoom = 6;
2182
					zoom = 6;
Line 2178... Line 2194...
2178
			}
2194
			}
2179
		}
2195
		}
2180
	}
2196
	}
Line 2181... Line 2197...
2181
 
2197
 
-
 
2198
	private void obtenirInformationCommune() {
-
 
2199
		String idLoc = "";
-
 
2200
		if(departement != null && !departement.isEmpty()) {
-
 
2201
			idLoc = departement;
-
 
2202
		} else {
-
 
2203
			idLoc = Util.obtenirIdLocAPartirChaineCommune(commune.getText());
-
 
2204
			if(Util.estUnNombre(idLoc)) {
-
 
2205
				idLoc = Util.formaterDepartement(idLoc);
-
 
2206
			}
2182
	private void obtenirInformationCommune() {
2207
		}
2183
		observationMediateur.obtenirInformationCommune(getCommuneSansDepartement(), Util.obtenirDepartementAPartirChaineCommune(departement, commune.getText()));
2208
		observationMediateur.obtenirInformationCommune(getCommuneSansIdLoc(), idLoc);
Line 2184... Line 2209...
2184
	}
2209
	}
2185
 
-
 
2186
	public double[] coordonneesValides() {
2210
 
Line 2187... Line 2211...
2187
 
2211
	public double[] coordonneesValides() {
2188
		try {
2212
		try {
Line 2218... Line 2242...
2218
			valeurCommune = commune.getValue();
2242
			valeurCommune = commune.getValue();
2219
		}
2243
		}
2220
		return valeurCommune;
2244
		return valeurCommune;
2221
	}
2245
	}
Line 2222... Line -...
2222
 
-
 
2223
	public String getDepartement() {
-
 
2224
		return Util.obtenirDepartementAPartirChaineCommune(departement, commune.getText());
-
 
2225
	}
-
 
2226
 
2246
 
2227
	public String getCommuneSansDepartement() {
2247
	public String getCommuneSansIdLoc() {
2228
		return Util.supprimerNumDepartementChaineLocalite(getCommune());
2248
		return Util.supprimerChaineIdLocalite(getCommune());
Line 2229... Line 2249...
2229
	}
2249
	}
2230
 
2250
 
2231
	private String getValeurChampListeLibre(ComboBox champ) {
2251
	private String getValeurChampListeLibre(ComboBox champ) {