@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(); }
@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; } }