H-Tree or Tree Hierachy structure example.


Step:1 Create a New OAProject

Name the Default Package as xxtree.oracle.apps.fnd.treestr and click on next.

 

TreeStructure_in_OAF

 

Now Connect to Database and Click on Next

 

oaf hgrid

Now attach Dbc file and give Username and Password of apps.

oaf hgrid

Step:2

Create AM

Right Click on Project—->New

Click on ADF Business Component and create a Application Module

oaf hgrid

Click Next till Step 4

Give the package name as xxtree.oracle.apps.fnd.treestr.server   and specify your AM name and click next

7
Check on Generate java files and finish

oaf hgrid

Step:3

Now create View Object under xxtree.oracle.apps.fnd.treestr.server

OAF Hgrid

Specify the View Object name and click on next till step 5
Enter the SQL Query  Select * from xx_skills and click on next

OAF Hgrid
Now check on Generate Java file and click finish to create the VO.

TreeStructure_in_OAF

Now,Attach SkillVO to TreeStrAM

Shuffle the SkillVO to Data Model.

TreeStructure_in_OAF

Step4:

Create a Page Right click on Project–>New–>OAComponents–>Page

Specify the page name and Package name as xxtree.oracle.apps.fnd.treestr.webui

TreeStructure_in_OAF

In property inspector Set the AM Definition and  Name the window title and title for the PageLayoutRN
TreeStructure_in_OAF

Create a New Region of style Tree

MainRN–>TreeRN

the below structure will create after creating tree  Region

Image 1

TreeStructure_in_OAF

Select the NodeDef1 and in the property inspector attach view instance and View attribute

TreeStructure_in_OAF

Now attach  View Instance and View Attribute for childNode1

TreeStructure_in_OAF
Step:5

Now ,Create View Link under xxtree.oracle.apps.fnd.treestr.server

Specify the view link name and click next

TreeStructure_in_OAF

Select the source attribute Childid and destination attribute as Parentid and click on next.
TreeStructure_in_OAF
click Next
TreeStructure_in_OAF

Now set the view link properties
TreeStructure_in_OAF

Click on finish to Create the VL
Now attach the VL to childNode1 to View Link Accessor.

View Link Accessor  :ChildIdSkillVO

Ancestor Node:/xxtree/oracle/apps/fnd/treestr/webui/TreeStructurePG.TreeRN

TreeStructure_in_OAF

Step:6
In SkillVOImpl execute the query

Add the below Code.

TreeStructure_in_OAF

Write Below Code in treeStrAMImpl

TreeStructure_in_OAF

Step:7
Create a controller for the Page MainRN–>Set New Controller

TreeStructure_in_OAF

Name the package as xxtree.oracle.apps.fnd.treestr.webui
class name as TreeStructureCO

TreeStructure_in_OAF

Now call the method initTreeQuery written in AM in processRequest
TreeStructure_in_OAF

Rebuild the Page and run the page

TreeStructure_in_OAF