Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2557 → Rev 2558

/trunk/src/org/tela_botanica/client/util/Util.java
1,5 → 1,7
package org.tela_botanica.client.util;
 
import java.text.NumberFormat;
import java.text.ParsePosition;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
126,54 → 128,49
return lieuModele;
}
public static String obtenirDepartementAPartirChaineCommune(String departement, String commune) {
public static String obtenirIdLocAPartirChaineCommune(String commune) {
String dep = "";
if(departement == null) {
departement = "";
}
if(departement.equals("000null") || departement.equals("")) {
String[] depCom = commune.split(" ");
if(depCom.length > 1) {
dep = depCom[1].replace('(', ' ');
} else {
dep = "";
}
String idLoc = "";
String[] depCom = commune.split(" ");
if(depCom.length > 1) {
idLoc = depCom[1].replace('(', ' ');
} else {
dep = departement;
idLoc = "";
}
dep = dep.replace(')', ' ');
dep = dep.trim();
dep = dep.replace('\\',' ');
dep = dep.trim();
idLoc = idLoc.replace(')', ' ');
idLoc = idLoc.trim();
idLoc = idLoc.replace('\\',' ');
idLoc = idLoc.trim();
return idLoc;
}
public static String formaterDepartement(String depAFormater) {
String dep = "";
try
{
int nDep = Integer.parseInt(dep);
int nDep = Integer.parseInt(depAFormater);
if(nDep > 0 && nDep < 110) {
departement = dep ;
dep = depAFormater ;
}
if(departement.length() == 4) {
departement = "0"+departement;
if(depAFormater.length() == 4) {
dep = "0"+depAFormater;
}
departement = departement.substring(0,2);
dep = depAFormater.substring(0,2);
}
catch(NumberFormatException e)
{
departement = "" ;
// rien à faire
}
return departement;
return dep;
}
public static String supprimerNumDepartementChaineLocalite(String chaineLocaliteComplete) {
return chaineLocaliteComplete.replaceAll(" \\([0-9]*\\)", "");
public static String supprimerChaineIdLocalite(String chaineLocaliteComplete) {
return chaineLocaliteComplete.replaceAll(" \\([a-zA-Z0-9]*\\)", "");
}
public static String convertirChaineZoneGeoVersDepartement(String chaineZoneGeo) {
303,6 → 300,16
return estZero;
}
public static boolean estUnNombre(String s) {
//http://stackoverflow.com/questions/1102891/how-to-check-if-a-string-is-a-numeric-type-in-java
try {
double d = Double.parseDouble(s);
} catch(NumberFormatException nfe) {
return false;
}
return true;
}
public static String formaterNombre(String s) {
s = s.indexOf(".") < 0 ? s : s.replaceAll("0*$", "").replaceAll("\\.$", "");
return s;
431,5 → 438,4
public static void curseurParDefaut() {
RootPanel.getBodyElement().getStyle().setProperty("cursor", "default");
}
 
}