Author: abelevich
Date: 2007-11-02 07:28:55 -0400 (Fri, 02 Nov 2007)
New Revision: 3705
Modified:
branches/3.1.x/ui/dataTable/src/main/config/component/dataGrid.xml
branches/3.1.x/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractGridRenderer.java
Log:
don't encode empty <tr> <td> if collection empty
Modified: branches/3.1.x/ui/dataTable/src/main/config/component/dataGrid.xml
===================================================================
--- branches/3.1.x/ui/dataTable/src/main/config/component/dataGrid.xml 2007-11-02 11:28:14
UTC (rev 3704)
+++ branches/3.1.x/ui/dataTable/src/main/config/component/dataGrid.xml 2007-11-02 11:28:55
UTC (rev 3705)
@@ -37,7 +37,7 @@
</property>
<property>
<name>ajaxKeys</name>
- <classname>java.lang.String</classname>
+ <classname>java.util.Set</classname>
<description>This attribute defines rows that are updated after an AJAX
request</description>
</property>
<property>
@@ -49,7 +49,6 @@
<property>
<name>columns</name>
<classname>int</classname>
- <defaultvalue>0</defaultvalue>
<description>Quantity of columns
</description>
</property>
@@ -175,7 +174,7 @@
</property>
<property>
<name>componentState</name>
- <classname>java.lang.String</classname>
+ <classname>org.ajax4jsf.model.DataComponentState</classname>
<description>It defines EL-binding for a component state for saving or
redefinition</description>
</property>
</component>
Modified:
branches/3.1.x/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractGridRenderer.java
===================================================================
---
branches/3.1.x/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractGridRenderer.java 2007-11-02
11:28:14 UTC (rev 3704)
+++
branches/3.1.x/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractGridRenderer.java 2007-11-02
11:28:55 UTC (rev 3705)
@@ -71,7 +71,7 @@
ResponseWriter writer = context.getResponseWriter();
int currentRow = holder.getRowCounter();
Integer columns = (Integer) table.getAttributes().get("columns");
- int cols = (null!=columns &&
columns.intValue()!=Integer.MIN_VALUE)?columns.intValue():0;
+ int cols = (null!=columns &&
columns.intValue()!=Integer.MIN_VALUE)?columns.intValue():1;
int gridRowCounter = holder.getGridRowCounter();
if ( cols >0 && currentRow%cols==0) {
if (currentRow != 0 ) {
@@ -97,24 +97,26 @@
* @see
org.richfaces.renderkit.AbstractRowsRenderer#doCleanup(org.richfaces.renderkit.TableHolder)
*/
protected void doCleanup(FacesContext context, TableHolder tableHolder) throws
IOException {
+ int rest = 0;
UIDataAdaptor table = tableHolder.getTable();
ResponseWriter writer = context.getResponseWriter();
Integer columns = (Integer) table.getAttributes().get("columns");
- if (null!=columns && columns.intValue()!=Integer.MIN_VALUE ) {
- int rest =
tableHolder.getRowCounter()-tableHolder.getGridRowCounter()*columns.intValue();
- if(rest == 0){
- writer.startElement(HTML.TR_ELEMENT, table);
- }
- for(int i = rest;i<columns.intValue();i++){
- writer.startElement(HTML.td_ELEM, table);
- String columnClass = tableHolder.getColumnClass(i);
- encodeStyleClass(writer, null, "dr-table-cell rich-table-cell", null,
columnClass);
- writer.writeText("\u00A0", null);//
- writer.endElement(HTML.td_ELEM);
- }
+ Boolean isCleanable = (null!=columns && columns.intValue()!=Integer.MIN_VALUE)?
true:false;
+ int cols = isCleanable ? columns.intValue():1;
+
+ rest = tableHolder.getRowCounter()-tableHolder.getGridRowCounter()*cols;
+ for(int i = rest;i<columns.intValue();i++){
+ writer.startElement(HTML.td_ELEM, table);
+ String columnClass = tableHolder.getColumnClass(i);
+ encodeStyleClass(writer, null, "dr-table-cell rich-table-cell", null,
columnClass);
+ writer.writeText("\u00A0", null);//
+ writer.endElement(HTML.td_ELEM);
}
- writer.endElement(HTML.TR_ELEMENT);
+
+ if(rest != 0){
+ writer.endElement(HTML.TR_ELEMENT);
+ }
}
}
Show replies by date