ExtendedDataTableRenderer extends SelectionRenderer implements MetaComponentRenderer { public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder) throws IOException { RendererState state = (RendererState) rowHolder; AbstractExtendedDataTable table = (AbstractExtendedDataTable) state.getRow(); writer.startElement(HtmlConstants.TR_ELEMENT, table); if (rowHolder.getRow() instanceof UIDataTableBase) { renderRowHandlers(facesContext, (UIDataTableBase) rowHolder.getRow()); } String rowClass = getRowClass(rowHolder); StringBuilder builder = new StringBuilder(); Collection<Object> selection = table.getSelection(); if (selection != null && selection.contains(table.getRowKey())) { builder.append("rf-edt-r-sel"); } if (table.getRowKey().equals(table.getAttributes().get("activeRowKey"))) { if (builder.length() > 0) { builder.append(' '); } builder.append("rf-edt-r-act"); } if (table.getRowKey().equals(table.getAttributes().get("shiftRowKey"))) { if (builder.length() > 0) { builder.append(' '); } builder.append("rf-edt-r-sht"); } rowClass = concatClasses(builder.toString(), rowClass); if (rowClass.length() > 0) { writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, rowClass, null); } Iterator<UIComponent> columns = null; Part part = state.getPart(); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, table.getContainerClientId(facesContext) + ":" + part.getName().getId(), null); columns = part.getColumns().iterator(); int columnNumber = 0; int lastColumnNumber = part.getColumns().size() - 1; while (columns.hasNext()) { UIComponent column = (UIComponent) columns.next(); if (column.isRendered()) { writer.startElement(HtmlConstants.TD_ELEM, table); String columnClass = ""; if (columnNumber != lastColumnNumber) { columnClass = "rf-edt-td-" + column.getId(); } columnClass = concatClasses( columnClass, getColumnClass(rowHolder, columnNumber), column.getAttributes().get(HtmlConstants.STYLE_CLASS_ATTR)); if (!"".equals(columnClass)) { writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, columnClass, null); } String columnStyle = (String) column.getAttributes().get(HtmlConstants.STYLE_ATTRIBUTE); if (!"".equals(columnStyle)) { writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, columnStyle, null); } columnNumber++; writer.startElement(HtmlConstants.DIV_ELEM, table); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-edt-c rf-edt-c-" + column.getId(), null); writer.startElement(HtmlConstants.DIV_ELEM, column); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-edt-c-cnt", null); renderChildren(facesContext, column); writer.endElement(HtmlConstants.DIV_ELEM); writer.endElement(HtmlConstants.DIV_ELEM); writer.endElement(HtmlConstants.TD_ELEM); } } writer.endElement(HtmlConstants.TR_ELEMENT); }  void encodeHeader(RendererState state); void encodeBody(RendererState state); void encodeFooter(RendererState state); void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId); void decodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId); RendererState createRowHolder(FacesContext context, UIComponent component, Object[] options); void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder); void consumeTableState(FacesContext facesContext, UIDataTableBase table, ExtendedDataTableState tableState);  }
@Test public final void testEncodeRow() throws IOException { HtmlPage page = environment.getPage("/extendedDataTableTest.jsf"); HtmlElement table = page.getElementById("table"); HtmlElement cell = table.getElementById("table:0:f").getElementsByTagName("div").get(0); assertTrue(cell.getAttribute("class").contains("rf-edt-c")); HtmlElement cellContent = cell.getElementsByTagName("div").get(0); assertEquals("rf-edt-c-cnt", cellContent.getAttribute("class")); assertEquals("value", cellContent.getElementById("table:0:outputText").getTextContent()); }