Ejemplo n.º 1
0
  protected void encodeTFoot(FacesContext context, DataTable table) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    ColumnGroup group = table.getColumnGroup("footer");

    writer.startElement("tfoot", null);

    if (group != null && group.isRendered()) {

      for (UIComponent child : group.getChildren()) {
        if (child.isRendered() && child instanceof Row) {
          Row footerRow = (Row) child;

          writer.startElement("tr", null);

          for (UIComponent footerRowChild : footerRow.getChildren()) {
            if (footerRowChild.isRendered() && footerRowChild instanceof Column) {
              encodeColumnFooter(context, table, (Column) footerRowChild);
            }
          }

          writer.endElement("tr");
        }
      }

    } else if (table.hasFooterColumn()) {
      writer.startElement("tr", null);

      for (UIColumn column : table.getColumns()) {
        if (column instanceof Column) {
          encodeColumnFooter(context, table, column);
        } else if (column instanceof DynamicColumn) {
          DynamicColumn dynamicColumn = (DynamicColumn) column;
          dynamicColumn.applyModel();

          encodeColumnFooter(context, table, dynamicColumn);
        }
      }

      writer.endElement("tr");
    }

    writer.endElement("tfoot");
  }