You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2005/11/22 22:53:36 UTC
svn commit: r348262 -
/myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java
Author: skitching
Date: Tue Nov 22 13:53:30 2005
New Revision: 348262
URL: http://svn.apache.org/viewcvs?rev=348262&view=rev
Log:
Added javadoc
Modified:
myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java
Modified: myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java?rev=348262&r1=348261&r2=348262&view=diff
==============================================================================
--- myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java (original)
+++ myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java Tue Nov 22 13:53:30 2005
@@ -24,6 +24,8 @@
import java.util.Iterator;
/**
+ * A collection of static helper methods for locating UIComponents.
+ *
* @author Manfred Geiler (latest modification by $Author$)
* @version $Revision$ $Date$
*/
@@ -70,6 +72,20 @@
}
}
+ /**
+ * Find the component with the specified id starting from the specified
+ * component.
+ * <p>
+ * Param id must not contain any NamingContainer.SEPARATOR_CHAR characters
+ * (ie ":"). This method explicitly does <i>not</i> search into any
+ * child naming container components; this is expected to be handled
+ * by the caller of this method.
+ * <p>
+ * For an implementation of findComponent which does descend into
+ * child naming components, see org.apache.myfaces.custom.util.ComponentUtils.
+ *
+ * @return findBase, a descendant of findBase, or null.
+ */
static UIComponent findComponent(UIComponent findBase, String id)
{
if (idsAreEqual(id,findBase))
@@ -80,7 +96,6 @@
for (Iterator it = findBase.getFacetsAndChildren(); it.hasNext(); )
{
UIComponent childOrFacet = (UIComponent)it.next();
- // TR - this was not finding all components, moved an alternative method that descends into NamingContainers into ComponentUtils in sandbox
if (!(childOrFacet instanceof NamingContainer))
{
UIComponent find = findComponent(childOrFacet, id);
@@ -95,6 +110,12 @@
return null;
}
+ /*
+ * Return true if the specified component matches the provided id.
+ * This needs some quirks to handle components whose id value gets
+ * dynamically "tweaked", eg a UIData component whose id gets
+ * the current row index appended to it.
+ */
private static boolean idsAreEqual(String id, UIComponent cmp)
{
if(id.equals(cmp.getId()))