Search in sources :

Example 1 with TreeNode

use of com.cdeledu.common.plugs.easyui.TreeNode in project wechat by dllwh.

the class SysMenuServiceImpl method getMenuEasyUITreeByParentId.

private List<TreeNode> getMenuEasyUITreeByParentId(int parentId) {
    List<TreeNode> results = Lists.newArrayList();
    try {
        List<SysMenu> rootMenuList = getMenuByParentCode(parentId);
        TreeNode treeNode = null;
        for (SysMenu sysMenu : rootMenuList) {
            int treeId = sysMenu.getId();
            treeNode = new TreeNode();
            treeNode.setId(treeId);
            treeNode.setText(sysMenu.getMenuName());
            if (hasChildren(treeId) && sysMenu.getType() == SysMenuType.CATALOG.getValue()) {
                treeNode.setState("closed");
                treeNode.setChildren(getMenuEasyUITreeByParentId(treeId));
            } else {
                treeNode.setIconCls("fa fa-leaf");
                treeNode.setState("open");
            }
            results.add(treeNode);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return results;
}
Also used : SysMenu(com.cdeledu.model.rbac.SysMenu) TreeNode(com.cdeledu.common.plugs.easyui.TreeNode)

Aggregations

TreeNode (com.cdeledu.common.plugs.easyui.TreeNode)1 SysMenu (com.cdeledu.model.rbac.SysMenu)1