myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1533231 - /myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
Date Thu, 17 Oct 2013 19:51:59 GMT
Author: lu4242
Date: Thu Oct 17 19:51:58 2013
New Revision: 1533231

URL: http://svn.apache.org/r1533231
Log:
MYFACES-3749 columnClasses not working correctly in DataTable Component (thanks to Paul Nicolucci
for provide this patch)

Modified:
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java

Modified: myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java?rev=1533231&r1=1533230&r2=1533231&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
(original)
+++ myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
Thu Oct 17 19:51:58 2013
@@ -483,6 +483,7 @@ public class HtmlTableRendererBase exten
                 }
 
                 List children = null;
+                int columnStyleIndex = 0;
                 for (int j = 0, size = getChildCount(component); j < size; j++)
                 {
                     if (children == null)
@@ -496,16 +497,18 @@ public class HtmlTableRendererBase exten
                         
                         if (columnRendering)
                         {
-                            beforeColumn(facesContext, uiData, j);
+                            beforeColumn(facesContext, uiData, columnStyleIndex);
                         }
                            
                         encodeColumnChild(facesContext, writer, uiData, child, 
-                                styles, nc * uiData.getChildCount() + j);               
    
+                                styles, nc * uiData.getChildCount() + columnStyleIndex);
                        
                         if (columnRendering)
                         {
-                            afterColumn(facesContext, uiData, j);
+                            afterColumn(facesContext, uiData, columnStyleIndex);
                         }
+                        columnStyleIndex = columnStyleIndex + 
+                            getColumnCountForComponent(facesContext, uiData, child);
                     }
                 }
 
@@ -582,6 +585,7 @@ public class HtmlTableRendererBase exten
             renderRowStart(facesContext, writer, uiData, styles, currentRow);
             
             List<UIComponent> children = null;
+            int columnStyleIndex = 0;
             for (int j = 0, size = getChildCount(component); j < size; j++)
             {
                 if (children == null)
@@ -595,16 +599,18 @@ public class HtmlTableRendererBase exten
                     
                     if (columnRendering)
                     {
-                        beforeColumn(facesContext, uiData, j);
+                        beforeColumn(facesContext, uiData, columnStyleIndex);
                     }
                        
                     encodeColumnChild(facesContext, writer, uiData, child, 
-                            styles, j);                    
+                            styles, columnStyleIndex);
                    
                     if (columnRendering)
                     {
-                        afterColumn(facesContext, uiData, j);
+                        afterColumn(facesContext, uiData, columnStyleIndex);
                     }
+                    columnStyleIndex = columnStyleIndex + 
+                            getColumnCountForComponent(facesContext, uiData, child);
                 }
             }
 
@@ -821,6 +827,22 @@ public class HtmlTableRendererBase exten
     {        
     }
     /**
+     * Indicates the number of columns the component represents. By default each UIColumn
instance
+     * is 1 column
+     * @param facesContext
+     * @param uiData
+     * @param child
+     * @return 
+     */
+    protected int getColumnCountForComponent(FacesContext facesContext, UIData uiData, UIComponent
child)
+    {
+        if (child instanceof UIColumn)
+        {
+            return 1;
+        }
+        return 0;
+    }
+    /**
      *Perform any operations necessary immediately before each column child's header or footer
is rendered
      *
      * @param facesContext the <code>FacesContext</code>.



Mime
View raw message