Subversion Repositories eFlore/Applications.cel

Rev

Rev 2221 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2221 Rev 2232
Line 165... Line 165...
165
 
165
 
166
	public static boolean estUnePositionAutorisee(TreeNode node, Node parent, String text) {
166
	public static boolean estUnePositionAutorisee(TreeNode node, Node parent, String text) {
167
		if(parent == null) {
167
		if(parent == null) {
168
			parent = node.getParentNode();
168
			parent = node.getParentNode();
-
 
169
		}
169
		}
170
		text = normaliserChaine(text);
170
		Node[] noeudsFreres = parent.getChildNodes(); 
171
		Node[] noeudsFreres = parent.getChildNodes(); 
171
		boolean ok = true;
172
		boolean ok = true;
172
		for(int i = 0; i <= noeudsFreres.length; i++) {
173
		for(int i = 0; i <= noeudsFreres.length; i++) {
173
			if(noeudsFreres[i] != null) {
174
			if(noeudsFreres[i] != null) {
174
				String cheminFrere = noeudsFreres[i].getPath();
175
				String cheminFrere = normaliserChaine(noeudsFreres[i].getPath());
175
				String cheminNoeud = node.getPath();
176
				String cheminNoeud = normaliserChaine(node.getPath());
176
				String texteNoeudfrere = ((String[])noeudsFreres[i].getUserObject())[0];
177
				String texteNoeudfrere = normaliserChaine(((String[])noeudsFreres[i].getUserObject())[0]);
177
				if(!cheminFrere.equals(cheminNoeud) && text.trim().equals(texteNoeudfrere.trim())) {
178
				if(!cheminFrere.equals(cheminNoeud) && text.equals(texteNoeudfrere)) {
178
					ok = false;
179
					ok = false;
179
				}
180
				}
180
			}
181
			}
181
		}
182
		}
182
		return ok;
183
		return ok;
-
 
184
	}
-
 
185
	
-
 
186
	public static String normaliserChaine(String chaine) {
-
 
187
		return supprimerAccents(chaine).toLowerCase().trim();
-
 
188
	}
-
 
189
	
-
 
190
	public static String supprimerAccents(String chaine) {
-
 
191
	    String s = chaine;
-
 
192
 
-
 
193
	    s = s.replaceAll("[èéêë]","e");
-
 
194
	    s = s.replaceAll("[ûùü]","u");
-
 
195
	    s = s.replaceAll("[ïî]","i");
-
 
196
	    s = s.replaceAll("[àâ]","a");
-
 
197
	    s = s.replaceAll("ô","o");
-
 
198
 
-
 
199
	    s = s.replaceAll("[ÈÉÊË]","E");
-
 
200
	    s = s.replaceAll("[ÛÙÜ]","U");
-
 
201
	    s = s.replaceAll("[ÏÎ]","I");
-
 
202
	    s = s.replaceAll("[ÀÂ]","A");
-
 
203
	    s = s.replaceAll("Ô","O");
-
 
204
 
-
 
205
	    return s;
183
	}
206
	}