Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2553 → Rev 2558

/trunk/src/org/tela_botanica/client/vues/observation/FormulaireSaisieObservationVue.java
97,11 → 97,13
private ComboBox milieu = null;
private TextField comment = null;
private ComboBox commune = null;
private String departement = null;
private ComboBox espece = null;
private String numeroNom = null;
private String numeroOrdre = null;
private String codeInseeCommune = null;
private String codeLoc = null;
private String referentielTaxo = null;
private String referentielGeo = null;
 
335,7 → 337,9
commune.setHideTrigger(true);
 
//création du lien "Accès carto" dans le formulaire
basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"2\">Localiser la commune</a>");
String aideLienLocaliser = "Vous pouvez entrer une nom sous la forme commune (departement) ou bien commune (pays) "+
"avec un numéro de département sur 2 chiffres ou un code de pays àdeux lettres ";
basculerverscarto = new HTML(" <a id=\"lien_carto\" title=\""+aideLienLocaliser+"\" href=\"#\" tabindex=\"2\">Localiser la zone</a>");
basculerverscarto.addStyleName("lien_actif");
 
//création info bulle sur le lien "accès carto"
772,10 → 776,9
@Override
public void execute(EventObject e) {
 
if(commune.getValue() != null && !commune.getValue().equals("") && !getDepartement().equals("")) {
if(commune.getValue() != null && !commune.getValue().equals("")) {
obtenirInformationCommune();
longlatAjoutee = true;
 
} else {
Window.alert("Veuillez renseigner une commune et un numéro de département sous la forme : Commune (departement)");
}
898,7 → 901,7
public void onSelect(ComboBox comboBox, Record record, int index) {
commune.setValue(record.getAsString("commune"));
departement=record.getAsString("departement");
codeInseeCommune=record.getAsString("codeInsee");
codeLoc=record.getAsString("codeInsee");
selectionCommune=true;
commune.collapse();
}
1284,10 → 1287,15
final EntiteGeographiqueObservation infosCom) {
 
String nCommune = "";
if(infosCom != null && !infosCom.getZoneGeo().trim().equals("")){
if(infosCom != null && infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().trim().isEmpty()){
nCommune += infosCom.getZoneGeo();
if(!infosCom.getIdZoneGeo().trim().equals(""))
nCommune += " ("+Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo())+")";
if(!infosCom.getIdZoneGeo().trim().isEmpty()) {
if(Util.estUnNombre(infosCom.getIdZoneGeo())) {
nCommune += " ("+Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo())+")";
} else if(infosCom.getPays() != null && infosCom.getPays().trim().isEmpty()) {
nCommune += " ("+infosCom.getPays()+")";
}
}
 
lienSelectionCommune.setHtml("<a id=\"lien_selection_commune\" tabindex=\"9\">"+nCommune+"</a>");
lienSelectionCommune.setStyleName("img-curseur-depl");
1340,12 → 1348,15
if(infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().equals("")) {
nCommune += infosCom.getZoneGeo();
}
 
if(infosCom.getIdZoneGeo() != null && !infosCom.getIdZoneGeo().equals("")) {
if(Util.estUnNombre(infosCom.getIdZoneGeo())) {
String codeGeoFormate = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
nCommune += " ("+codeGeoFormate+")";
departement = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
} else if(infosCom.getPays() != null && infosCom.getPays().trim().isEmpty()) {
nCommune += " ("+infosCom.getPays()+")";
}
if (! nCommune.equals("")) {
commune.setValue(nCommune);
communeModifiee = true;
1354,7 → 1365,7
 
// Se déclenche au retour de la "localisation sur la carte"
private void rafraichirCommuneEtCoord(EntiteGeographiqueObservation infosCom) {
 
rafraichirCommune(infosCom);
if(infosCom.getLat() != null && !infosCom.getLat().equals("")) {
latitude.setValue(Util.tronquerNombrePourAffichage("" + infosCom.getLat(), 5));
2159,6 → 2170,11
lon = -61.08334;
zoom = 7;
break;
case "lbf" :
lat = 33.53;
lon = 35.30;
zoom = 7;
break;
case "bdtfx" :
default:
lat = 47.0504;
2180,11 → 2196,19
}
 
private void obtenirInformationCommune() {
observationMediateur.obtenirInformationCommune(getCommuneSansDepartement(), Util.obtenirDepartementAPartirChaineCommune(departement, commune.getText()));
String idLoc = "";
if(departement != null && !departement.isEmpty()) {
idLoc = departement;
} else {
idLoc = Util.obtenirIdLocAPartirChaineCommune(commune.getText());
if(Util.estUnNombre(idLoc)) {
idLoc = Util.formaterDepartement(idLoc);
}
}
observationMediateur.obtenirInformationCommune(getCommuneSansIdLoc(), idLoc);
}
 
public double[] coordonneesValides() {
 
try {
 
double lat = Double.parseDouble(latitude.getValueAsString().replaceAll(",", "."));
2220,14 → 2244,10
return valeurCommune;
}
 
public String getDepartement() {
return Util.obtenirDepartementAPartirChaineCommune(departement, commune.getText());
public String getCommuneSansIdLoc() {
return Util.supprimerChaineIdLocalite(getCommune());
}
 
public String getCommuneSansDepartement() {
return Util.supprimerNumDepartementChaineLocalite(getCommune());
}
 
private String getValeurChampListeLibre(ComboBox champ) {
String valeurChamp = champ.getValue();
String valeurChampBrute = champ.getRawValue();