📄 directoryview.java
字号:
DeptUserDb du = new DeptUserDb(); Vector v = du.getDeptsOfUser(new Privilege().getUser(request)); int vsize = v.size(); String[] depts = StrUtil.split(leaf.getDept(), ","); if (depts!=null) { boolean found = false; int len = depts.length; for (int i = 0; i < len; i++) { for (int j = 0; j < vsize; j++) { if (depts[i].equals(((DeptDb)v.elementAt(j)).getCode())) { found = true; break; } } if (found) break; } if (!found) return; } String code = leaf.getCode(); String name = leaf.getName(); int layer = leaf.getLayer(); String blank = ""; int d = layer-rootlayer; for (int i=0; i<d; i++) { blank += " "; } if (leaf.getChildCount()>0) { if (leaf.getType()==leaf.TYPE_LIST) out.print("<option value='" + code + "' style='COLOR: #0005ff'>" + blank + "╋ " + name + "</option>"); else out.print("<option value='not'>" + blank + "╋ " + name + "</option>"); } else { if (leaf.getType()==leaf.TYPE_LIST) out.print("<option value=\"" + code + "\" style='COLOR: #0005ff'>" + blank + " " + name + "</option>"); else out.print("<option value='not'>" + blank + " " + name + "</option>"); } } public void ShowDirectoryAsOptions(HttpServletRequest request, JspWriter out, Leaf leaf, int rootlayer) throws Exception { ShowLeafAsOption(request, out, leaf, rootlayer); Directory dir = new Directory(); Vector children = dir.getChildren(leaf.getCode()); int size = children.size(); if (size == 0) return; int i = 0; Iterator ri = children.iterator(); while (ri.hasNext()) { Leaf childlf = (Leaf) ri.next(); ShowDirectoryAsOptions(request, out, childlf, rootlayer); } } void ShowLeafAsOptionWithCode(JspWriter out, Leaf leaf, int rootlayer) throws Exception { String code = leaf.getCode(); String name = leaf.getName(); int layer = leaf.getLayer(); String description = leaf.getDescription(); String blank = ""; int d = layer-rootlayer; for (int i=0; i<d; i++) { blank += " "; } if (leaf.getChildCount()>0) { if (leaf.getType()==leaf.TYPE_NONE) out.print("<option value='" + code + "' style='COLOR: #0005ff'>" + blank + "╋ " + name + "</option>"); else out.print("<option value='" + code + "' style='COLOR: #0005ff'>" + blank + "├『" + name + "』</option>"); } else { if (leaf.getType()==leaf.TYPE_LIST) out.print("<option value=\"" + code + "\" style='COLOR: #0005ff'>" + blank + "├『" + name + "』</option>"); else out.print("<option value='" + code + "'>" + blank + "├『" + name + "』</option>"); } } public void ShowDirectoryAsOptionsWithCode(JspWriter out, Leaf leaf, int rootlayer) throws Exception { ShowLeafAsOptionWithCode(out, leaf, rootlayer); Directory dir = new Directory(); Vector children = dir.getChildren(leaf.getCode()); int size = children.size(); if (size == 0) return; int i = 0; Iterator ri = children.iterator(); while (ri.hasNext()) { Leaf childlf = (Leaf) ri.next(); ShowDirectoryAsOptionsWithCode(out, childlf, rootlayer); } } public void ShowFlowTypeAsOptionsWithCode(JspWriter out, Leaf leaf, int rootlayer) throws Exception { if (leaf.getType()==leaf.TYPE_NONE) ShowFlowTypeLeafAsOptionWithCode(out, leaf, rootlayer); Directory dir = new Directory(); Vector children = dir.getChildren(leaf.getCode()); int size = children.size(); if (size == 0) return; int i = 0; Iterator ri = children.iterator(); while (ri.hasNext()) { Leaf childlf = (Leaf) ri.next(); if (childlf.getType()==childlf.TYPE_NONE) ShowFlowTypeAsOptionsWithCode(out, childlf, rootlayer); } } void ShowFlowTypeLeafAsOptionWithCode(JspWriter out, Leaf leaf, int rootlayer) throws Exception { String code = leaf.getCode(); String name = leaf.getName(); int layer = leaf.getLayer(); String description = leaf.getDescription(); String blank = ""; int d = layer - rootlayer; for (int i = 0; i < d; i++) { blank += " "; } if (leaf.getChildCount() > 0) { out.print("<option value='" + code + "' style='COLOR: #0005ff'>" + blank + "╋ " + name + "</option>"); } else { out.print("<option value='" + code + "'>" + blank + "├『" + name + "』</option>"); } } public void ListFunc(HttpServletRequest request, JspWriter out, String target, String func, String tableClass, String tableClassMouseOn) throws Exception { ListTreeFunc(request, out, rootLeaf, true, target, func, tableClass, tableClassMouseOn); } void ListTreeFunc(HttpServletRequest request, JspWriter out, Leaf leaf, boolean isLastChild, String target, String func, String tableClass, String tableClassMouseOn) throws Exception { ShowLeafFunc(request, out, leaf, isLastChild, target, func, tableClass, tableClassMouseOn); Directory dir = new Directory(); Vector children = dir.getChildren(leaf.getCode()); int size = children.size(); if (size == 0) return; int i = 0; if (size > 0) out.print("<table id='childoftable" + leaf.getCode() + "' cellspacing=0 cellpadding=0 width='100%' align=center><tr><td>"); Iterator ri = children.iterator(); while (ri.hasNext()) { i++; Leaf childlf = (Leaf) ri.next(); boolean isLastChild1 = true; if (size != i) isLastChild1 = false; ListTreeFunc(request, out, childlf, isLastChild1, target, func, tableClass, tableClassMouseOn); } if (size > 0) out.print("</td></tr></table>"); } void ShowLeafFunc(HttpServletRequest request, JspWriter out, Leaf leaf, boolean isLastChild, String target, String func, String tableClass, String tableClassMouseOn) throws Exception { DeptUserDb du = new DeptUserDb(); Vector v = du.getDeptsOfUser(new Privilege().getUser(request)); int vsize = v.size(); Privilege privilege = new Privilege(); boolean canSee = false; if (privilege.isUserPrivValid(request, "admin.flow")) { LeafPriv lp = new LeafPriv(leaf.getCode()); if (lp.canUserSee(privilege.getUser(request))) { canSee = true; } } if (!canSee) { String[] depts = StrUtil.split(leaf.getDept(), ","); if (depts != null) { int len = depts.length; for (int i = 0; i < len; i++) { for (int j = 0; j < vsize; j++) { if (depts[i].equals(((DeptDb) v.elementAt(j)). getCode())) { canSee = true; break; } } if (canSee) break; } } else canSee = true; } if (!canSee) return; String code = leaf.getCode(); String name = leaf.getName(); int layer = leaf.getLayer(); if (!isLastChild) { Leaf brotherleaf = leaf.getBrother("down"); if (brotherleaf != null) { Vector r = new Vector(); leaf.getAllChild(r, leaf); int count = r.size(); if (count>0) { UprightLineNode uln = new UprightLineNode(layer, count); UprightLineNodes.addElement(uln); } } } int childcount = leaf.getChildCount(); String tableid = "table" + leaf.getCode(); out.println("<table id=" + tableid + " name=" + tableid + " class='" + tableClass + "' cellspacing=0 cellpadding=0 width='100%' align=center onMouseOver=\"this.className='" + tableClassMouseOn + "'\" onMouseOut=\"this.className='" + tableClass + "'\" border=0>"); out.println(" <tbody><tr>"); out.println(" <td height='13' align=left nowrap>"); for (int k = rootLeaf.getLayer(); k <= layer - 1; k++) { boolean isShowed = false; Iterator ir = UprightLineNodes.iterator(); while (ir.hasNext()) { UprightLineNode node = (UprightLineNode) ir.next(); if (node.getLayer() == k) { node.show(out, "images/i_plus-2.gif"); if (node.getCount() == 0) { UprightLineNodes.remove(node); } isShowed = true; break; } } if (!isShowed) out.println("<img src='' width=20 height=1>"); } if (leaf.getCode().equals(rootLeaf.getCode())) { out.println("<img onClick=\"ShowChild(this, '" + tableid + "')\" src='images/i_puls-root.gif' align='absmiddle'><img src='images/folder_01.gif' align='absmiddle'>"); } else { if (isLastChild) { if (childcount > 0) out.println("<img onClick=\"ShowChild(this, '" + tableid + "')\" src='images/i_plus2-2.gif' align='absmiddle'><img src='images/folder_01.gif' align='absmiddle'>"); else out.println("<img src='images/i_plus-2-3.gif' align='absmiddle'><img src='images/folder_01.gif' align='absmiddle'>"); } else { if (childcount > 0) out.println("<img onClick=\"ShowChild(this, '" + tableid + "')\" src='images/i_plus2-1.gif' align='absmiddle'><img src='images/folder_01.gif' align='absmiddle'>"); else out.println("<img src='images/i_plus-2-2.gif' align='absmiddle'><img src='images/folder_01.gif' align='absmiddle'>"); } } if (leaf.getType()==leaf.TYPE_NONE) out.print( "<a target='" + target + "' href='#' onClick=\"" + func + "('" + code + "', '" + name + "')\"><font color='#993300'>" + name + "</font></a>"); else out.print( "<a target='" + target + "' href='#' onClick=\"" + func + "('" + code + "', '" + name + "')\">" + name + "</a>"); out.print(" </td>"); out.println(" </tr></tbody></table>"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -