예제 #1
0
 @Override
 public List<ITreeView<?>> createTreeRoot() {
   List<ITreeView<?>> dpts = new ArrayList<ITreeView<?>>();
   for (Department dpt : list_Alldpt) {
     if (dpt.isAgency()) {
       dpts.add(new DepartmentView(dpt));
     }
   }
   return dpts;
 }
예제 #2
0
 @Override
 public void delete(Department t) throws Exception {
   if (getSelectionObj().getId() == t.getId()) {
     if (list_dpt.size() != 1) {
       MessageDialogManager.openWarning("请先删除子部门!");
       return;
     }
   }
   AppContext.getInstance().getDepartmentService().delete(t);
   this.prepData();
   this.retrieveTreeData();
 }
예제 #3
0
 @Override
 public List<Department> retrieveData() throws Exception {
   list_dpt.clear();
   list_Alldpt = AppContext.getInstance().getDepartmentService().getDepartments();
   List<Department> list_dt = list_Alldpt;
   if (this.getSelectionObj() == null) {
     list_dpt = (ArrayList<Department>) list_dt;
     return list_dt;
   } else {
     for (Department dpt : list_dt) {
       if (dpt.getParent() != null) {
         if (dpt.getParent().getId() == ((Department) getSelectionObj().getEntity()).getId()) {
           list_dpt.add(dpt);
         }
       }
       if (getSelectionObj().getId() == dpt.getId()) {
         list_dpt.add(0, dpt);
       }
     }
     return list_dpt;
   }
 }
예제 #4
0
 @Override
 public void update(Department t) {
   if (t.getParent() != null) {
     new DepartmentDialog(this.getViewSite().getShell(), t, t.getParent()).open();
   }
 }