Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 263 → Rev 264

/trunk/src/org/tela_botanica/client/vues/observation/CartographieObservationVue.java
9,6 → 9,7
import com.google.gwt.maps.client.MapType;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.control.LargeMapControl;
import com.google.gwt.maps.client.event.MapZoomEndHandler;
import com.google.gwt.maps.client.event.MarkerClickHandler;
import com.google.gwt.maps.client.event.MarkerDragEndHandler;
import com.google.gwt.maps.client.event.MarkerDragStartHandler;
54,7 → 55,7
LatLng pointCommune = centreFrance;
String codeCommune = "";
int niveauZoom = 9;
int niveauZoom = 13;
 
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");
137,6 → 138,14
map.setCurrentMapType(MapType.getHybridMap());
carteAjoutee = true;
panneauCarto.doLayout();
map.addMapZoomEndHandler(new MapZoomEndHandler() {
 
public void onZoomEnd(MapZoomEndEvent event) {
niveauZoom = event.getNewZoomLevel();
}
});
}
 
public void AfficherMessageAucuneInfos() {
154,7 → 163,7
bouton.addListener("click", new EventCallback() {
 
public void execute(EventObject e) {
EntiteGeographiqueObservation infosCommune = new EntiteGeographiqueObservation(codeCommune,valeurCommune,null);
EntiteGeographiqueObservation infosCommune = new EntiteGeographiqueObservation(codeCommune,valeurCommune,null,null);
infosCommune.setLat(pointCommune.getLatitude()+"");
infosCommune.setLon(pointCommune.getLongitude()+"");
oMediateur.rafraichirSaisieCommuneObservation(infosCommune);
195,7 → 204,7
marker.addMarkerDragEndHandler(new MarkerDragEndHandler() {
public void onDragEnd(MarkerDragEndEvent event) {
afficherInfoMarker(marker);
obtenirInfosCommunes(marker.getLatLng());
}
 
});
/trunk/src/org/tela_botanica/client/vues/observation/FormulaireSaisieObservationVue.java
6,6 → 6,7
import java.util.Iterator;
 
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Configuration;
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
import org.tela_botanica.client.modeles.ListeObservation;
import org.tela_botanica.client.modeles.ListeReferentielCommune;
88,11 → 89,13
private ComboBox espece = null;
private String numeroNom = null;
private String numeroOrdre = null;
private String referentielGeo = null;
 
// Pour remise a zero partielle lors d'une validation
private enum Champs {
DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT ;
DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT, LATITUDE, LONGITUDE ;
public String toString() {
117,9 → 120,15
case ESPECE:
return "espèce";
case LATITUDE:
return "latitude";
case LONGITUDE:
return "longitude";
case TOUT:
return "date, commune, lieu dit, station, milieu, espèce, commentaire";
return "date, commune, lieu dit, station, milieu, espèce, commentaire, latitude, longitude";
}
return TOUT.toString();
}
136,7 → 145,7
private Toolbar bt = null ;
private final String VALEURS_MULTIPLES = "(Valeurs multiples)";
private final String modeleMessageModif = "commune:lieu-dit:station:milieu:date:espece:commentaire";
private final String modeleMessageModif = "commune:lieu-dit:station:milieu:latitude:longitude:date:espece:commentaire";
private boolean communeModifiee = false;
private boolean lieuDitModifie = false;
private boolean stationModifiee = false;
198,6 → 207,10
private HTML basculerverscarto;
private boolean longlatAjoutee;
 
private boolean latModifiee;
 
private boolean longModifiee;
/**
* Constructeur sans argument (privé car ne doit pas être utilisé)
276,22 → 289,23
//station.setTabIndex(3);
panneauPremierColonne.add(station, new AnchorLayoutData("95%"));
longitude = new TextField("X", "x", 100);
latitude = new TextField("X", "x", 100);
latitude.setAllowBlank(true);
longitude = new TextField("Y", "y", 100);
longitude.setAllowBlank(true);
latitude = new TextField("Y", "y", 100);
latitude.setAllowBlank(true);
// Panneau de type plusieurs champs de formulaire sur une meme ligne, où seront renseignés X/Y
coordPanel = new MultiFieldPanel();
coordPanel.setVisible(false);
coordPanel.addToRow(latitude, new ColumnLayoutData(0.5));
coordPanel.addToRow(longitude, new ColumnLayoutData(0.5));
coordPanel.addToRow(latitude, new ColumnLayoutData(0.5));
coordPanel.setBorder(false);
//création du champs coordonnées
//création du champs coordonnées
referentielGeo = Configuration.getReferentielGeo();
coordonnees = new TextField("Coordonnées", "", 0);
coordonnees = new TextField("Coordonnées ("+referentielGeo+")", "", 0);
coordonnees.setMaxLength(0);
coordonnees.setReadOnly(true);
coordonnees.setCls("fieldname");
344,7 → 358,7
//création du lien "Accès carto" dans le formulaire
basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"6\">Selection depuis la carto</a>");
basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"6\">Selection depuis une carte</a>");
basculerverscarto.addStyleName("lien");
//création info bulle sur le lien "accès carto"
405,10 → 419,7
comment.setHeight(50);
//comment.setTabIndex(7);
panneauSecondeColonne.add(comment, new AnchorLayoutData("95%") );
if (Window.getClientWidth()> Window.getClientHeight()) {
panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
788,7 → 799,67
}
}
});
latitude.addKeyPressListener(new EventCallback() {
 
public void execute(EventObject e) {
switch(e.getKey()) {
case KEY_ALT:
case KEY_CTRL:
case KEY_DOWN:
case KEY_END:
case KEY_ESCAPE:
case KEY_HOME:
case KEY_LEFT:
case KEY_PAGEDOWN:
case KEY_PAGEUP:
case KEY_RIGHT:
case KEY_SHIFT:
case KEY_TAB:
case KEY_UP:
break;
case KEY_ENTER:
validerSaisie(Champs.LATITUDE);
break;
 
default:
latModifiee = true;
}
}
});
longitude.addKeyPressListener(new EventCallback() {
 
public void execute(EventObject e) {
switch(e.getKey()) {
case KEY_ALT:
case KEY_CTRL:
case KEY_DOWN:
case KEY_END:
case KEY_ESCAPE:
case KEY_HOME:
case KEY_LEFT:
case KEY_PAGEDOWN:
case KEY_PAGEUP:
case KEY_RIGHT:
case KEY_SHIFT:
case KEY_TAB:
case KEY_UP:
break;
case KEY_ENTER:
validerSaisie(Champs.LONGITUDE);
break;
 
default:
longModifiee = true;
}
}
});
 
 
boutonOK.addListener(new ButtonListenerAdapter() {
999,13 → 1070,13
String nCommune = "";
 
if(infosCom.getLocation() != null && !infosCom.getLocation().equals("")) {
nCommune += infosCom.getLocation();
if(infosCom.getCommune() != null && !infosCom.getCommune().equals("")) {
nCommune += infosCom.getCommune();
}
if(infosCom.getIdLocation() != null && !infosCom.getIdLocation().equals("")) {
nCommune += " ("+infosCom.getIdLocation()+")";
departement = infosCom.getIdLocation();
if(infosCom.getIdLocalite() != null && !infosCom.getIdLocalite().equals("")) {
nCommune += " ("+infosCom.getIdLocalite()+")";
departement = infosCom.getIdLocalite();
}
commune.setValue(nCommune);
1017,6 → 1088,11
if(infosCom.getLon() != null && !infosCom.getLon().equals("")) {
longitude.setValue(infosCom.getLon());
}
coordPanel.setVisible(true);
latModifiee = true;
longModifiee = true;
}
 
public void obtenirListeReferentielCommune() {
1065,6 → 1141,12
}
 
Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
String[] coords = getValeurCoordonnees();
obs.setCoordonneeX(coords[0]);
obs.setCoordonneeY(coords[1]);
observationMediateur.ajouterObservation(obs);
}
1096,6 → 1178,11
Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
obs.setNumeroOrdre(numeroOrdre);
String[] coords = getValeurCoordonnees();
obs.setCoordonneeX(coords[0]);
obs.setCoordonneeY(coords[1]);
observationMediateur.modifierObservation(obs);
 
selecteurMode.setValue("création");
1113,6 → 1200,8
String dateM = null;
String especeM = null;
String commM = null;
String latM = null;
String longM = null;
String champs = modeleMessageModif;
1184,6 → 1273,18
champs = champs.replaceAll(":commentaire", "");
}
if(latModifiee) {
latM = latitude.getText();
}else {
champs = champs.replaceAll(":latitude", "");
}
if(longModifiee) {
longM = longitude.getText();
}else {
champs = champs.replaceAll(":longitude", "");
}
champs = champs.replaceAll(":",", ");
if(champs.startsWith(",")) {
champs = champs.replaceFirst(",", "");
1196,6 → 1297,8
} else {
Observation obs = new Observation(especeM,numNomSelM,communeM,departementM,lieuDitM,stationM,milieuM, commM,dateM);
obs.setNumeroOrdre(numeroOrdre);
obs.setCoordonneeX(latM);
obs.setCoordonneeY(longM);
if(Window.confirm(message)) {
observationMediateur.modifierObservationEnMasse(obs);
reinitialiserValeurModifiees();
1274,6 → 1377,11
numeroOrdre = obs.getNumeroOrdre() ;
}
if(!obs.getCoordonneeX().equals("null") && !obs.getCoordonneeX().equals("000null")
&& !obs.getCoordonneeY().equals("null") && !obs.getCoordonneeY().equals("000null")) {
latitude.setValue(obs.getCoordonneeX()) ;
longitude.setValue(obs.getCoordonneeY()) ;
}
}
1319,6 → 1427,14
numeroOrdre = "";
break;
case LATITUDE:
latitude.reset();
break;
case LONGITUDE:
longitude.reset();
break;
case TOUT:
commune.reset();
date.reset() ;
1353,7 → 1469,7
}
else
{
boutonOK.setText("Ajouter") ;
boutonOK.setText("Créer") ;
setTitle("Saisir") ;
boutonAnnuler.setText("Réinitialiser") ;
modification = false ;
1360,7 → 1476,6
selecteurMode.removeClass("x-selec-modif") ;
selecteurMode.setCls("x-selec-crea") ;
observationMediateur.onModeCreation();
}
}
1410,6 → 1525,8
String espece = null;
String date = null;
String notes = null;
String lat = null;
String lon = null;
String ordreObs = "";
1423,6 → 1540,8
espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi());
date = comparerDifferencesChamps(date, obsEnCours.getDate());
notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
lat = comparerDifferencesChamps(lat, obsEnCours.getCoordonneeX());
lon = comparerDifferencesChamps(lon, obsEnCours.getCoordonneeY());
ordreObs += obsEnCours.getNumeroOrdre()+",";
}
1429,6 → 1548,8
Observation obs=new Observation(espece,numeroNom,commune,departement,lieuDit,station,milieu, notes,date);
obs.setNumeroOrdre(ordreObs);
obs.setCoordonneeX(lat);
obs.setCoordonneeY(lon);
rafraichir(obs, false);
}
1458,6 → 1579,8
dateModifiee = false;
especeModifiee = false;
commModifie = false;
latModifiee = false;
longModifiee = false;
}
public void saisieTabindex()
1473,7 → 1596,7
 
public void onFocus(Field field) {
if(coordPanel.isVisible()) {
longitude.focus();
latitude.focus();
} else {
Ext.get("lien_carto").focus();
}
1480,8 → 1603,8
}
});
longitude.setTabIndex(8);
latitude.setTabIndex(9);
latitude.setTabIndex(8);
longitude.setTabIndex(9);
comment.setTabIndex(10);
date.setTabIndex(11);
espece.setTabIndex(12);
1518,34 → 1641,59
}
}
private String[] getValeurCoordonnees() {
double[] coDouble = coordonneesValides();
if(coDouble != null) {
String[] coord = {coDouble[0]+"",coDouble[1]+""};
return coord;
} else {
String[] coord = {"000null","000null" };
return coord;
}
}
private String obtenirDepartementAPartirChampCommune() {
String dep = "";
if(departement.equals("000null") || departement.equals("")) {
String[] depCom = commune.getText().split(" ");
if(depCom.length > 1) {
String dep = depCom[1].replace('(', ' ');
dep =dep.replace(')', ' ');
dep = dep.trim();
dep = dep.replace('\\',' ');
dep = dep.trim();
try
{
int nDep = Integer.parseInt(dep);
if(nDep > 0 && nDep < 110) {
departement = dep ;
}
}
catch(NumberFormatException e)
{
departement = "" ;
}
dep = depCom[1].replace('(', ' ');
} else {
dep = "";
}
} else {
dep = departement;
}
dep = dep.replace(')', ' ');
dep = dep.trim();
dep = dep.replace('\\',' ');
dep = dep.trim();
try
{
int nDep = Integer.parseInt(dep);
if(nDep > 0 && nDep < 110) {
departement = dep ;
}
if(departement.length() == 1) {
departement = "0"+departement;
}
}
catch(NumberFormatException e)
{
departement = "" ;
}
return departement;
}
private Field obtenirCorrespondanceChampsEnum(Champs champ) {
/*private Field obtenirCorrespondanceChampsEnum(Champs champ) {
switch(champ) {
case DATE:
return date;
1569,5 → 1717,5
return espece;
}
return null;
}
}*/
}