edu.nrao.sss.webapp.faces.renderer
Class TableRenderer

java.lang.Object
  extended by javax.faces.render.Renderer
      extended by org.apache.myfaces.shared_impl.renderkit.html.HtmlRenderer
          extended by org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase
              extended by org.apache.myfaces.renderkit.html.HtmlTableRenderer
                  extended by edu.nrao.sss.webapp.faces.renderer.TableRenderer

public class TableRenderer
extends org.apache.myfaces.renderkit.html.HtmlTableRenderer

This class extends Apache MyFace's HtmlTableRenderer to add the ability to render a colspan attribute on UIColumn's. An example usage would be to conditionally assign a colspan value to a UIColumn tag so that some rows of that column span multiple columns, and some don't. Important to note that the columns that the span will be encompassing need to be not rendered under the same conditions.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase
org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase.Styles
 
Field Summary
protected static String colspanAttr
           
protected static String styleClassAttr
           
 
Fields inherited from class org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase
FOOTER_FACET_NAME, HEADER_FACET_NAME
 
Constructor Summary
TableRenderer()
           
 
Method Summary
protected  void beforeBody(FacesContext facesContext, UIData uiData)
          This is rediculous.
protected  int getColspan(UIComponent column, FacesContext ctx)
           
protected  String getStyleClass(UIComponent column, FacesContext ctx)
           
protected  void renderColumnBody(FacesContext facesContext, ResponseWriter writer, UIData uiData, UIComponent component, org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase.Styles styles, int columnStyleIndex)
          Overrides the renderColumnBody method of HtmlTableRenderer to add rendering of a colspan attribute when necessary.
protected  void renderColumnHeaderCell(FacesContext facesContext, ResponseWriter writer, UIComponent uiComponent, UIComponent facet, String headerStyleClass, int colspan)
          Overrides the renderColumnHeaderCell method of HtmlTableRenderer to use the colspan attribute specified in the column tag.
 
Methods inherited from class org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase
afterBody, afterColumn, afterColumnHeaderOrFooter, afterRow, afterTable, beforeColumn, beforeColumnHeaderOrFooter, beforeRow, beforeTable, decode, determineChildColSpan, encodeBegin, encodeChildren, encodeColumnChild, encodeEnd, encodeInnerHtml, getFooterClass, getHeaderClass, getNewspaperColumns, getNewspaperTableSpacer, getRendersChildren, getStyles, hasFacet, hasNewspaperTableSpacer, inBodyStart, isNewspaperHorizontalOrientation, renderColumnChildHeaderOrFooterRow, renderColumnFooterCell, renderColumnFooterCell, renderColumnFooterRow, renderColumnHeaderCell, renderColumnHeaderRow, renderFacet, renderRowEnd, renderRowStart, renderRowStyle, renderSpacerCell, renderTableFooterRow, renderTableHeaderRow
 
Methods inherited from class org.apache.myfaces.shared_impl.renderkit.html.HtmlRenderer
getActionUrl, getChildCount, getChildren, getClientId, renderId, shouldRenderId, toUri
 
Methods inherited from class javax.faces.render.Renderer
convertClientId, getConvertedValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colspanAttr

protected static final String colspanAttr
See Also:
Constant Field Values

styleClassAttr

protected static final String styleClassAttr
See Also:
Constant Field Values
Constructor Detail

TableRenderer

public TableRenderer()
Method Detail

renderColumnBody

protected void renderColumnBody(FacesContext facesContext,
                                ResponseWriter writer,
                                UIData uiData,
                                UIComponent component,
                                org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase.Styles styles,
                                int columnStyleIndex)
                         throws IOException
Overrides the renderColumnBody method of HtmlTableRenderer to add rendering of a colspan attribute when necessary.

Overrides:
renderColumnBody in class org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase
Throws:
IOException

renderColumnHeaderCell

protected void renderColumnHeaderCell(FacesContext facesContext,
                                      ResponseWriter writer,
                                      UIComponent uiComponent,
                                      UIComponent facet,
                                      String headerStyleClass,
                                      int colspan)
                               throws IOException
Overrides the renderColumnHeaderCell method of HtmlTableRenderer to use the colspan attribute specified in the column tag.

Overrides:
renderColumnHeaderCell in class org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase
Throws:
IOException

beforeBody

protected void beforeBody(FacesContext facesContext,
                          UIData uiData)
                   throws IOException
This is rediculous. I have to override this method to call uiData.setRowIndex(0) before the headers are rendered so that the rendered flag of the child UIColumn objects is correctly set. This step isn't done until we are rendering the body normally. I'm not sure what the ramifications of doing this early are. It gets reset once body rendering starts anyway, so hopefully there are none.

Overrides:
beforeBody in class org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase
Throws:
IOException

getColspan

protected int getColspan(UIComponent column,
                         FacesContext ctx)

getStyleClass

protected String getStyleClass(UIComponent column,
                               FacesContext ctx)


Copyright © 2009. All Rights Reserved.