Exemple #1
0
 public void doAfterCompose(Component comp) throws Exception {
   super.doAfterCompose(comp);
   user = (WkTUser) session.getAttribute("user");
   tree.setTreeitemRenderer(
       new TreeitemRenderer() {
         public void render(Treeitem item, Object data) throws Exception {
           WkTDept d = (WkTDept) data;
           item.setValue(d);
           Treecell t1 = new Treecell(d.getKdName());
           Treerow row = new Treerow();
           row.appendChild(t1);
           item.appendChild(row);
         }
       });
   tree.addEventListener(
       Events.ON_SELECT,
       new EventListener() {
         public void onEvent(Event event) throws Exception {
           Treeitem item = tree.getSelectedItem();
           if (item != null) {
             WkTDept d = (WkTDept) item.getValue();
             openListWindow(d);
           }
         }
       });
   loadTree();
   if (user.getKdId() == 0) {
     openTree(tree.getTreechildren(), (WkTDept) departmentService.get(WkTDept.class, 1L));
   } else {
     openTree(
         tree.getTreechildren(), (WkTDept) departmentService.get(WkTDept.class, user.getKdId()));
   }
 }
Exemple #2
0
 private void loadTree() {
   List rlist = new ArrayList();
   rootDept = (WkTDept) departmentService.get(WkTDept.class, KdId);
   rlist.add(rootDept);
   westTree.setModel(new DepartmentTreeModel(rlist, departmentService, WkTDept.DANWEI));
   westTree.setTreeitemRenderer(
       new TreeitemRenderer() {
         public void render(Treeitem item, Object data) throws Exception {
           WkTDept dept = (WkTDept) data;
           item.setValue(data);
           item.setOpen(true);
           item.setLabel(dept.getKdName());
           WkTDept department = (WkTDept) userService.get(WkTDept.class, KdId);
           if (!department.getKdName().equals(dept.getKdName())) item.setOpen(false);
           if (selectDept != null
               && selectDept.getKdId().intValue() == dept.getKdId().intValue()) {
             item.setSelected(true);
           }
         }
       });
   westTree.addEventListener(
       Events.ON_SELECT,
       new EventListener() {
         public void onEvent(Event arg0) throws Exception {
           Treeitem titem = westTree.getSelectedItem();
           if (search.isDisabled()) {
             search.setDisabled(false);
           }
           selectDept = (WkTDept) titem.getValue();
           dlist = new ArrayList();
           addDept(westTree.getSelectedItem(), dlist);
           initPanel();
         }
       });
 }
Exemple #3
0
 /*
  * (non-Javadoc)
  *
  * @see org.zkoss.zul.TreeModel#getChild(java.lang.Object, int)
  */
 public Object getChild(Object arg0, int arg1) {
   if (arg0 instanceof XyUserrole) {
     XyUserrole urole = (XyUserrole) arg0;
     return departmentService.get(WkTDept.class, urole.getKdId());
   } else if (arg0 instanceof List) {
     List tlist = (List) arg0;
     return tlist.get(arg1);
   }
   return null;
 }
Exemple #4
0
 /**
  *
  * <li>功能描述:重新加载树。 void
  *
  * @author DaLei
  * @date 2010-3-29 11:15:58
  */
 public void loadTree() {
   List<WkTDept> rlist;
   rlist = departmentService.getChildDepartment(Long.parseLong("0"), WkTDept.QUANBU);
   //		if (user.getKdId() == 0) {
   //			rlist = departmentService.getChildDepartment(Long.parseLong("0"), WkTDept.QUANBU);
   //		} else {
   //			rlist = new ArrayList<WkTDept>();
   //			rlist.add((WkTDept) departmentService.get(WkTDept.class, user.getKdId()));
   //		}
   dtm = new DepartmentTreeModel(rlist, departmentService, WkTDept.QUANBU);
   tree.setModel(dtm);
 }
Exemple #5
0
  public void initWindow() {
    List deptlist = departmentService.findDeptByKdidAndType(0L, "1");
    deptList.setModel(new ListModelList(deptlist));
    deptList.setItemRenderer(
        new ListitemRenderer() {
          public void render(Listitem arg0, Object arg1) throws Exception {
            WkTDept dept = (WkTDept) arg1;
            arg0.setLabel(dept.getKdName());
            arg0.setValue(dept.getKdId());
          }
        });
    deptList.getItemAtIndex(0).setSelected(true);
    WkTDept department = (WkTDept) deptlist.get(0);
    KdId = department.getKdId();
    List rolelist = roleService.findByKdidAndKrname(KdId, "ѧÉú");
    if (rolelist.size() != 0) {
      WkTRole role = (WkTRole) rolelist.get(0);
      Role = role.getKrId();
    }
    search.setDisabled(true);
    loadTree();
    initPanel();
    WkTDept dept = (WkTDept) userService.get(WkTDept.class, KdId);
    yuan.setLabel(dept.getGradeName(WkTDept.GRADE_YUAN));
    xi.setLabel(dept.getGradeName(WkTDept.GRADE_XI));
    leaderlist.setItemRenderer(
        new ListitemRenderer() {
          public void render(Listitem item, Object data) throws Exception {
            final Student stu = (Student) data;
            Listcell c1 = new Listcell(item.getIndex() + 1 + "");
            Listcell c2 = new Listcell(stu.getStId());
            Listcell c3 = new Listcell(stu.getUser().getKuName());
            Listcell c4 = new Listcell(stu.getStClass());
            Listcell c5 = new Listcell(stu.getUser().getXiDept());
            Listcell c6 = new Listcell(stu.getUser().getYuDept());
            Listcell c7 = new Listcell(stu.getUser().getKuPasswd());

            item.appendChild(c1);
            item.appendChild(c2);
            item.appendChild(c3);
            item.appendChild(c4);
            item.appendChild(c5);
            item.appendChild(c6);
            item.appendChild(c7);
          }
        });
  }