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.

Code 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>

Supported Client Events for Client Behaviors

  • click (default)
  • dblclick
  • keydown
  • keypress
  • keyup
  • mousedown
  • mousemove
  • mouseout
  • mouseover
  • mouseup

Events

Type Phases Description
org.apache.myfaces.trinidad.event.RowDisclosureEventApply 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.SelectionEventApply Request Values,
Invoke Application
The selection event is delivered when the table selection changes.
org.apache.myfaces.trinidad.event.FocusEventApply 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.AttributeChangeEventInvoke 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 event might include the width of a column that supported client-side resizing.

Supported Facets

Name Description
actionscontent to be rendered inline with the navigation bar.
footerthe component used to render the table footer.
headerthe component used to render the table header.
nodeStampthe 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.
pathStampthe component used to stamp each step of the focus path of this treeTable.

Attributes

Name Type Supports EL? Description
attributeChangeListenerjavax.el.MethodExpressionOnly 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.
autoSubmitbooleanYes Default Value: false

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.
bindingorg.apache.myfaces.trinidad.component.core.data.CoreTreeTableOnly 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.
columnBandingIntervalintYes Default Value: 0

the interval between which the column banding alternates. For example, a columnBandingInterval of 1 would display alternately banded columns.
disclosedRowKeysorg.apache.myfaces.trinidad.model.RowKeySetYes the set of disclosed rows for this component. Each entry in the set is a rowKey.
emptyTextStringYes text displayed when a table is empty.
expandAllEnabledbooleanYes Default Value: true

Whether the Expand All, Collapse All links should be rendered.
focusListenerjavax.el.MethodExpressionOnly EL a method reference to a focus listener
focusRowKeyObjectYes 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.
horizontalGridVisiblebooleanYes Default Value: true

if the horizontal grid lines will be drawn.
idStringNo 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 ('-').
immediatebooleanYes Default Value: false

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.
initiallyExpandedbooleanYes Default Value: false

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.
inlineStyleStringYes the CSS styles to use for this component.
onclickStringYes an onclick Javascript handler.
ondblclickStringYes an ondblclick Javascript handler.
onkeydownStringYes an onkeydown Javascript handler.
onkeypressStringYes an onkeypress Javascript handler.
onkeyupStringYes an onkeyup Javascript handler.
onmousedownStringYes an onmousedown Javascript handler.
onmousemoveStringYes an onmousemove Javascript handler.
onmouseoutStringYes an onmouseout Javascript handler.
onmouseoverStringYes an onmouseover Javascript handler.
onmouseupStringYes an onmouseup Javascript handler.
partialTriggersString[]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".

rangeChangeListenerjavax.el.MethodExpressionOnly EL a method reference to a rangeChange listener that will be called when a new range is selected.
renderedbooleanYes Default Value: true

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). If you want to change a component's rendered attribute from false to true using PPR, set the partialTrigger attribute of its parent component so the parent refreshes and in turn will render this component.
rootNodeRenderedbooleanYes Default Value: true

If the root node should be rendered or not. Defaults to true.
rowBandingIntervalintYes Default Value: 0

the interval between which the row banding alternates. For example, rowBandingInterval=1 would displayalternately banded rows in the Grid.
rowDisclosureListenerjavax.el.MethodExpressionOnly EL a method reference to an ExpansionListener
rowSelectionStringYes Valid Values: none, single, multiple
Default Value: none

whether rows in this table selectable. Valid values are "none", "single", "multiple"
rowsByDepthint[]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.
selectedRowKeysorg.apache.myfaces.trinidad.model.RowKeySetYes the selection state for this component.
selectionListenerjavax.el.MethodExpressionOnly EL a method reference to a selection listener
shortDescStringYes The short description of the component. This text is commonly used by user agents to display tooltip help text.
styleClassStringYes a CSS style class to use for this component.
summaryStringYes the summary of this table's purpose and structure for user agents rendering to non-visual media.
valueObjectYes the hierarchy of tree data - must be of type org.apache.myfaces.trinidad.model.TreeModel
varStringNo 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).
varStatusStringNo 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
  • "hierarchicalIndex" - returns an array containing the row indices of heirarchy of the currrent row, for e.g. [0,1,2] Please use this attribute with caution since it requires moving currency to calculate the row index for each parent collection in the tree hierarchy.
  • "hierarchicalLabel" - returns a string label representing the hierarchy of that row, for e.g. 1.1, 1.1.1. It should be noted that the labels are 1 based vs 0 based for rowIndex. Please use this attribute with caution since it requires moving currency to calculate the row index for each parent collection in the tree hierarchy.
verticalGridVisiblebooleanYes Default Value: true

if the vertical grid lines will be drawn.
widthStringYes the width of the table. The value must either be a number of pixels or a percentage - it is not a CSS width.