docs: protected void renderFacet(FacesContext facesContext, ResponseWriter writer,
              UIComponent component, boolean header)
              throws IOException
      {
          int colspan = 0;
          boolean hasColumnFacet = false;
          int childCount = component.getChildCount();
          for (int i = 0; i < childCount; i++)
          {
              UIComponent uiComponent = component.getChildren().get(i);
              if(uiComponent.isRendered())
              {
                  // a UIColumn has a span of 1, anything else has a span of 0
                  colspan += determineChildColSpan(uiComponent);
  
                  // hasColumnFacet is true if *any* child column has a facet of
                  // the specified type.
                  if (!hasColumnFacet)
                  {
                      hasColumnFacet = hasFacet(header, uiComponent);
                  }
              }
          }
  
          
          UIComponent facet = null;
          if (component.getFacetCount() > 0)
          {
              facet = header ? (UIComponent) component.getFacets().get(HEADER_FACET_NAME) 
                      : (UIComponent) component.getFacets().get(FOOTER_FACET_NAME);
          }
          if (facet != null || hasColumnFacet)
          {
              // Header or Footer present on either the UIData or a column, so we
              // definitely need to render the THEAD or TFOOT section.
              String elemName = determineHeaderFooterTag(facesContext, component, header);
  
              if (elemName != null)
              {
                  writer.startElement(elemName, null); // component);
              }
              if (header)
              {
                  String headerStyleClass = getHeaderClass(component);
                  if (facet != null)
                  {
                      renderTableHeaderRow(facesContext, writer, component, facet, headerStyleClass, colspan);
                  }
                  if (hasColumnFacet)
                  {
                      renderColumnHeaderRow(facesContext, writer, component, headerStyleClass);
                  }
              }
              else
              {
                  String footerStyleClass = getFooterClass(component);
                  if (hasColumnFacet)
                  {
                      renderColumnFooterRow(facesContext, writer, component, footerStyleClass);
                  }
                  if (facet != null)
                  {
                      renderTableFooterRow(facesContext, writer, component, facet, footerStyleClass, colspan);
                  }
              }
              if (elemName != null)
              {
                  writer.endElement(elemName);
              }
          }
      }