The TreeTable would expect data of this form:
Manager1
|-Employee1
|-Employee2
Manager2
|-Employee3
|-Employee4
In your above example RowModel class doesn't have any children associated with it. I will take a very generic Employee example and show you how you can work with TreeTable:
class Employee{
private String firstName;
private String lastName;
private List<Employee> directs;
Employee(String fName, String lName){
firstName = fName;
lastName = lName;
directs = new ArrayList<Employee>();
}
//Getters and setters for above
public void addDirect(Employee emp){
directs.add(emp);
}
}
Lets look at creating the data for the TreeTable:
class TreeTablePageModel{
List<Employee> managers = new ArrayList<Employee>();
ChildPropertyTreeModel treeModel;
public TreeTablePageModel(){
Employee mgr1 = new Employee("First","Manager");
Employee mgr2 = new Employee("Second","Manager");
Employee mgr3 = new Employee("Third","Manager");
Employee emp = new Employee("First","Sub_1");
mgr1.addDirect(emp);
emp = new Employee("First","Sub_2");
mgr1.addDirect(emp);
emp = new Employee("Second","Sub_1");
mgr2.addDirect(emp);
emp = new Employee("Second","Sub_2");
mgr2.addDirect(emp);
emp = new Employee("Third","Sub_1");
mgr3.addDirect(emp);
emp = new Employee("Third","Sub_2");
mgr3.addDirect(emp);
treeModel = new ChildPropertyTreeModel(managers,"directs");
}
public ChildPropertyTreeModel getTreeModel(){
return treeModel;
}
}
In the code above I am wrapping the List of my Employee objects into a ChildPropertyTreeModel and also passing it the name of the attribute using which the ADF component can obtain the values of its children. And in the JSP I would access the data as:
<af:treeTable rowBandingInterval="0" id="tt1" width="100%" value="#{viewScope.pageData.treeModel}">
<!-- add columns here -->
</af:treeTable>
And my managed bean declaration would be:
<managed-bean id="__7">
<managed-bean-name id="__5">pageData</managed-bean-name>
<managed-bean-class id="__8">com.im.popup.view.TreeTablePageModel</managed-bean-class>
<managed-bean-scope id="__6">view</managed-bean-scope>
</managed-bean>