|
From: <de...@us...> - 2012-11-02 18:23:33
|
Revision: 7852
http://fudaa.svn.sourceforge.net/fudaa/?rev=7852&view=rev
Author: deniger
Date: 2012-11-02 18:23:26 +0000 (Fri, 02 Nov 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibString.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibString.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibString.java 2012-11-02 18:23:03 UTC (rev 7851)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibString.java 2012-11-02 18:23:26 UTC (rev 7852)
@@ -26,7 +26,7 @@
/**
* Classe utilitaire permettant de manipuler des chaines de caracteres.
- *
+ *
* @author Fred Deniger
* @version $Id: CtuluLibString.java,v 1.30 2007-06-20 12:20:45 deniger Exp $
*/
@@ -38,24 +38,23 @@
public final static String VIR = ",";
public final static String DOT = ".";
public final static String CINQ = "5";
-
/**
* Chaine "2". Utile pour la conversion.
*/
public final static String DEUX = "2";
-
/**
* Chaine "10". Utile pour la conversion.
*/
public final static String DIX = "10";
-
/**
* Chaine vide.
*/
public final static String EMPTY_STRING = "";
public static boolean containsVirgule(final String _num) {
- if (isEmpty(_num)) { return false; }
+ if (isEmpty(_num)) {
+ return false;
+ }
final String s = _num.trim();
try {
Double.parseDouble(s);
@@ -74,11 +73,15 @@
* @return true si la chaine est vide ou null ou si elle ne contient que des espaces
*/
public static boolean isEmpty(final String _s) {
- if (_s == null || _s == EMPTY_STRING) { return true; }
+ if (_s == null || _s == EMPTY_STRING) {
+ return true;
+ }
final int nb = _s.length();
for (int i = nb - 1; i >= 0; i--) {
- if (!Character.isWhitespace(_s.charAt(i))) { return false; }
+ if (!Character.isWhitespace(_s.charAt(i))) {
+ return false;
+ }
}
return true;
@@ -99,68 +102,61 @@
* @return true si c'est un nombre
*/
public static boolean isNumeric(final String _s) {
- if (isEmpty(_s)) { return false; }
+ if (isEmpty(_s)) {
+ return false;
+ }
final String s = _s.trim();
try {
Double.parseDouble(s);
return true;
} catch (final NumberFormatException e) {
- if (s.indexOf(',') > 0) { return isNumeric(FuLib.replace(s, CtuluLibString.VIR, CtuluLibString.DOT)); }
+ if (s.indexOf(',') > 0) {
+ return isNumeric(FuLib.replace(s, CtuluLibString.VIR, CtuluLibString.DOT));
+ }
return false;
}
}
-
/**
* Tableau vide.
*/
public final static String[] EMPTY_STRING_ARRAY = new String[0];
-
/**
* Chaine " ".
*/
public final static String ESPACE = " ";
-
/**
* Chaine "8". Utile pour la conversion.
*/
public final static String HUIT = "8";
-
/**
* Chaine separatrice de ligne.
*/
public final static String LINE_SEP = System.getProperty("line.separator");
public final static String LINE_SEP_SIMPLE = "\n";
-
/**
* Chaine "9". Utile pour la conversion.
*/
public final static String NEUF = "9";
-
/**
* Chaine "4". Utile pour la conversion.
*/
public final static String QUATRE = "4";
-
/**
* Chaine "7". Utile pour la conversion.
*/
public final static String SEPT = "7";
-
/**
* Chaine "6". Utile pour la conversion.
*/
public final static String SIX = "6";
-
/**
* Chaine "3". Utile pour la conversion.
*/
public final static String TROIS = "3";
-
/**
* Chaine "1". Utile pour la conversion.
*/
public final static String UN = "1";
-
/**
* Chaine "0". Utile pour la conversion.
*/
@@ -175,9 +171,10 @@
}
/**
- * Ajuste la taille de _s a <code>_taille</code>. Si la taille de _s est plus grande, les derniers caracteres de s
- * seront enleves. Sinon, les espaces n\xE9cessaires seront ajoutes.
- *
+ * Ajuste la taille de _s a
+ * <code>_taille</code>. Si la taille de _s est plus grande, les derniers caracteres de s seront enleves. Sinon, les espaces n\xE9cessaires seront
+ * ajoutes.
+ *
* @param _taille la taille
* @param _s la chaine a ajuster
* @return la chaine ajustee.
@@ -187,9 +184,10 @@
}
/**
- * Ajuste la taille de _s a <code>_taille</code>. Si la taille de _s est plus grande, les derniers caracteres de s
- * seront enleves. Sinon, les espaces n\xE9cessaires seront ajoutes.
- *
+ * Ajuste la taille de _s a
+ * <code>_taille</code>. Si la taille de _s est plus grande, les derniers caracteres de s seront enleves. Sinon, les espaces n\xE9cessaires seront
+ * ajoutes.
+ *
* @param _taille la taille
* @param _s la chaine a ajuster
* @param _addSpaceBefore true si les espace doivent etre ajoute avant
@@ -198,7 +196,9 @@
public static String adjustSize(final int _taille, final String _s, boolean _addSpaceBefore) {
final String s = _s == null ? EMPTY_STRING : _s;
final int l = s.length();
- if (l > _taille) { return s.substring(0, _taille); }
+ if (l > _taille) {
+ return s.substring(0, _taille);
+ }
final StringBuffer r = new StringBuffer(_taille);
if (!_addSpaceBefore) {
r.append(s);
@@ -211,22 +211,22 @@
r.append(b);
}
switch (sup) {
- case 0:
- break;
- case 1:
- r.append(ESPACE);
- break;
- case 2:
- r.append(" ");
- break;
- case 3:
- r.append(" ");
- break;
- case 4:
- r.append(" ");
- break;
- default:
- break;
+ case 0:
+ break;
+ case 1:
+ r.append(ESPACE);
+ break;
+ case 2:
+ r.append(" ");
+ break;
+ case 3:
+ r.append(" ");
+ break;
+ case 4:
+ r.append(" ");
+ break;
+ default:
+ break;
}
if (_addSpaceBefore) {
r.append(s);
@@ -248,7 +248,9 @@
public static String adjustSize(final int _taille, final String _s, boolean _addSpaceBefore, final char _charToUse) {
final String s = _s == null ? EMPTY_STRING : _s;
final int l = s.length();
- if (l > _taille) { return s.substring(0, _taille); }
+ if (l > _taille) {
+ return s.substring(0, _taille);
+ }
final StringBuffer r = new StringBuffer(_taille);
if (!_addSpaceBefore) {
r.append(s);
@@ -262,22 +264,22 @@
r.append(b);
}
switch (sup) {
- case 0:
- break;
- case 1:
- r.append(_charToUse);
- break;
- case 2:
- r.append(_charToUse).append(_charToUse);
- break;
- case 3:
- r.append(_charToUse).append(_charToUse).append(_charToUse);
- break;
- case 4:
- r.append(_charToUse).append(_charToUse).append(_charToUse).append(_charToUse);
- break;
- default:
- break;
+ case 0:
+ break;
+ case 1:
+ r.append(_charToUse);
+ break;
+ case 2:
+ r.append(_charToUse).append(_charToUse);
+ break;
+ case 3:
+ r.append(_charToUse).append(_charToUse).append(_charToUse);
+ break;
+ case 4:
+ r.append(_charToUse).append(_charToUse).append(_charToUse).append(_charToUse);
+ break;
+ default:
+ break;
}
if (_addSpaceBefore) {
r.append(s);
@@ -312,9 +314,21 @@
return arrayToString(_o, ", ");
}
+ public static String arrayToString(final float[] _o) {
+ return arrayToString(_o, ", ");
+ }
+
+ public static String arrayToString(final int[] _o) {
+ return arrayToString(_o, ", ");
+ }
+
public static String arrayToString(final double[] _o, final String _sep) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
r.append(_o[0]);
for (int i = 1; i < _o.length; i++) {
@@ -322,66 +336,82 @@
}
return r.toString();
}
-
- public static String arrayToString(final boolean[] _o, final String _sep) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
- final StringBuffer r = new StringBuffer();
- r.append(_o[0]);
- for (int i = 1; i < _o.length; i++) {
- r.append(_sep).append(_o[i]);
- }
- return r.toString();
- }
- /**
- * @param _o le tableau d'entier a voir
- * @return une chaine contenant tous les entiers separees par des virgules
- */
- public static String arrayToString(final long[] _o) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
+
+ public static String arrayToString(final int[] _o, final String _sep) {
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
r.append(_o[0]);
for (int i = 1; i < _o.length; i++) {
- appendInArray(r, Long.toString(_o[i]));
+ r.append(_sep).append(_o[i]);
}
return r.toString();
}
- public static String arrayToString(final float[] _o) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
+ public static String arrayToString(final float[] _o, final String _sep) {
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
r.append(_o[0]);
for (int i = 1; i < _o.length; i++) {
- appendInArray(r, Float.toString(_o[i]));
+ r.append(_sep).append(_o[i]);
}
return r.toString();
}
+ public static String arrayToString(final boolean[] _o, final String _sep) {
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
+ final StringBuffer r = new StringBuffer();
+ r.append(_o[0]);
+ for (int i = 1; i < _o.length; i++) {
+ r.append(_sep).append(_o[i]);
+ }
+ return r.toString();
+ }
+
/**
- * @param _array le tableau d'entier a voir
+ * @param _o le tableau d'entier a voir
* @return une chaine contenant tous les entiers separees par des virgules
*/
- public static String arrayToString(final int[] _array) {
- if (_array == null) { return getNullString(); }
- if (_array.length == 0) { return getEmptyTableau(); }
+ public static String arrayToString(final long[] _o) {
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
- r.append(_array[0]);
- for (int i = 1; i < _array.length; i++) {
- appendInArray(r, Integer.toString(_array[i]));
+ r.append(_o[0]);
+ for (int i = 1; i < _o.length; i++) {
+ appendInArray(r, Long.toString(_o[i]));
}
return r.toString();
}
/**
* @param _o le tableau a transformer en chaine
- * @return une chaine contenant tous les elements du tableau transformes en chaine ( toString) separes par des
- * virgules.
+ * @return une chaine contenant tous les elements du tableau transformes en chaine ( toString) separes par des virgules.
*/
public static String arrayToString(final Object[] _o) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
r.append(_o[0].toString());
for (int i = 1; i < _o.length; i++) {
@@ -391,7 +421,9 @@
}
public static String arrayToHtmlString(final Object[] _o) {
- if ((_o == null) || (_o.length == 1)) { return EMPTY_STRING; }
+ if ((_o == null) || (_o.length == 1)) {
+ return EMPTY_STRING;
+ }
final StringBuffer r = new StringBuffer("<html><body>");
r.append(_o[0].toString());
for (int i = 1; i < _o.length; i++) {
@@ -402,7 +434,7 @@
/**
* Transforme un tableau de chaine en une unique chaine avec des saut de lignes.
- *
+ *
* @param _tab le tableau a transformer
* @return la chaine
*/
@@ -412,22 +444,25 @@
/**
* Transforme un tableau de chaine en une unique chaine avec des saut de lignes.
- *
+ *
* @param _tab le tableau a transformer
* @return la chaine
*/
public static String arrayToString(final String[] _tab, final String _sep) {
- return arrayToString(_tab,0,_sep);
+ return arrayToString(_tab, 0, _sep);
}
+
/**
* @param _tab
* @param offset le premier indice a utiliser dans le tableau
* @param _sep
* @return
*/
- public static String arrayToString(final String[] _tab, int offset,final String _sep) {
- if (_tab == null) { return CtuluLibString.EMPTY_STRING; }
+ public static String arrayToString(final String[] _tab, int offset, final String _sep) {
+ if (_tab == null) {
+ return CtuluLibString.EMPTY_STRING;
+ }
final int n = _tab.length;
if (n > 0) {
final StringBuffer obj = new StringBuffer();
@@ -440,7 +475,7 @@
return obj.toString();
}
return null;
-
+
}
/**
@@ -448,7 +483,9 @@
* @return la chaine avec la premier lettre en majuscule.
*/
public static String capitalyze(final String _s) {
- if (isEmpty(_s)) { return _s; }
+ if (isEmpty(_s)) {
+ return _s;
+ }
final String prem = _s.substring(0, 1);
return prem.toUpperCase() + _s.substring(1);
}
@@ -458,16 +495,18 @@
* @return le tableau de string correspondant. Renvoie null si la taille est null ou si _v null.
*/
public static String[] enTableau(final Collection _v) {
- if ((_v == null) || (_v.size() == 0)) { return null; }
+ if ((_v == null) || (_v.size() == 0)) {
+ return null;
+ }
final String[] r = new String[_v.size()];
_v.toArray(r);
return r;
}
/**
- * Recherche parmi parmi le tableau ( en commencant par la fin) <code>_prefixe</code> la chaine. ayant le prefixe
- * demande
- *
+ * Recherche parmi parmi le tableau ( en commencant par la fin)
+ * <code>_prefixe</code> la chaine. ayant le prefixe demande
+ *
* @param _tabToTest le tableau a parcourir
* @param _prefixe le prefixe a chercher
* @return la chaine du tableau ayant le prefixe demande. null si aucune.
@@ -475,14 +514,16 @@
public static String findPrefixInTab(final String[] _tabToTest, final String _prefixe) {
for (int i = _tabToTest.length - 1; i >= 0; i--) {
final String s = _tabToTest[i];
- if (_prefixe.startsWith(s)) { return s; }
+ if (_prefixe.startsWith(s)) {
+ return s;
+ }
}
return null;
}
/**
* Recherche dans le tableau la chaine finissant par _end. Commence la recherche a la fin du tableau.
- *
+ *
* @param _tab le tableau a parcourir
* @param _end le suffixe cherche
* @return la chaine du tableau finissant par _end. null si aucune
@@ -491,15 +532,18 @@
if (_tab != null) {
for (int i = _tab.length - 1; i >= 0; i--) {
final String s = _tab[i];
- if (s.endsWith(_end)) { return s; }
+ if (s.endsWith(_end)) {
+ return s;
+ }
}
}
return null;
}
/**
- * Recherche dans le tableau (a partir de la fin) une chaine contenue dans la ligne a tester ( <code>_sToTest</code>).
- *
+ * Recherche dans le tableau (a partir de la fin) une chaine contenue dans la ligne a tester (
+ * <code>_sToTest</code>).
+ *
* @param _stringToLookFor le tableau a parcourir
* @param _sToTest la chaine qui doit contenir un des elements du tableau
* @return La chaine du tableau contenue dans _sToTest
@@ -507,7 +551,9 @@
public static String findStringIn(final String[] _stringToLookFor, final String _sToTest) {
for (int i = _stringToLookFor.length - 1; i >= 0; i--) {
final String s = _stringToLookFor[i];
- if (_sToTest.indexOf(s) >= 0) { return s; }
+ if (_sToTest.indexOf(s) >= 0) {
+ return s;
+ }
}
return null;
}
@@ -520,16 +566,17 @@
public static String findStringStartsWith(final String[] _tab, final String _start) {
for (int i = _tab.length - 1; i >= 0; i--) {
final String s = _tab[i];
- if (s.startsWith(_start)) { return s; }
+ if (s.startsWith(_start)) {
+ return s;
+ }
}
return null;
}
/**
- * Le format renvoy\xE9 permet d'ecrire des entiers sur le meme nombre de caract\xE8re. Par exemple <br>
- * NumberFormat fm=getFormgetFormatForIndexingInteger(5); <br>
- * String cinq= fm.format(5); //cinq =00005 String quinze=fm.format(15); //quinze=00015
- *
+ * Le format renvoy\xE9 permet d'ecrire des entiers sur le meme nombre de caract\xE8re. Par exemple <br> NumberFormat
+ * fm=getFormgetFormatForIndexingInteger(5); <br> String cinq= fm.format(5); //cinq =00005 String quinze=fm.format(15); //quinze=00015
+ *
* @param _nb le nombre d'entier a consid\xE9rer
* @return un format permettant d'ecrire les entiers de 0 a _nb sur le meme nombre de caract\xE8res
*/
@@ -548,15 +595,17 @@
}
/**
- * Renvoie sous forme de String l'objet _o. Pour une matrice, renvoie "[taille]" si non verbose. Si _verbose, renvoie
- * la description de tous les objets de la matrice (peut etre ennuyeux si les matrices sont tres grandes.
- *
+ * Renvoie sous forme de String l'objet _o. Pour une matrice, renvoie "[taille]" si non verbose. Si _verbose, renvoie la description de tous les
+ * objets de la matrice (peut etre ennuyeux si les matrices sont tres grandes.
+ *
* @param _o l'objet a decrire
* @param _verbose si true decrit tous les objets de la matrice.
* @return descriprion
*/
public static String getObjectInString(final Object _o, final boolean _verbose) {
- if (_o == null) { return "null"; }
+ if (_o == null) {
+ return "null";
+ }
final StringBuffer b = new StringBuffer();
if (_o.getClass().isArray()) {
final int n = Array.getLength(_o);
@@ -580,37 +629,37 @@
/**
* Utilise une constante si _i <11. Sinon utilise la methode Integer.
- *
+ *
* @param _i l'entier a transformer en chaine
* @return la chaine correpondante
*/
public static String getString(final int _i) {
if (_i < 11) {
switch (_i) {
- case 0:
- return ZERO;
- case 1:
- return UN;
- case 2:
- return DEUX;
- case 3:
- return TROIS;
- case 4:
- return QUATRE;
- case 5:
- return CINQ;
- case 6:
- return SIX;
- case 7:
- return SEPT;
- case 8:
- return HUIT;
- case 9:
- return NEUF;
- case 10:
- return DIX;
- default:
- return Integer.toString(_i);
+ case 0:
+ return ZERO;
+ case 1:
+ return UN;
+ case 2:
+ return DEUX;
+ case 3:
+ return TROIS;
+ case 4:
+ return QUATRE;
+ case 5:
+ return CINQ;
+ case 6:
+ return SIX;
+ case 7:
+ return SEPT;
+ case 8:
+ return HUIT;
+ case 9:
+ return NEUF;
+ case 10:
+ return DIX;
+ default:
+ return Integer.toString(_i);
}
}
return Integer.toString(_i);
@@ -622,14 +671,16 @@
/**
* Methode permettant de parser les arguments passes a une methode main. Stocke les valeurs pour chaque
- * <code>_ids</code> dans la table de correspondance passee en argument. Les arguments du type -f=monFichier seront
- * ajoutee sous la forme cle=-f et valeur=monFichier. Les arguments de type -l donneront cle=-l et valeur=null.
- *
+ * <code>_ids</code> dans la table de correspondance passee en argument. Les arguments du type -f=monFichier seront ajoutee sous la forme cle=-f et
+ * valeur=monFichier. Les arguments de type -l donneront cle=-l et valeur=null.
+ *
* @param _args les argument a parser
* @return table cle,valeur ( voir doc)
*/
public static synchronized Map parseArgs(final String[] _args) {
- if (_args == null) { return null; }
+ if (_args == null) {
+ return null;
+ }
final int l = _args.length;
final Map r = new HashMap(l);
int index;
@@ -647,20 +698,23 @@
}
/**
- * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie
- * [1,3,4];
- *
+ * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie [1,3,4];
+ *
* @param _s la chaine a traiter
* @param _sepChar le separateur
* @return le tableau des champs ou null si un des 2 parametres est nul.
*/
public static String[] parseString(final String _s, final String _sepChar) {
- if ((_s == null) || (_sepChar == null)) { return null; }
+ if ((_s == null) || (_sepChar == null)) {
+ return null;
+ }
return enTableau(parseStringList(_s, _sepChar));
}
public static double[] parseStringDouble(final String _s, final String _sepChar) {
- if ((_s == null) || (_sepChar == null)) { return null; }
+ if ((_s == null) || (_sepChar == null)) {
+ return null;
+ }
final List l = (parseStringList(_s, _sepChar));
final TDoubleArrayList res = new TDoubleArrayList();
for (int i = 0; i < l.size(); i++) {
@@ -674,37 +728,40 @@
return res.toNativeArray();
}
-
public static boolean[] parseStringBoolean(final String _s, final String _sepChar) {
- if ((_s == null) || (_sepChar == null)) { return null; }
- final List l = (parseStringList(_s, _sepChar));
- final List<Boolean> res = new ArrayList<Boolean>();
- for (int i = 0; i < l.size(); i++) {
- try {
- res.add(Boolean.parseBoolean((String) l.get(i)));
- } catch (final NumberFormatException _evt) {
- FuLog.error(_evt);
+ if ((_s == null) || (_sepChar == null)) {
+ return null;
+ }
+ final List l = (parseStringList(_s, _sepChar));
+ final List<Boolean> res = new ArrayList<Boolean>();
+ for (int i = 0; i < l.size(); i++) {
+ try {
+ res.add(Boolean.parseBoolean((String) l.get(i)));
+ } catch (final NumberFormatException _evt) {
+ FuLog.error(_evt);
- }
- }
- boolean[] tab=new boolean[res.size()];
- int cpt=0;
- for(Boolean bool:res)
- tab[cpt++]=bool.booleanValue();
-
- return tab;
- }
+ }
+ }
+ boolean[] tab = new boolean[res.size()];
+ int cpt = 0;
+ for (Boolean bool : res) {
+ tab[cpt++] = bool.booleanValue();
+ }
+ return tab;
+ }
+
/**
- * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie
- * [1,3,4];
- *
+ * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie [1,3,4];
+ *
* @param _s la chaine a traiter
* @param _sepChar le separateur
* @return le tableau des champs ou null si un des 2 parametres est nul.
*/
public static List parseStringList(final String _s, final String _sepChar) {
- if ((_s == null) || (_sepChar == null)) { return null; }
+ if ((_s == null) || (_sepChar == null)) {
+ return null;
+ }
final StringTokenizer tk = new StringTokenizer(_s, _sepChar);
final List l = new ArrayList();
while (tk.hasMoreTokens()) {
@@ -714,20 +771,26 @@
}
public static String trimRight(String _s) {
- if (_s == null || _s.length() == 0) return _s;
+ if (_s == null || _s.length() == 0) {
+ return _s;
+ }
int idxToTrim = _s.length() - 1;
while (idxToTrim >= 0 && Character.isWhitespace(_s.charAt(idxToTrim))) {
idxToTrim--;
}
- if (idxToTrim < 0) return EMPTY_STRING;
- if (idxToTrim == _s.length() - 1) return _s;
+ if (idxToTrim < 0) {
+ return EMPTY_STRING;
+ }
+ if (idxToTrim == _s.length() - 1) {
+ return _s;
+ }
return _s.substring(0, idxToTrim + 1);
}
/**
* A partir d'un nom de fichier ou d'une url locale incorrecte, construit une url locale valide.
- *
+ *
* @return url valide pour _file
* @param _file le chemin du fichier a transformer
*/
@@ -745,5 +808,4 @@
private CtuluLibString() {
super();
}
-
}
\ No newline at end of file
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2012-11-02 18:23:03 UTC (rev 7851)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2012-11-02 18:23:26 UTC (rev 7852)
@@ -57,9 +57,9 @@
import com.vividsolutions.jts.geom.Geometry;
/**
- * Un panneau d'\xE9dition d'un objet GIS unique contenu dans un calque editable
- * {@link ZCalqueEditable}. Ce panneau permet l'edition des coordonn\xE9es de l'objet ainsi que de ses attributs. Ce panneau est
- * associ\xE9 \xE0 un mod\xE8le \xE9ditable de calque. Un gestionnaire de commandes peut \xEAtre ajout\xE9 au panneau.
+ * Un panneau d'\xE9dition d'un objet GIS unique contenu dans un calque editable {@link ZCalqueEditable}. Ce panneau permet l'edition des coordonn\xE9es de
+ * l'objet ainsi que de ses attributs. Ce panneau est associ\xE9 \xE0 un mod\xE8le \xE9ditable de calque. Un gestionnaire de commandes peut \xEAtre ajout\xE9 au
+ * panneau.
*
* @author Fred Deniger
* @version $Id: EbliSingleObjectEditorPanel.java,v 1.10.6.2 2008-04-01 07:28:15 bmarchan Exp $
@@ -71,8 +71,7 @@
}
/**
- * Cette classe repr\xE9sente les informations sous forme d'un tableau de donn\xE9es. Les donn\xE9es affich\xE9es dans ce tableau peuvent
- * \xEAtre \xE9dit\xE9es.
+ * Cette classe repr\xE9sente les informations sous forme d'un tableau de donn\xE9es. Les donn\xE9es affich\xE9es dans ce tableau peuvent \xEAtre \xE9dit\xE9es.
*
* @author MARTIN Emmanuel
* @version $Id: EbliSingleObjectEditorPanel.java,v 1.10.6.2 2008-04-01 07:28:15 emartin Exp $
@@ -101,13 +100,12 @@
protected BuCheckBox modeChangement_;
/**
- * @param _editAttribut indique si les attributs globaux sont \xE9ditable (dans le cas o\xF9 ils ne le sont pas, ils ne sont pas
- * affich\xE9s)
+ * @param _editAttribut indique si les attributs globaux sont \xE9ditable (dans le cas o\xF9 ils ne le sont pas, ils ne sont pas affich\xE9s)
* @param _editVertexAttribut indique si les attributs des points sont \xE9ditable (ils seront dans tout les cas affich\xE9s)
* @param _xyFormatter formateur g\xE9rant le format des informations \xE0 afficher
*/
public TableRepresentation(final boolean _editAttributGlobaux, final boolean _editVertexAttribut,
- final EbliCoordinateDefinition[] _defs) {
+ final EbliCoordinateDefinition[] _defs) {
coordDefs_ = _defs;
// Zone centrale contenant soit le tableau de coordonn\xE9es en cas de points
// multiple, soit les informations d'un point unique.
@@ -151,7 +149,6 @@
// Gestion des erreurs
setErrorText(modelData_.getErrorMessage());
modelData_.addTableModelModeleAdapterErrorListener(new EbliSingleObjectTableModelErrorListener() {
-
public void modeleAdapterError(String _message) {
setErrorText(_message);
}
@@ -177,7 +174,6 @@
btDown_.setEnabled(false);
btUp_.addActionListener(new ActionListener() {
-
public void actionPerformed(ActionEvent e) {
setErrorText("");
int[] newSelection = modelData_.movePoints(table_.getSelectedRows(), -1);
@@ -189,7 +185,6 @@
}
});
btDown_.addActionListener(new ActionListener() {
-
public void actionPerformed(ActionEvent e) {
setErrorText("");
int[] newSelection = modelData_.movePoints(table_.getSelectedRows(), 1);
@@ -216,7 +211,6 @@
btDel_.setEnabled(false);
btAdd_.addActionListener(new ActionListener() {
-
public void actionPerformed(ActionEvent e) {
setErrorText("");
int idxSel = modelData_.addPoint(table_.getSelectedRow());
@@ -224,7 +218,6 @@
}
});
btDel_.addActionListener(new ActionListener() {
-
public void actionPerformed(ActionEvent e) {
setErrorText("");
modelData_.removePoints(table_.getSelectedRows());
@@ -234,7 +227,6 @@
pnAdd.add(btDel_);
table_.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
-
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
@@ -257,7 +249,6 @@
EbliLib.getS(
"<html>En mode diff\xE9r\xE9 : les modifications ne sont appliqu\xE9es qu'\xE0 la fin.<br>En mode imm\xE9diat : les modifications sont appliqu\xE9es imm\xE9diatement.</html>"));
modeChangement_.addChangeListener(new ChangeListener() {
-
public void stateChanged(ChangeEvent e) {
if (modeChangement_.isSelected()) {
modelData_.setDeferredModifications(true);
@@ -375,7 +366,7 @@
* @param _xyFormatter
*/
public EbliSingleObjectEditorPanel(final ZModeleEditable _model, final int _idx, final boolean _editAttribut,
- final boolean _editVertexAttribut, final EbliCoordinateDefinition[] _defs) {
+ final boolean _editVertexAttribut, final EbliCoordinateDefinition[] _defs) {
idx_ = _idx;
zone_ = _model.getGeomData();
modeleSrc_ = _model;
@@ -433,6 +424,7 @@
/**
* Ajoute un nouveau panneau en plus du panneau tableau. Des onglets sont apparents dans ce cas.
+ *
* @param _title Le titre
* @param _pn Le panneau.
*/
@@ -449,6 +441,7 @@
/**
* Selectionne l'onglet num\xE9ro 'index'.
+ *
* @param index : index de l'onglet \xE0 selecionner.
*/
public void setSelectedTab(int index) {
@@ -480,10 +473,12 @@
@Override
public void apply() {
//la g\xE9ometrie peut ne pas \xEAtre modifiable par contre les attributs si...
- if(!isGeomModifiable()){
- return;
+// if(!isGeomModifiable()){
+// return;
+// }
+ if (isGeomModifiable()) {
+ modeleSrc_.modificationWillBeDone();
}
- modeleSrc_.modificationWillBeDone();
CtuluCommandComposite cmd = new CtuluCommandComposite("Modifications de la g\xE9om\xE9trie");
if (tableRep_ != null) {
tableRep_.apply(cmd);
@@ -515,8 +510,7 @@
}
/**
- * Appel\xE9 lors du click sur le bouton 'valider' pour sortir de la fen\xEAtre. Retourne vrai si toutes les modifications sont
- * valides.
+ * Appel\xE9 lors du click sur le bouton 'valider' pour sortir de la fen\xEAtre. Retourne vrai si toutes les modifications sont valides.
*/
@Override
public boolean isDataValid() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|