private void selectCodeInTree(Tree tree, Treeitem treeItem, String code) { // tree.setSelectedItem(null); // Collection<Treeitem> items = null; if (treeItem != null) { // items = treeItem.getChildren(); /*TODO for (Component comp : treeItem.getChildren()) { logger.debug("Component, comp: " + comp.getClass().getCanonicalName()); }*/ } else { if (tree != null) { logger.debug("selectCodeInTree, code: " + code); // items = tree.getItems(); for (Treeitem ti : tree.getItems()) { logger.debug("Treeitem, value: " + ti.getValue().getClass().getCanonicalName()); CodeSystemEntityVersion csev = ti.getValue(); if (csev.getCodeSystemConcepts().get(0).getCode().equals(code)) { // item found tree.setSelectedItem(ti); return; } selectCodeInTree(tree, ti, code); } } } }
public INode getSelectedNode() { Treeitem item = getSelectTree().getSelectedItem(); if (item == null) return null; EccTreeItem itemNode = (EccTreeItem) item.getValue(); INode node = itemNode.getValue(); if (!node.getType().equals(INode.MONITOR)) return null; return node; }
private void addDept(Treeitem item, List dlist) { if (item.getTreechildren() == null) { dlist.add(item.getValue()); return; } List clist = item.getTreechildren().getChildren(); for (int i = 0; i < clist.size(); i++) { Treeitem it = (Treeitem) clist.get(i); addDept(it, dlist); } }
/** * * <li>功能描述:打开编辑角色窗口。 * * @param it void * @author DaLei */ private void openEditWindow(Treeitem it) { WkTRole r = (WkTRole) it.getValue(); Executions.getCurrent().setAttribute("deptList", userDeptList); if (r.getKrPid().intValue() > 0) { Component c = creatTab("roleEdit", "角色管理", "/admin/system/role/role.zul", rolePanel); if (c != null) { rWindow = (RoleEditWindow) c; } rWindow.initWindow(r); } else { Component c = creatTab("roleEdit", "角色管理", "/admin/system/role/roleGroup.zul", rolePanel); if (c != null) { rgWindow = (RoleGroupEditWindow) c; } rgWindow.initWindow(r); } }
/** * * <li>功能描述:将树节点展开并默认打开某个部门用户。 * * @param chi * @param dept void * @author DaLei */ @SuppressWarnings("unchecked") private void openTree(Treechildren chi, WkTDept dept) { if (chi == null) return; List<Treeitem> tlist = chi.getChildren(); for (int i = 0; i < tlist.size(); i++) { Treeitem item = (Treeitem) tlist.get(i); WkTDept d = (WkTDept) item.getValue(); if (d.getKdId().intValue() == dept.getKdId().intValue()) { tree.setSelectedItem(item); if (uWindow == null) { openListWindow(d); } else { uWindow.initWindow(d); } } if (d.getKdLevel() == WkTDept.GRADE_SCH.intValue()) item.setOpen(true); else item.setOpen(false); openTree(item.getTreechildren(), dept); } }