Java codeprivate String htmlString = "";
private void showTree(TreeNode rootNode) throws Exception{
String myID = rootNode.getNodeName();//得到本身id
if (myID==null||myID.equals(""))
throw new Exception("由于数据库连接失败或其他原因,无法取得系统参数树的根节点,请稍后再试!");
String pID = "";//得到父ID
if(rootNode.getDepth()==1) //如果是根节点
pID = "-1";
else
pID = rootNode.getParentNode().getNodeName();
String viewName = rootNode.getNodeViewName();
String isFolder = "1";//是否显示为文件夹
if(rootNode.isLeafNode())
isFolder = "";
String myUrl = "#";//链接
String title = "";
String target = "mainFrame";
myUrl = "/daSysConfig.do?functionName=QUERYDASYSCONFIG&functionData=" + rootNode.getNodeName();
htmlString += "d.add(";
htmlString += myID + ",";
htmlString += pID + ",";
htmlString += "'" + viewName + "'" + ",";
htmlString += "'" + isFolder + "'" + ",";
htmlString += "'" + myUrl + "'" + ",";
htmlString += "'" + title + "'" + ",";
htmlString += "'" + target + "'" + ");\n";
if(!rootNode.hasChildNode()){
return;
}
ArrayList arrayList_ChildNode = rootNode.getChildNodes();
for(int i=0; i
TreeNode childNode = (TreeNode)arrayList_ChildNode.get(i);
showTree(childNode);
}
}