private void listTreeNodes(List<TreeNode> list) throws Exception { JSONWriter writer = new JSONWriter(); List<TreeNodeDTO> dtos = new ArrayList<TreeNodeDTO>(); for (TreeNode treeNode : list) { dtos.add(generateDTO(treeNode)); } Collections.sort(dtos); String treeString = writer.write(dtos); response.getWriter().print(treeString); System.out.println(treeString); }
private void listTreeNodesWithoutSub(List<TreeNode> list) throws Exception { JSONWriter writer = new JSONWriter(); List<TreeNodeDTO> dtos = new ArrayList<TreeNodeDTO>(); for (TreeNode treeNode : list) { TreeNodeDTO treeNodeDTO = new TreeNodeDTO(); treeNodeDTO.setId(treeNode.getId()); treeNodeDTO.setOrderId(treeNode.getOrderId()); treeNodeDTO.setName(treeNode.getNodeName()); treeNodeDTO.setExpanded(false); treeNodeDTO.set__viewicon(true); dtos.add(treeNodeDTO); } Collections.sort(dtos); String treeString = writer.write(dtos); response.getWriter().print(treeString); System.out.println(treeString); }