[richfaces-svn-commits] JBoss Rich Faces SVN: r4440 - branches/3.1.x/framework/impl/src/main/java/org/richfaces/component/util.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Tue Dec 4 08:59:17 EST 2007
Author: maksimkaszynski
Date: 2007-12-04 08:59:16 -0500 (Tue, 04 Dec 2007)
New Revision: 4440
Modified:
branches/3.1.x/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
Log:
Component control - usage of jsf ids
Modified: branches/3.1.x/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2007-12-04 13:52:46 UTC (rev 4439)
+++ branches/3.1.x/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2007-12-04 13:59:16 UTC (rev 4440)
@@ -55,7 +55,7 @@
}
public static final Pattern idSelectorPattern = Pattern
- .compile("#((:|_|[a-z,A-Z])[a-z,A-Z,0-9,_,-,:]+)");
+ .compile("#((?:-[A-Za-z_-]|[A-Za-z_]|\\\\[^A-F0-9U]|\\\\[A-F0-9]{1,6}\\s?|\\\\U[0-9A-F]{2}(?:A[1-9A-F]|[B-F][0-9A-F]))(?:\\\\[A-F0-9]{1,6}\\s?|[A-Za-z0-9_-]|\\\\:)*)");
public static String expandIdSelector(String selector,
UIComponent component, FacesContext context) {
@@ -63,21 +63,38 @@
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
- if (matcher.group(1).indexOf("::") == -1) {
- // make new id selector here using matcher.group(1)
+ // make new id selector here using matcher.group(1)
+ String unescaped = matcher.group(1).replaceAll("\\\\:", ":");
+ UIComponent target = component.findComponent(unescaped);
- UIComponent target = component.findComponent(matcher.group(1));
-
- if (target != null) {
- matcher.appendReplacement(sb, "#"
- + target.getClientId(context).replaceAll(":", "\\\\\\\\\\\\\\\\:"));
- }
+ if (target != null) {
+ matcher.appendReplacement(sb, "#"
+ + target.getClientId(context).replaceAll(":",
+ "\\\\\\\\\\\\\\\\:"));
}
}
matcher.appendTail(sb);
- String result = sb.toString();
- if (result.length() == 0)
- result = selector;
return sb.toString();
}
+
+ public static String idsToIdSelector(String ids) {
+ StringBuffer buffer = new StringBuffer();
+ if (ids != null) {
+ String[] idString = ids.split("\\s*,\\s*");
+
+ for(int i = 0; i < idString.length; i++) {
+ if (i > 0) {
+ buffer.append(",");
+ }
+ idString[i] = idString[i].replaceAll(":", "\\\\:");
+ buffer
+ .append("#")
+ .append(idString[i]);
+ }
+ }
+ return buffer.toString();
+ }
+
+
+
}
More information about the richfaces-svn-commits
mailing list