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/11 23:17:39 UTC

svn commit: r1021510 - in /myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main: java/org/apache/myfaces/trinidad/change/ xrts/org/apache/myfaces/trinidad/resource/

Author: gcrawford
Date: Mon Oct 11 21:17:35 2010
New Revision: 1021510

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

Modified:
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/ChangeManager.java
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java?rev=1021510&r1=1021509&r2=1021510&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/BaseChangeManager.java Mon Oct 11 21:17:35 2010
@@ -21,8 +21,11 @@ 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;
+
 import org.w3c.dom.Document;
 
 
@@ -46,10 +49,20 @@ abstract class BaseChangeManager extends
     UIComponent uiComponent,
     ComponentChange change)
   {
-    if (facesContext == null || uiComponent == null || change == null)
-      throw new IllegalArgumentException(_LOG.getMessage(
-        "CANNOT_ADD_CHANGE_WITH_FACECONTEXT_OR_UICOMPONENT_OR_NULL"));
-
+    // 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) 
+    {
+      if (parent instanceof UIXIterator) 
+      {
+        _LOG.info("DONT_PERSIST_STAMPED_COMPONENT_INSIDE_ITERATOR");      
+        return;
+      }
+      parent = parent.getParent();      
+    }
+    
     // add the change to the component
     addComponentChangeImpl(facesContext, uiComponent, change);
 

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/ChangeManager.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/ChangeManager.java?rev=1021510&r1=1021509&r2=1021510&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/ChangeManager.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/ChangeManager.java Mon Oct 11 21:17:35 2010
@@ -137,7 +137,10 @@ public abstract class ChangeManager
   }
 
   /**
-   * Add a ComponentChange to this current request for a specified component.
+   * Add a ComponentChange to this current request for a specified component. 
+   * When called we will disallow changes if the component or its any ancestor 
+   * is a stamped component by UIXIterator. 
+   * 
    * @throws IllegalArgumentException if any of the supplied parameters were to
    *          be null.
    */
@@ -148,6 +151,9 @@ public abstract class ChangeManager
 
   /**
    * Add a DocumentChange to this current request for a specified component.
+   * When called we will allow changes even if the component or its any ancestor 
+   * is a stamped component by UIXIterator.
+   * 
    * @throws IllegalArgumentException if any of the supplied parameters were to
    *          be null.
    */

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts?rev=1021510&r1=1021509&r2=1021510&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts Mon Oct 11 21:17:35 2010
@@ -160,8 +160,7 @@
  <resource key="TYPE_ALREADY_LOCKED">Type is already locked</resource>
  
  <!-- CANNOT_FIND_PROPERTY -->
- <resource key="CANNOT_FIND_PROPERTY">Property "{0}" cannot be bound.</resource>
- 
+ <resource key="CANNOT_FIND_PROPERTY">Property "{0}" cannot be bound.</resource> 
  <!-- >KEY_CANNOT_BE_USED_FOR_LISTS -->
  <resource key=">KEY_CANNOT_BE_USED_FOR_LISTS">Key {0} cannot be used for lists</resource>
  
@@ -183,6 +182,9 @@
  <!-- NO_NODE_SPECIFIED -->
  <resource key="NO_NODE_SPECIFIED">No node specified</resource>
  
+ <!-- DONT_PERSIST_STAMPED_COMPONENT_INSIDE_ITERATOR-->
+ <resource key="DONT_PERSIST_STAMPED_COMPONENT_INSIDE_ITERATOR">We don't want to persist stamped component inside an iterator</resource>
+ 
  <!-- COMPONENT_REQUIRED -->
  <resource key="COMPONENT_REQUIRED">Component required</resource>