You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2010/10/08 01:48:33 UTC

svn commit: r1005666 - in /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad: change/BaseChangeManager.java util/ComponentUtils.java

Author: gcrawford
Date: Thu Oct  7 23:48:33 2010
New Revision: 1005666

URL: http://svn.apache.org/viewvc?rev=1005666&view=rev
Log:
TRINIDAD-1935 ChangeManager shouldn't persist changes for stamped components

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java?rev=1005666&r1=1005665&r2=1005666&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java Thu Oct  7 23:48:33 2010
@@ -21,6 +21,7 @@ package org.apache.myfaces.trinidad.chan
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
+import org.apache.myfaces.trinidad.component.UIXIterator;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
 import org.apache.myfaces.trinidad.util.ComponentUtils;
@@ -48,10 +49,18 @@ abstract class BaseChangeManager extends
     UIComponent uiComponent,
     ComponentChange change)
   {
-    if (ComponentUtils.isStampedComponent(facesContext, uiComponent)) 
+    // if our component is a stamped component by UIXIterator, we 
+    // don't want to persist the changes 
+    UIComponent parent = uiComponent.getParent();
+    UIComponent root = facesContext.getViewRoot();
+    while (parent != root) 
     {
-      _LOG.info("DONT_PERSIST_STAMPED_COMPONENT_INSIDE_ITERATOR");      
-      return;
+      if (parent instanceof UIXIterator) 
+      {
+        _LOG.info("DONT_PERSIST_STAMPED_COMPONENT_INSIDE_ITERATOR");      
+        return;
+      }
+      parent = parent.getParent();      
     }
         
     if (facesContext == null || uiComponent == null || change == null)

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java?rev=1005666&r1=1005665&r2=1005666&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java Thu Oct  7 23:48:33 2010
@@ -27,9 +27,6 @@ import javax.faces.component.UIComponent
 
 import javax.faces.component.UIViewRoot;
 
-import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.trinidad.component.UIXIterator;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
 /**
@@ -452,29 +449,6 @@ public final class ComponentUtils
   }
   
   /**
-   * Checks if the component is a stamped component inside a UIXIterator. 
-   * 
-   * @param context FacesContext
-   * @param component 
-   * @return True if the component is inside a UIXIterator
-   */
-  public static boolean isStampedComponent(FacesContext context, UIComponent component) 
-  {
-    UIComponent parent = component.getParent();
-    UIComponent root = context.getViewRoot();
-    while (parent != root) 
-    {
-      if (parent instanceof UIXIterator) 
-      {
-        return true;
-      }
-      parent = parent.getParent();      
-    }
-
-    return false;
-  }
-
-  /**
    * Builds the scoped id. Adds the naming container's id and the separator char
    * in a recursive fashion.
    * @param targetComponent The component for which the scoped id needs to be