In the context menu, choose Trees ADF Tree. In the Root Data Source dropdown list, select the accessor returned collection that Click the Add icon to add the root data source you selected to the Tree Level In the Tree Level Rules list, select the data so

Displaying Master-Detail Data 5-9 ■ The accessor returned collection that populates that node level ■ The attributes from the accessor returned collection that are displayed at that node level To display master-detail objects in a tree: 1. Drag the master object from the Data Controls panel, and drop it onto the page. This should be the master data that will represent the root level of the tree.

2. In the context menu, choose Trees ADF Tree.

JDeveloper displays the Edit Tree Binding dialog, as shown in Figure 5–5 . You use the binding editor to define a rule for each level that you want to appear in the tree. Figure 5–5 Edit Tree Binding Dialog

3. In the Root Data Source dropdown list, select the accessor returned collection that

will populate the root node level. This will be the master data collection. By default, this is the same collection that you dragged from the Data Controls panel to create the tree, which was a master collection.

4. Click the Add icon to add the root data source you selected to the Tree Level

Rules list. Tip: If you don’t see the accessor returned collection you want in the Root Data Source list, click the Add button. In the Add Data Source dialog, select a data control and an iterator name to create a new data source. 5-10 Java EE Developers Guide for Oracle Application Development Framework

5. In the Tree Level Rules list, select the data source you just added.

6. Select an attribute in the Available Attributes list and move it to the Display

Attributes list. The attribute will be used to display nodes at the master level. After defining a rule for the master level, you must next define a second rule for the detail level that will appear under the master level in the tree.

7. To add a second rule, click the Add icon above the Tree Level Rules list.

A detail data source should appear automatically under the master data source, as shown in Figure 5–6 . Figure 5–6 Master-Detail Tree Level Rules For example, if you specified ProductFindAll as the master root data source, WarehouseStockLevelList will automatically appear underneath in the Tree Level Rules list, because the two data sources share a master-detail relationship. If you are creating a tree with a recursive master-detail hierarchy, then you only need to define a rule that specifies a data source with a self-accessor. A recursive tree displays root nodes based on a single collection and displays the child nodes from the attributes of a self-accessor that recursively fetches data from that collection. The recursive tree differs from a typical master-detail tree because it requires only a single rule to define the branches of the tree. A recursive data source should display the data source followed by the name of the self-accessor in brackets, as shown in Figure 5–7 . Figure 5–7 Recursive Tree-Level Rule For example, in a collection defined by EmployeesView, the root node of each branch could be specified by the ManagerId for the employee, and the child nodes of the same branch would then be the employees who are related to the ManagerId , as specified by the self-accessor DirectReports.

8. Click OK.