1 package projectmanagement.presentation.projects; 2 3 import projectmanagement.presentation.*; 4 import projectmanagement.spec.project.*; 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 private static String CUSTOMER = "customer"; 23 24 27 protected int getRequiredAuthLevel() { 28 return 2; 29 } 30 31 34 public XMLObject handleDefault() 35 throws HttpPresentationException { 36 37 AdministeringHTML page = new AdministeringHTML(); 38 39 String customer = this.getComms().request.getParameter(CUSTOMER); 40 if (customer!=null && customer.length()==0) { 41 customer=null; 42 } 43 44 String errorMsg = this.getSessionData().getAndClearUserMessage(); 45 50 51 52 try { 53 ProjectManager projectManager = ProjectManagerFactory.getProjectManager("projectmanagement.business.project.ProjectManagerImpl"); 54 Project[] projects=projectManager.getAllProjectsForCustomer(customer); 55 56 HTMLTableElement table = page.getElementTblProjects(); 58 59 60 if (projects!=null) { 61 for (int i=0; i<projects.length; i++) { 62 HTMLTableRowElement htmlRE=createNewRow(page,projects[i]); 64 table.appendChild(htmlRE); 66 } 67 } 68 table.removeChild(page.getElementTemplateRow()); 70 71 75 } catch(NullPointerException ex) { 76 77 } catch(Exception ex) { 78 this.writeDebugMsg("Error populating list of projects: " + ex); 79 throw new ProjectManagementPresentationException("Error getting list of projects: ", ex); 80 } 81 82 83 84 return page; 86 } 87 88 91 private HTMLTableRowElement createNewRow(AdministeringHTML administeringHTML, 92 Project project) { 93 94 String projectID=""; 95 96 try { 97 projectID=project.getHandle(); 98 administeringHTML.setTextTxtCustomer(project.getCustomer().getCompanyName()); 99 administeringHTML.setTextTxtName(project.getName()); 100 administeringHTML.setTextTxtMoneyPerHour(String.valueOf(project.getMoneyPerHour())); 101 } catch (Exception ex) {} 102 103 HTMLImageElement detailsImg=administeringHTML.getElementImgDetails(); 105 detailsImg.setName(projectID); 106 107 HTMLImageElement modifyImg=administeringHTML.getElementImgModify(); 109 modifyImg.setName(projectID); 110 111 HTMLImageElement deleteImg=administeringHTML.getElementImgDelete(); 113 deleteImg.setName(projectID); 114 115 HTMLTableRowElement row=(HTMLTableRowElement)administeringHTML. 116 getElementTemplateRow().cloneNode(true); 117 118 return row; 119 } 120 121 } 122 123 | Popular Tags |