Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers 10g (10.1.3.1.0) Part Number B25947-01 |
|
|
View PDF |
You can add ADF bindings to ADF Faces tree and tree table components. The ADF Faces tree
component displays a hierarchy of master-detail related data collections in a tree format. A databound ADF Faces tree displays multiple root nodes that are populated by a binding on a master data collection. Each node in the tree may have any number of branches, which are populated by bindings on detail data collections. Each node in the tree is indented to show its level in the hierarchy. The ADF tree component includes mechanisms for expanding and collapsing the tree. By default, the icon for each node in the tree is a folder; however, you can use your own icons for each level of nodes in the hierarchy. The ADF Faces tree table components display a hierarchy of master-detail collections in a table. For more information about master-detail relationships and trees, see Chapter 15, "Displaying Master-Detail Data".
To add ADF bindings to a tree or tree table, you drag a master data collection from the Data Control Palette and drop it on the tree tag displayed in the Structure window. For general tips about dropping items from the Data Control Palette onto the Structure window, see Section 21.3.1, "How to Add ADF Bindings Using the Data Control Palette".
To add ADF bindings to a tree component:
With the page displayed in the Design page of the visual editor, open the Structure window.
In the Design page of the visual editor, select the tree
tag.
JDeveloper simultaneously selects the corresponding tag in the Structure window. If the incorrect tag is selected, make the adjustment in the Structure window.
From the Data Control Palette, drag a data collection to the Structure window and drop it on the selected tree tag. The data collection you select should be the master collection, which will populate the root node of the tree.
On the Data Control Palette context menu, choose Bind Existing Tree.
Use the Tree Binding Editor to define the root and branch nodes of the tree. For information, see Section 15.4, "Using Trees to Display Master-Detail Objects".
Example 21-9 displays a tree before the ADF bindings are added. Notice that the value
attribute specifies the root node as users
, and the var
attribute specifies the first branch as service requests
.
Example 21-9 ADF Faces Tree Before ADF Bindings
<af:tree value="users" var="service requests"> <f:facet name="nodeStamp"> <h:outputText/> </f:facet> </af:tree>
Example 21-10 displays the same tree after the LoggedInUser
data collection from the SRDemo data control was dropped on it. The LoggedInUser
data collection will populate the root node, and the ServiceRequestsByStatus
collection was defined as a branch off the root nodes. The binding replaced the value
attribute with a binding on the LoggedInUser
binding object. The var
attribute now contains a value of node
, which provides access to the current node. The nodes themselves are defined in the page definition file.
Example 21-10 ADF Faces Tree After ADF Bindings Are Added
<af:tree value="#{bindings.LoggedInUser.treeModel}" var="node"> <f:facet name="nodeStamp"> <af:outputText value="#{node}"/> </f:facet> </af:tree>
In addition to adding the bindings to the tree, JDeveloper automatically adds several binding objects for the tree to the page definition file. The executables
element defines the iterator binding for the collection that populates the root node.
The bindings
element contains a tree binding object definition. The AttrNames
element lists all the attributes available in the collection, but only the attributes in the nodeDefinition
element are displayed in the tree. The Accesssors
element defines the view link accessor methods that will be used to retrieve the data that will populate the branches in the node.
For more information about trees and tree tables, see Chapter 15, "Displaying Master-Detail Data".