/trunk/src/org/tela_botanica/client/vues/observation/ListeObservationVue.java |
---|
71,6 → 71,7 |
private ColumnConfig nomSaisiObservation; |
private ColumnConfig nomRetenuObservation; |
private ColumnConfig lieuObservation; |
private ColumnConfig altitudeObservation; |
private ColumnConfig dateObservation; |
private ColumnConfig ordreObservation; |
private ColumnConfig abondanceObservation; |
278,10 → 279,12 |
} |
}); |
referentielTaxoObservation = new ColumnConfig("Référentiel", "referentiel_taxo_observation", 15, true, colRend); |
nomSaisiObservation = new ColumnConfig("Nom saisi", "nomSaisi_observation", 130, true, colRend); |
nomRetenuObservation = new ColumnConfig("Nom retenu", "nomRetenu_observation", 130, true, colRend); |
lieuObservation = new ColumnConfig("Lieu", "lieu_observation", 130, true, colRend); |
altitudeObservation = new ColumnConfig("Alt", "altitude_observation", 10, true, colRend); |
dateObservation = new ColumnConfig("Date", "date_observation", 70, true, dateRend); |
abondanceObservation = new ColumnConfig("Abondance", "abondance", 50, true, colRend); |
certitudeObservation = new ColumnConfig("Identification", "certitude", 50, true, new Renderer() { |
294,7 → 297,12 |
}); |
phenologieObservation = new ColumnConfig("Phénologie", "phenologie", 40, true, colRend); |
ordreObservation = new ColumnConfig("Ordre", "ordre_observation", 70, true, colRend); |
ColumnConfig[] cm = {etatObservation, referentielTaxoObservation, nomSaisiObservation, certitudeObservation, nomRetenuObservation, abondanceObservation, phenologieObservation, lieuObservation, dateObservation, ordreObservation}; |
ColumnConfig[] cm = {etatObservation, referentielTaxoObservation, |
nomSaisiObservation, certitudeObservation, |
nomRetenuObservation, abondanceObservation, |
phenologieObservation, lieuObservation, |
altitudeObservation, dateObservation, |
ordreObservation}; |
return cm; |
} |
542,7 → 550,7 |
if(nouvelleDonnees instanceof ListeObservation) |
{ |
ListeObservation data = (ListeObservation) nouvelleDonnees ; |
Object[][] observationData = new Object[data.size()][11]; |
Object[][] observationData = new Object[data.size()][12]; |
int i = 0 ; |
if(data.size() == 0) |
564,9 → 572,10 |
observationData[i][5] = obs.getAbondance(); |
observationData[i][6] = obs.getPhenologie(); |
observationData[i][7] = Util.formaterLieu(obs, modeleLieu); |
observationData[i][8] = obs.getDate(); |
observationData[i][9] = obs.getNumeroOrdre(); |
observationData[i][10] = obs.getNumeroNomenclaturalSaisi(); |
observationData[i][8] = formaterAltitude(obs.getAltitude()); |
observationData[i][9] = obs.getDate(); |
observationData[i][10] = obs.getNumeroOrdre(); |
observationData[i][11] = obs.getNumeroNomenclaturalSaisi(); |
i++ ; |
} |
647,6 → 656,14 |
} |
} |
private String formaterAltitude(String alt) { |
String alfFmt = Util.formaterNombre(alt); |
if(!alfFmt.isEmpty() && !Util.estZero(alfFmt)) { |
alfFmt = alfFmt+" m."; |
} |
return alfFmt; |
} |
private FieldDef[] getDefinitionChamps() { |
// creation du store qui les contient |
FieldDef defEtatObservation = new StringFieldDef("etat_observation"); |
657,6 → 674,7 |
FieldDef defAbondanceObservation = new StringFieldDef("abondance"); |
FieldDef defPhenologieObservation = new StringFieldDef("phenologie"); |
FieldDef defLieuObservation = new StringFieldDef("lieu_observation"); |
FieldDef defAltObservation = new StringFieldDef("altitude_observation"); |
FieldDef defDateObservation = new StringFieldDef("date_observation"); |
FieldDef defOrdreObservation = new IntegerFieldDef("ordre_observation"); |
664,7 → 682,7 |
FieldDef defNumeroNomenclaturalSaisiObservation = new StringFieldDef("numeroNomenclaturalSaisi_observation"); |
FieldDef[] defTab = {defEtatObservation, defRefTaxObservation,defNomSaisiObservation, defCertitudeObservation, defNomRetenuObservation, defAbondanceObservation, |
defPhenologieObservation, defLieuObservation, defDateObservation, defOrdreObservation, defNumeroNomenclaturalSaisiObservation }; |
defPhenologieObservation, defLieuObservation, defAltObservation, defDateObservation, defOrdreObservation, defNumeroNomenclaturalSaisiObservation }; |
return defTab; |
} |
/trunk/src/org/tela_botanica/client/vues/observation/FormulaireSaisieObservationVue.java |
---|
9,6 → 9,7 |
import org.tela_botanica.client.CarnetEnLigneMediateur; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.objets.ChampEtendu; |
import org.tela_botanica.client.modeles.objets.Configuration; |
import org.tela_botanica.client.modeles.objets.EntiteGeographiqueObservation; |
import org.tela_botanica.client.modeles.objets.ListeObservation; |
100,7 → 101,7 |
// Pour remise a zero partielle lors d'une validation |
private enum Champs { |
DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT, LATITUDE, LONGITUDE, ABONDANCE, CERTITUDE, REFERENTIELTAXO, PHENOLOGIE; |
DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT, LATITUDE, LONGITUDE, ALTITUDE, ABONDANCE, CERTITUDE, REFERENTIELTAXO, PHENOLOGIE; |
@Override |
public String toString() { |
133,6 → 134,9 |
case LONGITUDE: |
return "longitude"; |
case ALTITUDE: |
return "altitude"; |
case ABONDANCE: |
return "abondance"; |
146,7 → 150,7 |
return "phenologie"; |
case TOUT: |
return "date, commune, lieu dit, station, milieu, espèce, commentaire, latitude, longitude, abondance, identification, referentiel, phenologie"; |
return "date, commune, lieu dit, station, milieu, espèce, commentaire, latitude, longitude, altitude, abondance, identification, referentiel, phenologie"; |
} |
return TOUT.toString(); |
} |
166,7 → 170,7 |
private Toolbar bt = null ; |
private final String VALEURS_MULTIPLES = "(Valeurs multiples)"; |
private final String modeleMessageModif = "commune:lieu-dit:station:milieu:latitude:longitude:date:espece:commentaire:abondance:identification:referentiel:phenologie"; |
private final String modeleMessageModif = "commune:lieu-dit:station:milieu:latitude:longitude:altitude:date:espece:commentaire:abondance:identification:referentiel:phenologie"; |
private boolean communeModifiee = false; |
private boolean lieuDitModifie = false; |
private boolean stationModifiee = false; |
222,6 → 226,8 |
private TextField latitude; |
private TextField altitude; |
private MultiFieldPanel htmlCommunePanel = null; |
private MultiFieldPanel coordPanel; |
239,6 → 245,8 |
private boolean latModifiee; |
private boolean longModifiee; |
private boolean altModifiee; |
protected boolean rechercheCommuneEnCours = false; |
357,6 → 365,10 |
longitude = new TextField("Lon", "lon"); |
longitude.setGrowMax(70); |
longitude.setAllowBlank(true); |
altitude = new TextField("Alt (mètres)", "alt"); |
altitude.setGrowMax(70); |
altitude.setAllowBlank(true); |
lienSelectionCommune = new Label(""); |
379,6 → 391,8 |
lienSelectionCommune.addClass("lien_decale"); |
coordPanel.setBorder(false); |
coordPanel.addToRow(altitude, new ColumnLayoutData(largeur)); |
//création du champs coordonnées |
referentielGeo = Configuration.getReferentielGeo(); |
712,6 → 726,7 |
ajouterListenerChampEvenementsClavier(comment); |
ajouterListenerChampEvenementsClavier(latitude); |
ajouterListenerChampEvenementsClavier(longitude); |
ajouterListenerChampEvenementsClavier(altitude); |
ajouterListenerChampEvenementsClavier(selecteurAbondance); |
ajouterListenerChampEvenementsClavier(selecteurCertitude); |
ajouterListenerChampEvenementsClavier(selecteurStadePheno); |
897,6 → 912,10 |
validerSaisie(Champs.LATITUDE); |
} |
if(champ.equals(altitude)) { |
validerSaisie(Champs.ALTITUDE); |
} |
if(champ.equals(espece)) { |
if(selectionEspece) { |
especeModifiee = true; |
963,6 → 982,10 |
tCoord.schedule(250); |
} |
if(champ.equals(altitude)) { |
altModifiee = true; |
} |
if(champ.equals(comment)) { |
commModifie = true; |
} |
1304,6 → 1327,7 |
String[] coords = getValeurCoordonnees(); |
obs.setLatitude(coords[0]); |
obs.setLongitude(coords[1]); |
obs.setAltitude(altitude.getText()); |
obs.setAbondance(getAbondance()); |
obs.setCertitude(getCertitude()); |
1355,6 → 1379,7 |
obs.setLatitude(coords[0]); |
obs.setLongitude(coords[1]); |
obs.setAltitude(altitude.getText()); |
obs.setAbondance(getAbondance()); |
obs.setCertitude(getCertitude()); |
1382,6 → 1407,7 |
String commM = null; |
String latM = null; |
String longM = null; |
String altM = null; |
String abondanceM = null; |
String certitudeM = null; |
String referentielTaxoM = null; |
1464,6 → 1490,12 |
champs = champs.replaceAll(":latitude", ""); |
} |
if(altModifiee) { |
altM = altitude.getText(); |
}else { |
champs = champs.replaceAll(":altitude", ""); |
} |
if(longModifiee) { |
longM = longitude.getText(); |
}else { |
1508,6 → 1540,7 |
obs.setNumeroOrdre(numeroOrdre); |
obs.setLatitude(latM); |
obs.setLongitude(longM); |
obs.setAltitude(altM); |
obs.setAbondance(abondanceM); |
obs.setCertitude(certitudeM); |
obs.setReferentielTaxo(referentielTaxoM); |
1596,12 → 1629,15 |
numeroOrdre = obs.getNumeroOrdre() ; |
} |
if(!obs.getLatitude().equals("null") && !obs.getLatitude().equals("000null") |
&& !obs.getLongitude().equals("null") && !obs.getLongitude().equals("000null")) { |
latitude.setValue(obs.getLatitude()) ; |
longitude.setValue(obs.getLongitude()) ; |
if(doitAfficherLatLon(obs)) { |
latitude.setValue(Util.formaterNombre(obs.getLatitude())) ; |
longitude.setValue(Util.formaterNombre(obs.getLongitude())) ; |
} |
if(!obs.getAltitude().isEmpty() && !obs.getAltitude().equals("null") && !obs.getAltitude().equals("000null")) { |
altitude.setValue(Util.formaterNombre(obs.getAltitude())) ; |
} |
selecteurAbondance.getStore().load(); |
selecteurAbondance.setValue(obs.getAbondance()); |
1626,6 → 1662,17 |
afficherChampsEtendus(obs); |
} |
private boolean doitAfficherLatLon(Observation obs) { |
return !obs.getLatitude().isEmpty() && |
!obs.getLatitude().equals("null") && |
!obs.getLatitude().equals("000null") && |
!Util.estZero(obs.getLatitude()) && |
!obs.getLongitude().isEmpty() && |
!obs.getLongitude().equals("null") && |
!obs.getLongitude().equals("000null") && |
!Util.estZero(obs.getLongitude()); |
} |
private void viderChampsEtendus() { |
if(listeChampsEtendus != null) { |
for (Iterator<String> it = listeChampsEtendus.keySet().iterator(); it.hasNext();) { |
1642,20 → 1689,23 |
listeChampsEtendus = new HashMap<String, TextField>(obs.getChampsEtendus().size()); |
boolean gauche = true; |
for (Iterator<String> iterator = obs.getChampsEtendus().keySet().iterator(); iterator.hasNext();) { |
String label = iterator.next(); |
String valeur = obs.getChampsEtendus().get(label); |
String id = iterator.next(); |
ChampEtendu champ = obs.getChampsEtendus().get(id); |
String valeur = champ.getValeur(); |
String label = champ.getLabel(); |
TextField champEtendu = new TextField(); |
champEtendu.setAutoWidth(true); |
champEtendu.setLabel(formaterLabel(label)); |
champEtendu.setTitle(label); |
champEtendu.setValue(valeur); |
TextField champTexteEtendu = new TextField(); |
champTexteEtendu.setAutoWidth(true); |
champTexteEtendu.setLabel(formaterLabel(label)); |
champTexteEtendu.setTitle(label); |
champTexteEtendu.setId(id); |
champTexteEtendu.setValue(valeur); |
if(gauche) { |
panneauPremierColonne.add(champEtendu); |
panneauPremierColonne.add(champTexteEtendu); |
} else { |
panneauSecondeColonne.add(champEtendu); |
panneauSecondeColonne.add(champTexteEtendu); |
} |
listeChampsEtendus.put(label, champEtendu); |
listeChampsEtendus.put(id, champTexteEtendu); |
gauche = !gauche; |
} |
} |
1662,13 → 1712,16 |
doLayout(); |
} |
private Map<String, String> getValeursChampsEtendus() { |
Map<String, String> valeursChampsEtendus = new HashMap<String, String>(); |
private Map<String, ChampEtendu> getValeursChampsEtendus() { |
Map<String, ChampEtendu> valeursChampsEtendus = new HashMap<String, ChampEtendu>(); |
if(listeChampsEtendus != null) { |
for (Iterator<String> it = listeChampsEtendus.keySet().iterator(); it.hasNext();) { |
String labelChamp = it.next(); |
TextField champEtendu = listeChampsEtendus.get(labelChamp); |
valeursChampsEtendus.put(labelChamp, champEtendu.getValueAsString()); |
String cle = it.next(); |
TextField champTexteEtendu = listeChampsEtendus.get(cle); |
String label = champTexteEtendu.getFieldLabel(); |
String valeur = champTexteEtendu.getValueAsString(); |
ChampEtendu champEtendu = new ChampEtendu(cle, label, valeur); |
valeursChampsEtendus.put(cle, champEtendu); |
} |
} |
return valeursChampsEtendus; |
1733,6 → 1786,10 |
afficherIndicationCommune(null); |
break; |
case ALTITUDE: |
altitude.reset(); |
break; |
case ABONDANCE: |
selecteurAbondance.setValue(""); |
break; |
1759,6 → 1816,7 |
milieu.reset() ; |
latitude.reset(); |
longitude.reset(); |
altitude.reset(); |
departement =""; |
espece.reset(); |
selecteurAbondance.clearValue(); |
1847,6 → 1905,7 |
String notes = null; |
String lat = null; |
String lon = null; |
String alt = null; |
String abondance = null; |
String certitude = null; |
String referentielTaxo = null; |
1866,6 → 1925,7 |
notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire()); |
lat = comparerDifferencesChamps(lat, obsEnCours.getLatitude()); |
lon = comparerDifferencesChamps(lon, obsEnCours.getLongitude()); |
alt = comparerDifferencesChamps(alt, obsEnCours.getAltitude()); |
abondance = comparerDifferencesChamps(abondance, obsEnCours.getAbondance()); |
certitude = comparerDifferencesChamps(certitude, obsEnCours.getCertitude()); |
referentielTaxo = comparerDifferencesChamps(referentielTaxo, obsEnCours.getReferentielTaxo()); |
1878,6 → 1938,7 |
obs.setNumeroOrdre(ordreObs); |
obs.setLatitude(lat); |
obs.setLongitude(lon); |
obs.setAltitude(alt); |
obs.setAbondance(abondance); |
obs.setCertitude(certitude); |
obs.setReferentielTaxo(referentielTaxo); |
1911,6 → 1972,7 |
commModifie = false; |
latModifiee = false; |
longModifiee = false; |
altModifiee = false; |
abondanceModifiee = false; |
certitudeModifiee = false; |
referentielTaxoModifie = false; |
1940,14 → 2002,15 |
latitude.setTabIndex(8); |
longitude.setTabIndex(9); |
comment.setTabIndex(10); |
date.setTabIndex(11); |
espece.setTabIndex(12); |
selecteurCertitude.setTabIndex(13); |
selecteurAbondance.setTabIndex(14); |
selecteurStadePheno.setTabIndex(15); |
boutonOK.setTabIndex(16); |
boutonAnnuler.setTabIndex(17); |
altitude.setTabIndex(10); |
comment.setTabIndex(11); |
date.setTabIndex(12); |
espece.setTabIndex(13); |
selecteurCertitude.setTabIndex(14); |
selecteurAbondance.setTabIndex(15); |
selecteurStadePheno.setTabIndex(16); |
boutonOK.setTabIndex(17); |
boutonAnnuler.setTabIndex(18); |
} |
/trunk/src/org/tela_botanica/client/modeles/dao/ObservationAsynchroneDAO.java |
---|
65,11 → 65,12 |
+"&commentaire="+obs.getCommentaire() |
+"&latitude="+URL.encodeComponent(""+obs.getLatitude()) |
+"&longitude="+URL.encodeComponent(""+obs.getLongitude()) |
+"&altitude="+URL.encodeComponent(""+obs.getAltitude()) |
+"&abondance="+URL.encodeComponent(""+obs.getAbondance()) |
+"&certitude="+URL.encodeComponent(""+obs.getCertitude()) |
+"&phenologie="+URL.encodeComponent(""+obs.getPhenologie()) |
+"&nom_referentiel="+URL.encodeComponent(""+obs.getReferentielTaxo()) |
+"&"+Util.convertirMapEnChaineRequete(obs.getChampsEtendus(), "obs_etendue"); |
+"&obs_etendue="+URL.encodeComponent(""+Util.convertirChampsEtendusEnChaineRequete(obs.getChampsEtendus())); |
try { |
rb.sendRequest(postData, new RequestCallback() { |
118,11 → 119,12 |
+"&commentaire="+obs.getCommentaire() |
+"&latitude="+URL.encodeComponent(""+obs.getLatitude()) |
+"&longitude="+URL.encodeComponent(""+obs.getLongitude()) |
+"&altitude="+URL.encodeComponent(""+obs.getAltitude()) |
+"&abondance="+URL.encodeComponent(""+obs.getAbondance()) |
+"&certitude="+URL.encodeComponent(""+obs.getCertitude()) |
+"&phenologie="+URL.encodeComponent(""+obs.getPhenologie()) |
+"&nom_referentiel="+URL.encodeComponent(""+obs.getReferentielTaxo()) |
+"&"+Util.convertirMapEnChaineRequete(obs.getChampsEtendus(), "obs_etendue"); |
+"&obs_etendue="+URL.encodeComponent(""+Util.convertirChampsEtendusEnChaineRequete(obs.getChampsEtendus())); |
try { |
rb.sendRequest(postData, new RequestCallback() { |
/trunk/src/org/tela_botanica/client/modeles/dao/ListeObservationAsynchroneDAO.java |
---|
180,6 → 180,10 |
postData += "&longitude="+URL.encodeComponent(""+obs.getLongitude()); |
} |
if(obs.getAltitude() != null) { |
postData += "&altitude="+URL.encodeComponent(""+obs.getAltitude()); |
} |
if(obs.getAbondance() != null) { |
postData += "&abondance="+URL.encodeComponent(""+obs.getAbondance()); |
} |
/trunk/src/org/tela_botanica/client/modeles/objets/ChampEtendu.java |
---|
New file |
0,0 → 1,42 |
package org.tela_botanica.client.modeles.objets; |
public class ChampEtendu { |
private String cle; |
private String label; |
private String valeur; |
public ChampEtendu() { |
} |
public ChampEtendu(String cle, String label, String valeur) { |
this.setCle(cle); |
this.setLabel(label); |
this.setValeur(valeur); |
} |
public String getCle() { |
return cle; |
} |
public void setCle(String cle) { |
this.cle = cle; |
} |
public String getLabel() { |
return label; |
} |
public void setLabel(String label) { |
this.label = label; |
} |
public String getValeur() { |
return valeur; |
} |
public void setValeur(String valeur) { |
this.valeur = valeur; |
} |
} |
/trunk/src/org/tela_botanica/client/modeles/objets/Observation.java |
---|
35,7 → 35,7 |
private String phenologie=null; |
private String altitude=null; |
private Map<String, String> champsEtendus=null; |
private Map<String, ChampEtendu> champsEtendus=null; |
public Observation() { |
} |
110,6 → 110,7 |
this.id = Util.getValeurJsonOuVide(observation,"id_observation"); |
this.latitude = Util.getValeurJsonOuVide(observation,"latitude"); |
this.longitude = Util.getValeurJsonOuVide(observation,"longitude"); |
this.altitude = Util.getValeurJsonOuVide(observation,"altitude"); |
this.motsCles = Util.getValeurJsonOuVide(observation,"mots_cles"); |
this.abondance = Util.getValeurJsonOuVide(observation,"abondance"); |
this.certitude = Util.getValeurJsonOuVide(observation,"certitude"); |
331,24 → 332,41 |
} |
public void setValeurChampEtendu(String cle, String valeur) { |
champsEtendus.put(cle, valeur); |
public void setValeurChampEtendu(String cle, String valeur, String label) { |
ChampEtendu champ = new ChampEtendu(cle, label, valeur); |
champsEtendus.put(cle, champ); |
} |
public ChampEtendu getChampEtendu(String cle) { |
ChampEtendu champ = null; |
if(champsEtendus.containsKey(cle)) { |
champ = champsEtendus.get(cle); |
} |
return champ; |
} |
public String getLabelChampEtendu(String cle) { |
String valeur = ""; |
if(champsEtendus.containsKey(cle)) { |
valeur = champsEtendus.get(cle).getLabel(); |
} |
return valeur; |
} |
public String getValeurChampEtendu(String cle) { |
String valeur = ""; |
if(champsEtendus.containsKey(cle)) { |
valeur = champsEtendus.get(cle); |
valeur = champsEtendus.get(cle).getValeur(); |
} |
return valeur; |
} |
public Map<String, String> getChampsEtendus() { |
public Map<String, ChampEtendu> getChampsEtendus() { |
return champsEtendus; |
} |
public void setChampsEtendus(Map<String, String> champsEtendus) { |
public void setChampsEtendus(Map<String, ChampEtendu> champsEtendus) { |
this.champsEtendus = champsEtendus; |
} |
} |
/trunk/src/org/tela_botanica/client/util/Util.java |
---|
4,9 → 4,11 |
import java.util.Iterator; |
import java.util.Map; |
import org.tela_botanica.client.modeles.objets.ChampEtendu; |
import org.tela_botanica.client.modeles.objets.Observation; |
import com.google.gwt.http.client.URL; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONObject; |
import com.google.gwt.json.client.JSONString; |
19,28 → 21,45 |
return jsonNonNull(jo, index) ? ((JSONString)jo.get(index)).stringValue() : ""; |
} |
public static Map<String, String> getMapValeursOuVide(JSONObject jo, String index) { |
Map<String, String> mapValeurs = new HashMap<String, String>(); |
if(jo.get(index) != null && jo.get(index).isObject() != null) { |
JSONObject mapJo = jo.get(index).isObject(); |
for (Iterator<String> it = mapJo.keySet().iterator(); it.hasNext();) { |
String cle = it.next(); |
mapValeurs.put(cle, mapJo.get(cle).isString().stringValue()); |
public static Map<String, ChampEtendu> getMapValeursOuVide(JSONObject jo, String index) { |
Map<String, ChampEtendu> mapValeurs = new HashMap<String, ChampEtendu>(); |
if(jo.get(index) != null && jo.get(index).isArray() != null) { |
JSONArray tabJo = jo.get(index).isArray(); |
for (int i = 0; i < tabJo.size(); i++) { |
JSONObject champJson = tabJo.get(i).isObject(); |
String cle = champJson.get("cle").isString().stringValue(); |
String label = champJson.get("label").isString().stringValue(); |
String valeur = champJson.get("valeur").isString().stringValue(); |
ChampEtendu champ = new ChampEtendu(cle, label, valeur); |
mapValeurs.put(cle, champ); |
} |
} |
return mapValeurs; |
} |
public static String convertirMapEnChaineRequete(Map<String, String> map, String cleUrl) { |
String chaineChamps = ""; |
for (Iterator<String> it = map.keySet().iterator(); it.hasNext();) { |
String cle = it.next(); |
String valeur = map.get(cle); |
chaineChamps += URL.encode(cleUrl+"["+cle+"]")+"="+URL.encode(valeur)+"&"; |
} |
return chaineChamps; |
public static String convertirChampsEtendusEnChaineRequete(Map<String, ChampEtendu> map) { |
String json = ""; |
if (map != null && !map.isEmpty()) { |
JSONArray jsonArr = new JSONArray(); |
int i = 0; |
for (Map.Entry<String, ChampEtendu> entry: map.entrySet()) { |
jsonArr.set(i, convertirChampEtenduEnJson(entry.getValue())); |
i++; |
} |
json = jsonArr.toString(); |
} |
return json; |
} |
public static JSONObject convertirChampEtenduEnJson(ChampEtendu champEtendu) { |
JSONObject jsonObj = new JSONObject(); |
jsonObj.put("cle", new JSONString(champEtendu.getCle())); |
jsonObj.put("label", new JSONString(champEtendu.getLabel())); |
jsonObj.put("valeur", new JSONString(champEtendu.getValeur())); |
return jsonObj; |
} |
public static boolean jsonNonNull(JSONObject jo, String index) { |
return (jo != null && |
jo.get(index) != null && |
264,4 → 283,20 |
return dateRemplacee; |
} |
public static boolean estZero(String s) { |
boolean estZero = false; |
try { |
Double dou = Double.parseDouble(s); |
estZero = (dou == 0); |
} catch(NumberFormatException e) { |
} |
return estZero; |
} |
public static String formaterNombre(String s) { |
s = s.indexOf(".") < 0 ? s : s.replaceAll("0*$", "").replaceAll("\\.$", ""); |
return s; |
} |
} |