Exemplo n.º 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()));
   }
 }
Exemplo n.º 2
0
 @SuppressWarnings("unchecked")
 public void doAfterCompose(Component comp) throws Exception {
   super.doAfterCompose(comp);
   userDeptList = (List<Long>) session.getAttribute("userDeptList");
   roleTree.setTreeitemRenderer(new RoleItemRenderer());
   loadTree();
   openTree(roleTree.getTreechildren());
   roleTree.addEventListener(
       Events.ON_SELECT,
       new EventListener() {
         public void onEvent(Event event) throws Exception {
           Treeitem it = roleTree.getSelectedItem();
           openEditWindow(it);
         }
       });
   ((Treeitem) roleTree.getTreechildren().getChildren().get(0)).setSelected(true);
   openEditWindow(roleTree.getSelectedItem());
 }