Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 680 → Rev 681

/trunk/src/org/tela_botanica/client/vues/observation/CartographieObservationVue.java
54,7 → 54,7
LatLng pointCommune = null;
String codeCommune = "";
int niveauZoom = 13;
int niveauZoom = 6;
 
Label panneauExplication = new Label(
"Précisez le lieu de votre observation et cliquez sur OK. Les coordonnées sont données en degrés décimaux, comptés positivement vers le Nord pour la latitude, et vers l'Est pour la longitude");
67,7 → 67,7
oMediateur = om;
setTitle("Carto");
setHeader(false);
setAutoWidth(true);
setPaddings(10);
 
107,6 → 107,10
panneauCarto.setAutoHeight(true);
}
public void setTailleCarte(int hauteur, int largeur) {
map.setSize(largeur+"px", (hauteur+"px"));
}
public void masquerChargement(boolean masquer) {
if(panneauCarto.isVisible()) {
148,6 → 152,8
if(!commune) {
fabriquerMarqueurIndication();
}
map.setZoomLevel(6);
map.checkResizeAndCenter();
map.setUIToDefault();
map.addControl(new LargeMapControl());
181,7 → 187,6
+"longitude="
+ marker.getLatLng().getLongitude() + "<br />latitude="
+ marker.getLatLng().getLatitude() + "</div>"));
map.setZoomLevel(12);
}
 
public void AfficherMessageAucuneInfos() {
231,8 → 236,7
 
if (nouvelleDonnees instanceof EntiteGeographiqueObservation) {
oMediateur.changementTabProg = true;
oMediateur.afficherOngletCartographiqueSansLocaliser();
oMediateur.afficherFenetreCarto();
EntiteGeographiqueObservation infos = (EntiteGeographiqueObservation) nouvelleDonnees;
313,6 → 317,11
String contenuMarker = "";
if(valeurCommune == null || valeurCommune.trim().equals("")) {
if(marker.getLatLng().getLongitude() == 0 && marker.getLatLng().getLatitude() == 0) {
LatLng point = centreFrance;
marker.setLatLng(point);
niveauZoom = 6;
}
contenuMarker = "<div id=\"info_contenu\">"+
"Aucune commune française trouvée à cet emplacement <br />"
+"Déplacez ce marqueur pour localiser votre observation (commune et coordonnées)<br />"
/trunk/src/org/tela_botanica/client/vues/observation/FormulaireSaisieObservationVue.java
204,6 → 204,8
private TextField longitude;
 
private TextField latitude;
private MultiFieldPanel htmlCommunePanel = null;
 
private MultiFieldPanel coordPanel;
 
211,7 → 213,7
private Label lienSelectionCommune = null;
 
private HTML accesformulaire;
private HTML afficherFormulaireLatLon;
 
private HTML basculerverscarto;
286,12 → 288,11
commune.setItemSelector("div.search-item-commune");
commune.setTypeAhead(true);
commune.setLoadingText("Recherche...");
commune.setHideTrigger(true);
//commune.setTabIndex(1);
//création du lien "Accès carto" dans le formulaire
basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"2\">Localiser</a>");
basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"2\">Localiser la commune</a>");
basculerverscarto.addStyleName("lien_actif");
//création info bulle sur le lien "accès carto"
300,10 → 301,11
tip2.applyTo(basculerverscarto.getElement());
//Sur une meme ligne, ajout de plusieurs champs
final MultiFieldPanel htmlCommunePanel = new MultiFieldPanel();
htmlCommunePanel = new MultiFieldPanel();
htmlCommunePanel.addToRow(commune,new ColumnLayoutData(0.7));
htmlCommunePanel.addToRow(basculerverscarto,new ColumnLayoutData(0.3));
int largeurCommune = Window.getClientWidth()/4;
htmlCommunePanel.addToRow(commune, largeurCommune);
htmlCommunePanel.addToRow(basculerverscarto, 160);
 
htmlCommunePanel.setBorder(false);
htmlCommunePanel.setId("x-commune-panel");
353,20 → 355,18
coordonnees.setCls("fieldname");
//création du lien "saisie X/Y" dans le formulaire
accesformulaire = new HTML("<a id=\"lien_coord\" href=\"#\" tabindex=\"6\">Saisie Lat/Lon ("+referentielGeo+")</a>");
accesformulaire.setWidth("100%");
accesformulaire.addStyleName("lien_actif");
//création info bulle sur le lien "saisie X/Y"
ToolTip tip1 = new ToolTip();
tip1.setHtml("Lat / Lon sont les latitudes / longitudes, à remplir en degrés décimaux");
tip1.applyTo(accesformulaire.getElement());
afficherFormulaireLatLon = new HTML("<span style=\"padding-left:30px;\" class=\"conteneur_lien_afficher_lat_lon\">" +
"<a title=\"Lat / Lon sont les latitudes / longitudes, à remplir en degrés décimaux\" class=\"lien_actif\" id=\"lien_coord\" href=\"#\" tabindex=\"6\">Saisie Lat/Lon ("+referentielGeo+")</a>" +
"<span><span style=\"padding-left:20px\" class=\"conteneur_lien_localiser_lat_lon\">"+
"<a title=\"Cliquez pour obtenir les coordonnées de votre observation à partir de la carte\" class=\"lien_actif\" id=\"lien_carto_coord\" href=\"#\" tabindex=\"7\">Localiser sur la carte</a>"+
"</span>");
//ajout d'un listener sur le lien "saisie X/Y"
coordPanel.addListener(new PanelListenerAdapter() {
public void onAfterLayout(Container c) {
ExtElement lienCoord = Ext.get("lien_coord");
lienCoord.removeAllListeners();
lienCoord.addListener("click", new EventCallback() {
381,6 → 381,14
CarnetEnLigneMediateur.fireResize();
}
}) ;
ExtElement lienCartoCoord = Ext.get("lien_carto_coord");
lienCartoCoord.removeAllListeners();
lienCartoCoord.addListener("click", new EventCallback() {
public void execute(EventObject e) {
obtenirInformationCoord();
}
}) ;
ExtElement lienCarto = Ext.get("lien_carto");
lienCarto.removeAllListeners();
404,8 → 412,7
latitude.setWidth(largeurN+"px");
longitude.setWidth(largeurN+"px");
lienSelectionCommune.setWidth(largeurN+"px");
lienSelectionCommune.setWidth(largeurN+"px");
}
}
});
414,7 → 421,7
final MultiFieldPanel htmlPanel = new MultiFieldPanel();
htmlPanel.addToRow(coordonnees, 100);
htmlPanel.addToRow(accesformulaire, new ColumnLayoutData(0.5));
htmlPanel.addToRow(afficherFormulaireLatLon, new ColumnLayoutData(0.9));
htmlPanel.setBorder(false);
htmlPanel.setId("x-coord-panel");
421,12 → 428,13
panneauPremierColonne.add(htmlPanel);
panneauPremierColonne.add(coordPanel);
date = new DateField("Date", "date", 100);
date = new DateField("Date", "date", 200);
date.setAllowBlank(true);
formatDate = "d/m/Y";
date.setFormat(formatDate) ;
date.setTitle("Date de l'observation au format jj/mm/aaaa");
//date.setTabIndex(5);
panneauPremierColonne.add(date, new AnchorLayoutData("60%"));
panneauPremierColonne.add(date, new AnchorLayoutData("55%"));
espece=new ComboBox("Espèce","nom");
530,7 → 538,7
panneauPremierColonne.doLayout();
panneauSecondeColonne.doLayout();
htmlCommunePanel.doLayout();
htmlPanel.doLayout();
1150,35 → 1158,43
nCommune += infosCom.getCommune();
if(!infosCom.getIdLocalite().trim().equals(""))
nCommune += " ("+infosCom.getIdLocalite()+")";
lienSelectionCommune.setHtml("<a id=\"lien_selection_commune\" tabindex=\"9\">"+nCommune+"</a>");
lienSelectionCommune.setStyleName("img-curseur-depl");
Ext.get("lien_selection_commune").addListener("click",new EventCallback() {
public void execute(EventObject e) {
rafraichirCommune(infosCom);
}
});
Ext.get("lien_selection_commune").addListener("keypress",new EventCallback() {
public void execute(EventObject e) {
if(e.getCharCode() == KEY_ENTER) {
rafraichirCommune(infosCom);
}
}
});
Ext.get("lien_selection_commune").addListener("focus",new EventCallback() {
public void execute(EventObject e) {
Ext.get("lien_selection_commune").toggleClass("lien_sel");
}
});
Ext.get("lien_selection_commune").addListener("blur",new EventCallback() {
public void execute(EventObject e) {
Ext.get("lien_selection_commune").toggleClass("lien_sel");
}
});
} else {
if(rechercheCommuneEnCours) {
lienSelectionCommune.setHtml("<span id=\"aucune_selection_commune\"> Erreur de localisation </span>");
} else {
lienSelectionCommune.setHtml("<span id=\"aucune_selection_commune\"> </span>");
}
}
lienSelectionCommune.setHtml("<a id=\"lien_selection_commune\" tabindex=\"9\">"+nCommune+"</a>");
lienSelectionCommune.setStyleName("img-curseur-depl");
Ext.get("lien_selection_commune").addListener("click",new EventCallback() {
public void execute(EventObject e) {
rafraichirCommune(infosCom);
}
});
Ext.get("lien_selection_commune").addListener("keypress",new EventCallback() {
public void execute(EventObject e) {
if(e.getCharCode() == KEY_ENTER) {
rafraichirCommune(infosCom);
}
}
});
Ext.get("lien_selection_commune").addListener("focus",new EventCallback() {
public void execute(EventObject e) {
Ext.get("lien_selection_commune").toggleClass("lien_sel");
}
});
Ext.get("lien_selection_commune").addListener("blur",new EventCallback() {
public void execute(EventObject e) {
Ext.get("lien_selection_commune").toggleClass("lien_sel");
}
});
 
Ext.get(lienSelectionCommune.getElement()).unmask();
rechercheCommuneEnCours = false;
1245,6 → 1261,12
 
public void ajouterObservation() {
if(!Util.verifierDateFormatCel(date.getRawValue()) && !date.getRawValue().equals("")) {
Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
date.setInvalidText("Date invalide");
return;
}
if(departement != null) {
// TODO : regler le probleme a la base plutot que ce patch
1271,8 → 1293,10
}
}
}
String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
 
Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
String[] coords = getValeurCoordonnees();
1284,6 → 1308,12
private void modifierObservation() {
if(!Util.verifierDateFormatCel(date.getRawValue()) && !date.getRawValue().equals("")) {
Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
date.setInvalidText("Date invalide");
return;
}
if(departement.equals("000null") || departement.equals("")) {
String[] depCom = commune.getText().split(" ");
if(depCom.length > 1) {
1307,7 → 1337,9
}
}
Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
obs.setNumeroOrdre(numeroOrdre);
String[] coords = getValeurCoordonnees();
1388,6 → 1420,7
 
if(dateModifiee && !date.getRawValue().equals(VALEURS_MULTIPLES)) {
dateM = date.getRawValue();
dateM = Util.remplacerSeparateursDateFormatCel(dateM);
}else {
champs = champs.replaceAll(":date", "");
}
1481,7 → 1514,7
}
if(!obs.getCommentaire().equals("null") && !obs.getCommentaire().equals("000null")) {
 
comment.setRawValue(remplacerSautsDeligneMalEncodes(obs.getCommentaire()));
comment.setRawValue(Util.remplacerSautsDeligneMalEncodes(obs.getCommentaire()));
}
if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
1741,8 → 1774,8
}
});
latitude.setTabIndex(7);
longitude.setTabIndex(8);
latitude.setTabIndex(8);
longitude.setTabIndex(9);
comment.setTabIndex(10);
date.setTabIndex(11);
espece.setTabIndex(12);
1755,7 → 1788,7
if(coordonneesValides() != null) {
observationMediateur.obtenirInformationCoord(LatLng.newInstance(coordonneesValides()[0],coordonneesValides()[1]));
} else {
Window.alert("Les coordonnées saisies sont invalides");
observationMediateur.afficherFenetreCarto();
}
 
}
1848,7 → 1881,7
public String getDepartement() {
return obtenirDepartementAPartirChampCommune();
}
public String getCommuneSansDepartement() {
return Util.supprimerNumDepartementChaineLocalite(getCommune());
}
1859,15 → 1892,10
public void redimensionnerFormulaire() {
doLayout();
//panneauIntermediaire.doLayout();
//htmlCommunePanel.setWidth(panneauPremierColonne.getWidth() - 10);
afficherFormulaireLatLon.setWidth(panneauIntermediaire.getWidth()+"px");
panneauPremierColonne.doLayout();
panneauSecondeColonne.doLayout();
panneauIntermediaire.doLayout();
}
public String remplacerSautsDeligneMalEncodes(String chaineAvecSautsDeLignesMalEncodes) {
String chaineAvecSautsDeLignesBienEncodes = chaineAvecSautsDeLignesMalEncodes.replace('\\','%');
chaineAvecSautsDeLignesBienEncodes = chaineAvecSautsDeLignesBienEncodes.replaceAll("%n","%");
chaineAvecSautsDeLignesBienEncodes = chaineAvecSautsDeLignesBienEncodes.replace('%','\n');
return chaineAvecSautsDeLignesBienEncodes;
}
}