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

svn commit: r958779 - in /myfaces/core/trunk: api/src/main/java/javax/faces/component/UIData.java api/src/test/java/javax/faces/component/UIDataTest.java impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java

Author: lu4242
Date: Mon Jun 28 23:08:55 2010
New Revision: 958779

URL: http://svn.apache.org/viewvc?rev=958779&view=rev
Log:
MYFACES-2744 UIData.getClientId() should not append rowIndex, instead use UIData.getContainerClientId()

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIDataTest.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java?rev=958779&r1=958778&r2=958779&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java Mon Jun 28 23:08:55 2010
@@ -685,6 +685,7 @@ public class UIData extends UIComponentB
         super.setValueExpression(name, binding);
     }
 
+    /*
     @Override
     public String getClientId(FacesContext context)
     {
@@ -697,6 +698,22 @@ public class UIData extends UIComponentB
 
         StringBuilder bld = __getSharedStringBuilder();
         return bld.append(clientId).append(UINamingContainer.getSeparatorChar(context)).append(rowIndex).toString();
+    }*/
+
+    @Override
+    public String getContainerClientId(FacesContext context)
+    {
+        //MYFACES-2744 UIData.getClientId() should not append rowIndex, instead use UIData.getContainerClientId()
+        String clientId = super.getContainerClientId(context);
+        
+        int rowIndex = getRowIndex();
+        if (rowIndex == -1)
+        {
+            return clientId;
+        }
+
+        StringBuilder bld = __getSharedStringBuilder();
+        return bld.append(clientId).append(UINamingContainer.getSeparatorChar(context)).append(rowIndex).toString();        
     }
 
     /**

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIDataTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIDataTest.java?rev=958779&r1=958778&r2=958779&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIDataTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIDataTest.java Mon Jun 28 23:08:55 2010
@@ -91,7 +91,9 @@ public class UIDataTest extends Abstract
         renderKit.addRenderer(UIData.COMPONENT_FAMILY, UIData.COMPONENT_TYPE, renderer);
         assertEquals("xxx", _testImpl.getClientId(facesContext));
         _testImpl.setRowIndex(99);
-        assertEquals("xxx:99", _testImpl.getClientId(facesContext));
+        //MYFACES-2744 UIData.getClientId() should not append rowIndex, instead use UIData.getContainerClientId()
+        assertEquals("xxx", _testImpl.getClientId(facesContext));
+        assertEquals("xxx:99", _testImpl.getContainerClientId(facesContext));
     }
 
     /**

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java?rev=958779&r1=958778&r2=958779&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java Mon Jun 28 23:08:55 2010
@@ -255,6 +255,7 @@ public class UIRepeat extends UIComponen
         _value = value;
     }
 
+    /*
     @Override
     public String getClientId(FacesContext faces)
     {
@@ -264,6 +265,17 @@ public class UIRepeat extends UIComponen
             id = _getBuffer().append(id).append(UINamingContainer.getSeparatorChar(faces)).append(_index).toString();
         }
         return id;
+    }*/
+    
+    @Override
+    public String getContainerClientId(FacesContext faces)
+    {
+        String id = super.getContainerClientId(faces);
+        if (_index >= 0)
+        {
+            id = _getBuffer().append(id).append(UINamingContainer.getSeparatorChar(faces)).append(_index).toString();
+        }
+        return id;
     }
     
     private RepeatStatus _getRepeatStatus()