@Test public final void testDoEncodeChildren() throws IOException { HtmlPage page = environment.getPage("/dataGridTest.jsf"); HtmlElement dataGrid = (HtmlElement) page.getElementById("dataGrid2"); assertEquals("rf-dg", dataGrid.getAttribute("class")); assertEquals("noDataFacet", ((HtmlElement) dataGrid .getFirstByXPath("tbody/tr[@class='rf-dg-nd']/td[@class='rf-dg-nd-c']/*[@id='dataGrid2:noDataFacet']")) .getTextContent()); }
@Override protected void doEncodeChildren(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException { AbstractDataGrid dataGrid = (AbstractDataGrid) component; writer.startElement(HtmlConstants.TABLE_ELEMENT, dataGrid); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, dataGrid.getClientId(facesContext), null); Map<String, Object> attributes = dataGrid.getAttributes(); String classes = concatClasses("rf-dg", attributes.get(HtmlConstants.STYLE_CLASS_ATTR)); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, classes, null); RenderKitUtils.renderAttribute(facesContext, "style", attributes.get(HtmlConstants.STYLE_ATTRIBUTE)); RenderKitUtils.renderAttribute(facesContext, HtmlConstants.TITLE_ATTRIBUTE, attributes.get(HtmlConstants.TITLE_ATTRIBUTE)); encodeCaption(writer, facesContext, dataGrid); encodeHeader(writer, facesContext, dataGrid, false); encodeFooter(writer, facesContext, dataGrid, false); encodeTBody(writer, facesContext, dataGrid, false); writer.endElement(HtmlConstants.TABLE_ELEMENT); }
DataGridRenderer extends AbstractRowsRenderer implements MetaComponentRenderer { @Override protected void doEncodeChildren(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException { AbstractDataGrid dataGrid = (AbstractDataGrid) component; writer.startElement(HtmlConstants.TABLE_ELEMENT, dataGrid); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, dataGrid.getClientId(facesContext), null); Map<String, Object> attributes = dataGrid.getAttributes(); String classes = concatClasses("rf-dg", attributes.get(HtmlConstants.STYLE_CLASS_ATTR)); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, classes, null); RenderKitUtils.renderAttribute(facesContext, "style", attributes.get(HtmlConstants.STYLE_ATTRIBUTE)); RenderKitUtils.renderAttribute(facesContext, HtmlConstants.TITLE_ATTRIBUTE, attributes.get(HtmlConstants.TITLE_ATTRIBUTE)); encodeCaption(writer, facesContext, dataGrid); encodeHeader(writer, facesContext, dataGrid, false); encodeFooter(writer, facesContext, dataGrid, false); encodeTBody(writer, facesContext, dataGrid, false); writer.endElement(HtmlConstants.TABLE_ELEMENT); } }
DataGridRenderer extends AbstractRowsRenderer implements MetaComponentRenderer { @Override protected void doEncodeChildren(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException { AbstractDataGrid dataGrid = (AbstractDataGrid) component; writer.startElement(HtmlConstants.TABLE_ELEMENT, dataGrid); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, dataGrid.getClientId(facesContext), null); Map<String, Object> attributes = dataGrid.getAttributes(); String classes = concatClasses("rf-dg", attributes.get(HtmlConstants.STYLE_CLASS_ATTR)); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, classes, null); RenderKitUtils.renderAttribute(facesContext, "style", attributes.get(HtmlConstants.STYLE_ATTRIBUTE)); RenderKitUtils.renderAttribute(facesContext, HtmlConstants.TITLE_ATTRIBUTE, attributes.get(HtmlConstants.TITLE_ATTRIBUTE)); encodeCaption(writer, facesContext, dataGrid); encodeHeader(writer, facesContext, dataGrid, false); encodeFooter(writer, facesContext, dataGrid, false); encodeTBody(writer, facesContext, dataGrid, false); writer.endElement(HtmlConstants.TABLE_ELEMENT); }  }
DataGridRenderer extends AbstractRowsRenderer implements MetaComponentRenderer { @Override protected void doEncodeChildren(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException { AbstractDataGrid dataGrid = (AbstractDataGrid) component; writer.startElement(HtmlConstants.TABLE_ELEMENT, dataGrid); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, dataGrid.getClientId(facesContext), null); Map<String, Object> attributes = dataGrid.getAttributes(); String classes = concatClasses("rf-dg", attributes.get(HtmlConstants.STYLE_CLASS_ATTR)); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, classes, null); RenderKitUtils.renderAttribute(facesContext, "style", attributes.get(HtmlConstants.STYLE_ATTRIBUTE)); RenderKitUtils.renderAttribute(facesContext, HtmlConstants.TITLE_ATTRIBUTE, attributes.get(HtmlConstants.TITLE_ATTRIBUTE)); encodeCaption(writer, facesContext, dataGrid); encodeHeader(writer, facesContext, dataGrid, false); encodeFooter(writer, facesContext, dataGrid, false); encodeTBody(writer, facesContext, dataGrid, false); writer.endElement(HtmlConstants.TABLE_ELEMENT); }  @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); }
DataGridRenderer extends AbstractRowsRenderer implements MetaComponentRenderer { @Override protected void doEncodeChildren(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException { AbstractDataGrid dataGrid = (AbstractDataGrid) component; writer.startElement(HtmlConstants.TABLE_ELEMENT, dataGrid); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, dataGrid.getClientId(facesContext), null); Map<String, Object> attributes = dataGrid.getAttributes(); String classes = concatClasses("rf-dg", attributes.get(HtmlConstants.STYLE_CLASS_ATTR)); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, classes, null); RenderKitUtils.renderAttribute(facesContext, "style", attributes.get(HtmlConstants.STYLE_ATTRIBUTE)); RenderKitUtils.renderAttribute(facesContext, HtmlConstants.TITLE_ATTRIBUTE, attributes.get(HtmlConstants.TITLE_ATTRIBUTE)); encodeCaption(writer, facesContext, dataGrid); encodeHeader(writer, facesContext, dataGrid, false); encodeFooter(writer, facesContext, dataGrid, false); encodeTBody(writer, facesContext, dataGrid, false); writer.endElement(HtmlConstants.TABLE_ELEMENT); }  @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);  }