How to get treedata correctly

Hi all, i am using apache tomahawk tree2 component and i get the tree item from DB. The code like:

public TreeNode getTreeData(){

List list = getMenuList();

TreeNode treeData =new TreeNodeBase("foo-folder","Inbox",false);

Iterator it = list.iterator();

HashMap menuTable =new HashMap();

while (it.hasNext()){

Eosmenu item = (Eosmenu) it.next();

String label = item.getMenuLabel();

boolean isLeaf = item.getIsLeaf() !=null

&& item.getIsLeaf().equalsIgnoreCase("Y");

int level = item.getMenuLevel();

String menuId = item.getMenuId();

String parentsID = item.getParentsId();

TreeNodeBase node =new TreeNodeBase();

if(isLeaf){

node.setType("document");

}else{

node.setType("bar-folder");

}

node.setDescription(label);

node.setLeaf(isLeaf);

menuTable.put(menuId, node);

if (level == 1){

treeData.getChildren().add(node);

}else{

TreeNodeBase pItem = (TreeNodeBase) menuTable.get(parentsID);

if (pItem !=null)

pItem.getChildren().add(node);

}

}

return treeData;

}

This works well only when the items are in the front of their chirdren. How to let it works correctly when the data in the database like :

idmenuid-menunamemenulevelparentid

1-bbb-2a

2-aaa-10

[2357 byte] By [rengaraja] at [2007-11-26 16:49:47]
# 1
anybody help me.
renga_muralia at 2007-7-8 23:17:19 > top of Java-index,Core,Core APIs...