Пример #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();
   }
 }