Renders an HTML "table" element compliant with the HTML 401 specification. Render the "caption" facet, if present, inside a "caption" element immediately below the "table" element. If the "captionClass" attribute is specified, render its value as the value of the "class" attribute on the "caption" element. If the "captionStyle" attribute is specified, render its value as the value of the "style" attribute on the "caption" element.
Please consult
the javadoc for UIData
to supplement this
specification. If the "styleClass" attribute is specified, render
its value as the value of the "class" attribute on the "table"
element. Any ignored-by-renderer attributes are also rendered on the
"table" element.
Column Groups
If the UIData
component has a "colgroups" facet,
render its contents. Consistent with the rules of facets in
general, this facet must have only one child. In general, this
will be a panel group
component that will contain
colgroup
and col
elements per the HTML
Table specification. Use of column grouping can improve
accessibility. This facet must be rendered before the table
header and footer.
Rendering the header
If the UIData
component has a "header" facet, or
any of the child UIColumn
components has a "header"
facet, render a "thead" element. If the UIData
component has a "header" facet, encode its contents inside of "tr"
and "th" elements, respectively. Output the value of the
"headerClass" attribute of the UIData
component, if
present, as the value of the "class" attribute on the "th".
Output the number of child UIColumn
components of the
UIData
component as the value of the "colspan"
attribute on the "th". Output "colgroup" as the value of the
"scope" attribute on the "th" element.
If any of the child UIColumn
components has a
"header" facet render a "tr" element. For each
UIColumn
that actually has a "header" facet, render
it inside of a "th" element. Columns that don't have a "header"
facet cause an empty "th" element to be rendered. Output the
value of the "headerClass" attribute of the UIColumn
component, if present, as the value of the "class" attribute on
the "th". If the "headerClass" attribute of the UIColumn
component is not present, output the value of the "headerClass"
attribute of the UIData
component, if present, as
the value of the "class" attribute on the "th". Output "col" as
the value of the "scope" attribute on the "th" element.
Close out the "thead" element.
Rendering the footer
If the UIData
component has a "footer" facet, or
any of the child UIColumn
components has a "footer"
facet, render a "tfoot" element. If the UIData
component has "footer" facets, encode the contents inside of a "tr"
element.
If any of the child UIColumn
components has a
"footer" facet render a "td" element. For each
UIColumn
that actually has a "footer" facet, render
it inside of a "td" element. Columns that don't have a "footer"
facet cause an empty "td" element to be rendered. Output the
value of the "footerClass" attribute of the UIColumn
component, if present, as the value of the "class" attribute on
the "td". If the "footerClass" attribute of the UIColumn
component is not present, output the value of the "footerClass"
attribute of the UIData
component, if present, as
the value of the "class" attribute on the "td".
If the UIData
component has a "footer" facet,
encode its contents inside of "tr" and "td" elements, respectively.
Output the value of the "footerClass" attribute of the
UIData
component, if present, as the value of the
"class" attribute on the "td". Output the number of child
UIColumn
components of the UIData
component as the value of the "colspan" attribute on the "td".
Close out the "tfoot" element.
Rendering the table body
Look at the value of the "bodyrows" attribute. If present, this must be a comma separated list of integers. Each entry in this list is the row index of the row before which a "tbody" element should be rendered.
If there was no "bodyrows" attribute, or it was empty, render a
"tbody" element. Keep track of the result of the "rows" property
on the UIData
component. Keep track of the number of
rows we have rendered so far. Iterate through the rows. Set the
"rowIndex" property of the UIData
component to be
correct as we iterate through the rows. Stop rendering children
and close out the "tbody" element if the "rowAvailable" property
of the UIData
returned false. If the current row
index is contained in the "bodyrows" attribute, check if a "tbody"
start element was rendered that needs to be closed, and if so,
close the "tbody" element. Then render a "tbody" element start.
Otherwise, do not render a "tbody" element.
Output a "tr" element. Output the value of the "rowClasses"
per the attribute description below. For each
UIColumn
child, if the column component has a
"rowHeader" attribute with a value of "true", output a "th"
element with a "scope" attribute with the value of "row".
Otherwise, if the column component has no "rowHeader" attribute,
or its value is false, output a "td" element. In either case
attach the value of the "columnClasses" attribute of the
UIData
component per the attribute description below.
Recursively encode each child of each UIColumn
child.
Close out the "td" or "th" element. When done with the row, close
out the "tr" element. When done with all the rows, close out the
"tbody" element.
When done rendering all the rows, set the "rowIndex" property of
the UIData
to -1, and close out the "table"
element.
This renderer is responsible for rendering its children.
Attributes with a ignored-by-renderer
value of
true
are not interpreted by the renderer and are conveyed
straight to the rendered markup, without checking for validity. Attributes with a
ignored-by-renderer
value of false
are interpreted
by the renderer, and may or may not be checked for validity by the renderer.
Attributes | |||||
attribute-name | ignored-by-renderer | attribute-class | description | default-value | |
---|---|---|---|---|---|
bgcolor
|
true | java.lang.String |
Name or code of the background color for this table. | undefined | |
bodyrows
|
false | java.lang.String |
Comma separated list of row indices for which a new "tbody" element should be started (and any previously opened one should be ended). | undefined | |
border
|
true | int |
Width (in pixels) of the border to be drawn around this table. | undefined | |
captionClass
|
false | java.lang.String |
Space-separated list of CSS style class(es) that will be applied to any caption generated for this table. | undefined | |
captionStyle
|
false | java.lang.String |
CSS style(s) to be applied when this caption is rendered. | undefined | |
cellpadding
|
true | java.lang.String |
Definition of how much space the user agent should leave between the border of each cell and its contents. | undefined | |
cellspacing
|
true | java.lang.String |
Definition of how much space the user agent should leave between the left side of the table and the leftmost column, the top of the table and the top of the top side of the topmost row, and so on for the right and bottom of the table. It also specifies the amount of space to leave between cells. | undefined | |
columnClasses
|
false | java.lang.String |
Comma-delimited list of CSS style classes that will be applied to the columns of this table. A space separated list of classes may also be specified for any individual column. If the number of elements in this list is less than the number of actual column children of the UIData, no "class" attribute is output for each column greater than the number of elements in the list. If the number of elements in the list is greater than the number of actual column children of the UIData, the elements at the posisiton in the list after the last column are ignored. | undefined | |
dir
|
true | java.lang.String |
Direction indication for text that does not inherit directionality. Valid values are "LTR" (left-to-right) and "RTL" (right-to-left). These attributes are case sensitive when rendering to XHTML, so care must be taken to have the correct case. | undefined | |
footerClass
|
false | java.lang.String |
Space-separated list of CSS style class(es) that will be applied to any footer generated for this table. | undefined | |
frame
|
true | java.lang.String |
Code specifying which sides of the frame surrounding this table will be visible. Valid values are: none (no sides, default value); above (top side only); below (bottom side only); hsides (top and bottom sides only); vsides (right and left sides only); lhs (left hand side only); rhs (right hand side only); box (all four sides); and border (all four sides). | undefined | |
headerClass
|
false | java.lang.String |
Space-separated list of CSS style class(es) that will be applied to any header generated for this table. | undefined | |
lang
|
true | java.lang.String |
Code describing the language used in the generated markup for this component. | undefined | |
onclick
|
true | java.lang.String |
Javascript code executed when a pointer button is clicked over this element. | undefined | |
ondblclick
|
true | java.lang.String |
Javascript code executed when a pointer button is double clicked over this element. | undefined | |
onkeydown
|
true | java.lang.String |
Javascript code executed when a key is pressed down over this element. | undefined | |
onkeypress
|
true | java.lang.String |
Javascript code executed when a key is pressed and released over this element. | undefined | |
onkeyup
|
true | java.lang.String |
Javascript code executed when a key is released over this element. | undefined | |
onmousedown
|
true | java.lang.String |
Javascript code executed when a pointer button is pressed down over this element. | undefined | |
onmousemove
|
true | java.lang.String |
Javascript code executed when a pointer button is moved within this element. | undefined | |
onmouseout
|
true | java.lang.String |
Javascript code executed when a pointer button is moved away from this element. | undefined | |
onmouseover
|
true | java.lang.String |
Javascript code executed when a pointer button is moved onto this element. | undefined | |
onmouseup
|
true | java.lang.String |
Javascript code executed when a pointer button is released over this element. | undefined | |
role
|
true | java.lang.String |
Per the WAI-ARIA spec and its relationship to HTML5 (Section title ARIA Role Attriubute), every HTML element may have a "role" attribute whose value must be passed through unmodified on the element on which it is declared in the final rendered markup. The attribute, if specified, must have a value that is a string literal that is, or an EL Expression that evaluates to, a set of space-separated tokens representing the various WAI-ARIA roles that the element belongs to. It is the page author's responsibility to ensure that the user agent is capable of correctly interpreting the value of this attribute. |
undefined | |
rowClasses
|
false | java.lang.String |
Comma-delimited list of CSS style classes that will be applied to the rows of this table. A space separated list of classes may also be specified for any individual row. Thes styles are applied, in turn, to each row in the table. For example, if the list has two elements, the first style class in the list is applied to the first row, the second to the second row, the first to the third row, the second to the fourth row, etc. In other words, we keep iterating through the list until we reach the end, and then we start at the beginning again. | undefined | |
rowStatePreserved
|
false | boolean |
Boolean flag directing how the per-row component state should be handled. | undefined | |
rules
|
true | java.lang.String |
Code specifying which rules will appear between cells within this table. Valid values are: none (no rules, default value); groups (between row groups); rows (between rows only); cols (between columns only); and all (between all rows and columns). | undefined | |
style
|
true | java.lang.String |
CSS style(s) to be applied when this component is rendered. | undefined | |
styleClass
|
false | java.lang.String |
Space-separated list of CSS style class(es) to be applied when this element is rendered. This value must be passed through as the "class" attribute on generated markup. | undefined | |
summary
|
true | java.lang.String |
Summary of this table's purpose and structure, for user agents rendering to non-visual media such as speech and Braille. | undefined | |
title
|
true | java.lang.String |
Advisory title information about markup elements generated for this component. | undefined | |
width
|
true | java.lang.String |
Width of the entire table, for visual user agents. | undefined |