Foundation
Project Documentation

Summary

Tag name: <tr:treeTable>
UIComponent class: org.apache.myfaces.trinidad.component.core.data.CoreTreeTable
Component type: org.apache.myfaces.trinidad.CoreTreeTable

Naming container: Yes. When referring to children of this component ("partialTriggers", findComponent(), etc.), you must prefix the child's ID with this component's ID and a colon (':').

The Trinidad TreeTable is used to display data that is structured in a hierarchical format. This component displays a hierarchy in a UI similar to an Trinidad Table, and is more elaborate than the Tree component. TreeTable supports displaying columns of data per element in the hierarchy. Unlike the Tree component, TreeTable only supports single rooted hierarchies. The features of the TreeTable component include mechanisms for focusing in on subtrees (within the main tree), as well as expanding and collapsing elements in the hierarchy.

Like the Table, the TreeTable's children must be Trinidad Column components. Like the Tree, the TreeTable has a "nodeStamp" facet which renders the "Object Name" Column. The "Object Name" Column contains the primary identifier of an element in the hierarchy. For example, in an organization chart of employees, the "Object Name" Column might be the employee name.

Example(s):

In the following example, The "Object Name" Column is the "Employee Name" Column. For each element (that is, employee) the TreeTable stamps out the name, ID and the department.

<tr:treeTable var="node" value="#{myBean.orgChart.root}">
  <f:facet name="nodeStamp">
    <tr:column>
      <f:facet name="header">
        <tr:outputText value="Employee Name"/>
      </f:facet>
      <tr:outputText value="#{node.ename}"/>
    </tr:column>
  </f:facet>
  <tr:column>
    <f:facet name="header">
      <tr:outputText value="Employee Id"/>
    </f:facet>
    <tr:outputText value="#{node.empid}"/>
  </tr:column>
  <tr:column>
    <f:facet name="header">
      <tr:outputText value="Department"/>
    </f:facet>
    <tr:outputText value="#{node.dname}"/>
  </tr:column>
</tr:treeTable>

Events

Type Phases Description
org.apache.myfaces.trinidad.event.RowDisclosureEvent Apply Request Values,
Invoke Application
The expansion event is generated for a table when the detail facet of a row is expanded or collapsed. For tree or a treeTable, the expansion event is generated when tree nodes are expanded or collapsed.
org.apache.myfaces.trinidad.event.SelectionEvent Apply Request Values,
Invoke Application
The selection event is delivered when the table selection changes.
org.apache.myfaces.trinidad.event.FocusEvent Apply Request Values,
Invoke Application
Event delivered when user clicks to focus on (or zoom into) a particular element's subtree of children. The TreeTable responds to this event by modifying the "focusPath" property appropriately. Subsequently, any registered FocusListener instances are called.
org.apache.myfaces.trinidad.event.AttributeChangeEvent Invoke Application,
Apply Request Values
Event delivered to describe an attribute change. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change events might include the width of a column that supported client-side resizing.

Supported Facets

Name Description
actions content to be rendered inline with the navigation bar.
footer the component used to render the table footer.
header the component used to render the table header.
nodeStamp the component to use to stamp each element in the tree. Only certain types of components are supported, including all components with no behavior and most components that implement the EditableValueHolder or ActionSource interfaces. In a treeTable, this must be a column.
pathStamp the component used to stamp each step of the focus path of this treeTable.

Attributes

Name Type Supports EL? Description
attributeChangeListener javax.el.MethodExpression Only EL a method reference to an attribute change listener. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change events might include the width of a column that supported client-side resizing.
autoSubmit boolean Yes If set to TRUE on a form element, the component will automatically submit the enclosing form when an appropriate action takes place (a click, text change, etc.). This only takes effect if rowSelection attribute enabled.
binding org.apache.myfaces.trinidad.component.core.data.CoreTreeTable Only EL an EL reference that will store the component instance on a bean. This can be used to give programmatic access to a component from a backing bean, or to move creation of the component to a backing bean.
columnBandingInterval int Yes the interval between which the column banding alternates. For example, a columnBandingInterval of 1 would display alternately banded columns.
disclosedRowKeys org.apache.myfaces.trinidad.model.RowKeySet Yes the set of disclosed rows for this component. Each entry in the set is a rowKey.
emptyText String Yes text displayed when a table is empty.
expandAllEnabled boolean Yes Whether the Expand All, Collapse All links should be rendered.
focusListener javax.el.MethodExpression Only EL a method reference to a focus listener
focusRowKey Object Yes the rowKey of the currently focused row. The rowKeys of the ancestor rows of the focus row are added to the expandedRowKeys RowKeySet by default.
horizontalGridVisible boolean Yes if the horizontal grid lines will be drawn.
id String No the identifier for the component. The identifier must follow a subset of the syntax allowed in HTML:
  • Must not be a zero-length String.
  • First character must be an ASCII letter (A-Za-z) or an underscore ('_').
  • Subsequent characters must be an ASCII letter or digit (A-Za-z0-9), an underscore ('_'), or a dash ('-').
immediate boolean Yes whether or not data validation - client-side or server-side - should take place when events are generated by this component. When immediate is true, the default ActionListener provided by the JavaServer Faces implementation should be executed during Apply Request Values phase of the request processing lifecycle, rather than waiting until the Invoke Application phase.
initiallyExpanded boolean Yes If upon initial rendering, the current subtree under the focused row path should be expanded. A RowDisclosureEvent is broadcast from the encode begin of the component so that listeners are properly notified of the disclosure.
inlineStyle String Yes the CSS styles to use for this component.
onclick String Yes an onclick Javascript handler.
ondblclick String Yes an ondblclick Javascript handler.
onkeydown String Yes an onkeydown Javascript handler.
onkeypress String Yes an onkeypress Javascript handler.
onkeyup String Yes an onkeyup Javascript handler.
onmousedown String Yes an onmousedown Javascript handler.
onmousemove String Yes an onmousemove Javascript handler.
onmouseout String Yes an onmouseout Javascript handler.
onmouseover String Yes an onmouseover Javascript handler.
onmouseup String Yes an onmouseup Javascript handler.
partialTriggers String[] Yes the IDs of the components that should trigger a partial update.

This component will listen on the trigger components. If one of the trigger components receives an event that will cause it to update in some way, this component will request to be updated too.

Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"

Identifiers must account for NamingContainers. You can use a single colon to start the search from the root, or use multiple colons to move up through the NamingContainer. For example, "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), ":::" will pop out of two naming containers, etc. The search for the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the component with id = commandButton1 after popping out of two naming containers relative to this component. To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".

rangeChangeListener javax.el.MethodExpression Only EL a method reference to a rangeChange listener that will be called when a new range is selected.
rendered boolean Yes whether the component is rendered. When set to false, no output will be delivered for this component (the component will not in any way be rendered, and cannot be made visible on the client).
rootNodeRendered boolean Yes If the root node should be rendered or not. Defaults to true.
rowBandingInterval int Yes the interval between which the row banding alternates. For example, rowBandingInterval=1 would displayalternately banded rows in the Grid.
rowDisclosureListener javax.el.MethodExpression Only EL a method reference to an ExpansionListener
rowSelection String Yes Valid Values: none, single, multiple

whether rows in this table selectable. Valid values are "none", "single", "multiple"
rowsByDepth int[] Yes the maximum number of records that can be displayed at one time (range size). Each level of depth in the tree can have a different range size. The first number in the array sets the range size for the root collection. Each subsequent number sets the range size for the corresponding depth. The last number becomes the default for each subsequent level of depth. If a node has more children than the range size, navigation rows will be rendered above and below the child nodes.
selectedRowKeys org.apache.myfaces.trinidad.model.RowKeySet Yes the selection state for this component.
selectionListener javax.el.MethodExpression Only EL a method reference to a selection listener
shortDesc String Yes The short description of the component. This text is commonly used by user agents to display tooltip help text.
styleClass String Yes a CSS style class to use for this component.
summary String Yes the summary of this table's purpose and structure for user agents rendering to non-visual media.
value Object Yes the hierarchy of tree data - must be of type org.apache.myfaces.trinidad.model.TreeModel
var String No Name of the EL variable used to reference each element of this collection. Once this component has completed rendering, this variable is removed (or reverted back to its previous value).
varStatus String No Name of the EL variable used to reference the varStatus information. Once this component has completed rendering, this variable is removed (or reverted back to its previous value). The VarStatus provides contextual information about the state of the component to EL expressions. For components that iterate, varStatus also provides loop counter information. Please see the this component's documentation for the specific properties on the varStatus. The common properties on varStatus include:
  • "model" - returns the CollectionModel for this component
  • "index" - returns the zero based row index
verticalGridVisible boolean Yes if the vertical grid lines will be drawn.
width String Yes the width of the table. The value must either be a number of pixels or a percentage - it is not a CSS width.