public void TraversalChildrenAndSet(Vector<Node> all) { for (int i = 0; i < all.size(); i++) { Node node = all.get(i); if (node.getParentid().equals(id)) { TreeNodeJson child = getJsonObjByNode(node); child.setIconCls("icon-db"); // 递归设置所有的儿子节点 child.TraversalChildrenAndSet(all); getChildren().add(child); } } }
public static TreeNodeJson getJsonObjByNode(Node node) { TreeNodeJson json = new TreeNodeJson(); json.setId(node.getNodeid()); json.setText(node.getName()); return json; }