Author: nbelaevski
Date: 2008-06-03 17:43:18 -0400 (Tue, 03 Jun 2008)
New Revision: 8894
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
Log:
http://jira.jboss.com/jira/browse/RF-3595
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-06-03
19:43:10 UTC (rev 8893)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-06-03
21:43:18 UTC (rev 8894)
@@ -1048,6 +1048,30 @@
}
}
+ /**
+ * Extracts segment of component client identifier containing row key
+ *
+ * @param context current faces context
+ * @param tailId substring of component client identifier with base client identifier
removed
+ * @return segment containing row key or <code>null</code>
+ */
+ protected String extractKeySegment(FacesContext context, String tailId) {
+ int indexOfSecondColon = tailId.indexOf(
+ NamingContainer.SEPARATOR_CHAR);
+
+ return (indexOfSecondColon > 0 ? tailId.substring(0, indexOfSecondColon) : null);
+ }
+
+ /**
+ * Returns iterator of components to search through
+ * in {@link #invokeOnComponent(FacesContext, String, ContextCallback)}.
+ *
+ * @return
+ */
+ protected Iterator<UIComponent> invocableChildren() {
+ return getFacetsAndChildren();
+ }
+
@Override
public boolean invokeOnComponent(FacesContext context, String clientId,
ContextCallback callback) throws FacesException {
@@ -1083,12 +1107,9 @@
if (clientId.startsWith(baseId)) {
Object newRowKey = null;
// Call for a child component - try to detect row key
- int indexOfSecondColon = clientId.indexOf(
- NamingContainer.SEPARATOR_CHAR, baseId.length());
- String rowKeyString = null;
- if (indexOfSecondColon > 0) {
- rowKeyString = clientId.substring(baseId.length(),
- indexOfSecondColon);
+ String rowKeyString = extractKeySegment(context,
+ clientId.substring(baseId.length()));
+ if (rowKeyString != null) {
Converter keyConverter = getRowKeyConverter();
if (null != keyConverter) {
try {
@@ -1103,7 +1124,7 @@
captureOrigValue(context);
setRowKey(newRowKey);
}
- Iterator<UIComponent> itr = this.getFacetsAndChildren();
+ Iterator<UIComponent> itr = invocableChildren();
while (itr.hasNext() && !found) {
found = itr.next().invokeOnComponent(context, clientId,
callback);