You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sl...@apache.org on 2008/12/11 01:47:50 UTC
svn commit: r725505 -
/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIComponent.java
Author: slessard
Date: Wed Dec 10 16:47:49 2008
New Revision: 725505
URL: http://svn.apache.org/viewvc?rev=725505&view=rev
Log:
MYFACES-2125 - Add UIComponent.doTreeTraversal method
Modified:
myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIComponent.java
Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIComponent.java?rev=725505&r1=725504&r2=725505&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIComponent.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIComponent.java Wed Dec 10 16:47:49 2008
@@ -377,6 +377,19 @@
public abstract void broadcast(FacesEvent event) throws AbortProcessingException;
public abstract void decode(FacesContext context);
+
+ public void doTreeTraversal(FacesContext context, ContextCallback nodeCallback)
+ {
+ try
+ {
+ _doTreeTraversalInternal(context, nodeCallback);
+ }
+ catch (AbortProcessingException e)
+ {
+ // The traversal may be aborted by throwing an AbortProcessingException from this method.
+ // This isn't an abnormal situation so do nothing about it
+ }
+ }
public abstract void encodeBegin(FacesContext context) throws IOException;
@@ -537,6 +550,19 @@
return getClientId(ctx);
}
+ private void _doTreeTraversalInternal(FacesContext context, ContextCallback nodeCallback)
+ {
+ // The default implementation must call the callback on this instance before traversing the children
+ nodeCallback.invokeContextCallback(context, this);
+ if (getChildCount() > 0)
+ {
+ for (UIComponent child : getChildren())
+ {
+ child._doTreeTraversalInternal(context, nodeCallback);
+ }
+ }
+ }
+
private boolean _isCompositeComponent()
{
return getAttributes().get(Resource.COMPONENT_RESOURCE_KEY) != null;