コード例 #1
0
 // 递归方法
 private static TreeNode getChildrenNode(
     String contextPath, List<ModuleGenInfo> list, ModuleGenInfo gnmk, boolean... checked) {
   TreeNode tree = getTree(contextPath, gnmk);
   // 递归标记
   for (int i = 0; i < list.size(); i++) {
     if (list.get(i).getParentid().equals(gnmk.getId())) {
       // 递归调用
       TreeNode rstree = getChildrenNode(contextPath, list, list.get(i), checked);
       // 递归标记
       tree.getChildren().add(rstree);
     }
   }
   return tree;
 }
コード例 #2
0
 private static TreeNode getTree(String contextPath, ModuleGenInfo gnmk, boolean... checked) {
   TreeNode tree = new TreeNode();
   tree.setId(gnmk.getId());
   tree.setText(gnmk.getModulename());
   tree.setQtip(gnmk.getDescription());
   if (gnmk.isLeaf()) {
     tree.setUrl(contextPath + gnmk.getForwardpage());
   } else {
     tree.setUrl("javascript:void(0);");
   }
   if (checked != null && checked.length > 0) {
     tree.setChecked(checked[0]);
   }
   return tree;
 }