1 package projectmanagement.presentation.employees; 2 3 import projectmanagement.presentation.*; 4 import projectmanagement.spec.employee.*; 5 import com.lutris.appserver.server.httpPresentation.*; 6 import org.enhydra.xml.xmlc.XMLObject; 7 8 import org.w3c.dom.*; 9 import org.w3c.dom.html.*; 10 11 17 public class Administering extends BasePO { 18 19 22 protected int getRequiredAuthLevel() { 23 return 1; 24 } 25 26 29 public XMLObject handleDefault() 30 throws HttpPresentationException { 31 32 33 34 AdministeringHTML page = new AdministeringHTML(); 35 36 42 43 44 try { 45 EmployeeManager employeeManager = EmployeeManagerFactory.getEmployeeManager("projectmanagement.business.employee.EmployeeManagerImpl"); 46 Employee[] employees=employeeManager.getAllEmployees(); 47 48 49 HTMLTableElement table = page.getElementTblEmployees(); 51 52 if (employees!=null) { 53 for (int i=0; i<employees.length; i++) { 54 HTMLTableRowElement htmlRE=createNewRow(page,employees[i]); 56 table.appendChild(htmlRE); 58 59 } 60 } 61 62 table.removeChild(page.getElementTemplateRow()); 64 69 } catch(NullPointerException ex) { 70 } catch(Exception ex) { 71 this.writeDebugMsg("Error populating list of employees: " + ex); 72 throw new ProjectManagementPresentationException("Error getting list of employees: ", ex); 73 } 74 75 76 return page; 78 } 79 80 83 private HTMLTableRowElement createNewRow(AdministeringHTML administeringHTML, 84 Employee employee) { 85 86 String employeeID=""; 87 88 try { 89 employeeID=employee.getHandle(); 90 administeringHTML.setTextTxtFirstName(employee.getFirstName()); 91 administeringHTML.setTextTxtLastName(employee.getLastName()); 92 administeringHTML.setTextTxtMobilePhone(employee.getMobilePhone()); 93 administeringHTML.setTextTxtEmail(employee.getEmail()); 94 } catch (Exception ex) {} 95 96 HTMLImageElement detailsImg=administeringHTML.getElementImgDetails(); 98 detailsImg.setName(employeeID); 99 100 HTMLImageElement modifyImg=administeringHTML.getElementImgModify(); 102 modifyImg.setName(employeeID); 103 104 HTMLImageElement deleteImg=administeringHTML.getElementImgDelete(); 106 deleteImg.setName(employeeID); 107 108 HTMLTableRowElement row=(HTMLTableRowElement)administeringHTML. 109 getElementTemplateRow().cloneNode(true); 110 111 return row; 112 } 113 114 } 115 116 | Popular Tags |