DataGridRenderer extends AbstractRowsRenderer implements MetaComponentRenderer { @Override public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder) throws IOException { AbstractDataGrid dataGrid = (AbstractDataGrid) rowHolder.getRow(); int columns = dataGrid.getColumns(); int processCell = rowHolder.getProcessCell(); if (columns > 0 && (processCell % columns == 0)) { if (processCell != 0) { writer.endElement(HtmlConstants.TR_ELEMENT); rowHolder.resetProcessCell(); } writer.startElement(HtmlConstants.TR_ELEMENT, dataGrid); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dg-r", null); rowHolder.nextRow(); } writer.startElement(HtmlConstants.TD_ELEM, dataGrid); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dg-c", null); renderChildren(facesContext, dataGrid); writer.endElement(HtmlConstants.TD_ELEM); }  @Override void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder); void encodeHeader(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial); void encodeFooter(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial); void encodeCaption(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid); void encodeNoData(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid); void encodeFacet(ResponseWriter writer, FacesContext facesContext, UIComponent facet, EncodeStrategy strategy,
        AbstractDataGrid dataGrid, Object[] params); void encodeTBody(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial); @Override RowHolderBase createRowHolder(FacesContext context, UIComponent component, Object[] options); void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId); void decodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId); DataVisitResult process(FacesContext facesContext, Object rowKey, Object argument); @Override void encodeFakeRow(FacesContext facesContext, RowHolderBase rowHolder);  }
@Test public final void testEncodeRow() throws IOException { HtmlPage page = environment.getPage("/dataGridTest.jsf"); HtmlElement dataGrid = page.getElementById("dataGrid"); assertEquals("value", ((HtmlElement) dataGrid .getFirstByXPath("tbody/tr[@class='rf-dg-r']/td[@class='rf-dg-c']/*[@id='dataGrid:0:outputText']")) .getTextContent()); }