X
  • ADF
    May 3, 2012

Construct ADF Master Detail Tree using EJB Datacontrol Objects programatically

This article describes the creation of master detail Tree
using EJB Datacontrol Objects.

Use Case Description

Construct
ADF Tree using Employees & Departments objects.It is straight
forward to build a tree when foreign key relationship exists between
the objects. For cases where no foreign key relationships exist, we can
use this technique to programatically construct the tree in the view
layer.

Implementation steps

Let us suppose that we have
created Java EE Web Application with Entities from Employees & Departments table
.Also add 'ADF Faces Components 11' under ViewController->project
properties-> JSP Tag Libraries.

Then we will create Stateless Session Bean and and generate data control for the Stateless Session Bean.

Create Tree.jspx page .Goto its page definition overview editor & create table Binding for departmentsFindAll

Similarly create table binding for employeesFindAll.

Now we will create 2 Beans:

TreeItem.java
 
- Defines Tree structure
DisplayTree.java
 Managed bean - Programatically construct tree node items

Copy this code in Tree.jspx source page:

<af:tree var="node" value="#{DisplayTree.model}">
   <f:facet name="nodeStamp">
    <af:outputText id="l1" value="#{node.text}"/>
    </f:facet>
</af:tree>

Run the page & it displays Departments->Employees Tree .


Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.