// ---------------------------------------------------------------// public void projectModifier( String Mode, Project project, HashMap<String, ArrayList<Task>> taskManager) throws SQLException { int proid = -7777; Connection conn = null; PreparedStatement prepStmt = null; try { conn = select(); if (Mode.equals("New Project")) proid = insertProject(project, conn); else proid = editProject(project, conn); project.setProjectID(proid); for (Task ts : taskManager.get("toInsert")) { addTasktoProject(project.getProjectID(), ts, conn); } for (Task ts : taskManager.get("toDelete")) { deleteTask(ts, conn); } for (Task ts : taskManager.get("toEdit")) { updateTasktoProject(ts, conn); } } finally { if (prepStmt != null) conn.close(); if (conn != null) conn.close(); } }
public void getTestCase() throws Exception { TestCase testCaseObj = tmsManager.getTestCase("15"); System.out.println(testCaseObj.getTestCaseId()); System.out.println(testCaseObj.getTestCaseDescription()); System.out.println(testCaseObj.getTestCasePhase()); Project projectObj = testCaseObj.getProjectObj(); System.out.println(projectObj.getProjectId()); User userObj = testCaseObj.getUserObj(); System.out.println(userObj.getUserId()); Activity activityObj = testCaseObj.getActivityObj(); System.out.println(activityObj.getActivityId()); System.out.println(testCaseObj.getExpectedBehaviour()); }
private void addgoalinfoActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addgoalinfoActionPerformed // TODO add your handling code here: String[] types = {"Product", "Project"}; JComboBox typeList = new JComboBox(types); typeList.setSelectedIndex(0); JTextArea description = new JTextArea(); description.setRows(5); description.setColumns(10); description.setLineWrap(true); JScrollPane pane = new JScrollPane(description); Object[] message = { "Goal type:", typeList, "Goal Description:", pane, }; int option = JOptionPane.showConfirmDialog( this, message, "Enter Goal Information", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { Goal goal = new Goal(); goal.setGoalDesc(description.getText()); goal.setGoalType(typeList.getSelectedItem().toString()); currentProject.getGoals().add(goal); goalmodel.addElement(typeList.getSelectedItem().toString() + " " + description.getText()); goallist.setModel(goalmodel); } } // GEN-LAST:event_addgoalinfoActionPerformed
/* ---------------------------------------------- CreateTest phase -------------------------------------*/ public void createTestPhase() throws Exception { testPhaseObj.setPhaseId("101"); testPhaseObj.setPhaseName("System test"); projectObj.setProjectId("003"); testPhaseObj.setProjectObj(projectObj); testPhaseObj.setDescription(" this is phase System test"); testPhaseObj.setIsAlive(0); testPhaseObj.setTimeStamp("null"); System.out.println(tmsManager.createTestPhase(testPhaseObj)); }
/*--------------------------------------------UpdateTestPhase---------------------------------------*/ public void updateTestPhase() throws Exception { testPhaseObj.setPhaseId("101"); testPhaseObj.setPhaseName("functional testing"); projectObj.setProjectId("002"); testPhaseObj.setProjectObj(projectObj); testPhaseObj.setDescription("test phase function test under process"); testPhaseObj.setIsAlive(1); testPhaseObj.setTimeStamp("null"); System.out.println(tmsManager.updateTestPhase(testPhaseObj)); }
public void createTestCase() throws Exception { testCaseObj.setTestCaseId("15"); testCaseObj.setTestCaseDescription("this s Next testcase Description"); testCaseObj.setTestCasePhase("normal "); Project projectObj = new Project(); projectObj.setProjectId("2"); testCaseObj.setProjectObj(projectObj); User userObj = new User(); userObj.setUserId("123"); testCaseObj.setUserObj(userObj); Activity activityObj = new Activity(); activityObj.setActivityId("001"); testCaseObj.setActivityObj(activityObj); testCaseObj.setExpectedBehaviour("Bad"); System.out.println(tmsManager.createTestCase(testCaseObj)); }
/*--------------------------------------------ViewTestPhase-----------------------------------------*/ public void getTestPhase() throws Exception { testPhaseObj.setPhaseId("101"); TestPhase phaseObj = tmsManager.getTestPhase(testPhaseObj.getPhaseId()); System.out.println("phase_id: " + phaseObj.getPhaseId()); System.out.println("phase_name: " + phaseObj.getPhaseName()); projectObj = phaseObj.getProjectObj(); System.out.println("project_id: " + projectObj.getProjectId()); System.out.println("description: " + phaseObj.getDescription()); System.out.println("is_alive: " + phaseObj.getIsAlive()); System.out.println("time_stamp: " + phaseObj.getTimeStamp()); }
// ---------------------------------------------------------------// public void deleteProject(Project project) throws SQLException { Connection conn = null; PreparedStatement prepStmt = null; try { conn = select(); String sql = "DELETE FROM PROJECTS WHERE PROJ_ID = " + String.valueOf(project.getProjectID()); prepStmt = conn.prepareStatement(sql); prepStmt.executeQuery(); } finally { if (prepStmt != null) conn.close(); if (conn != null) conn.close(); } return; }
private void addteammemberActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addteammemberActionPerformed JTextField fname = new JTextField(); JTextField lname = new JTextField(); JTextField position = new JTextField(); Object[] message = { "First Name:", fname, "Last Name:", lname, "Position:", position, }; int option = JOptionPane.showConfirmDialog( this, message, "Enter Team Member Information", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { Person tm = new Person(); tm.setFirstName(fname.getText()); tm.setLastName(lname.getText()); tm.setPosition(position.getText()); currentProject.getTeamMembers().add(tm); teammodel.addElement(tm.getFirstName() + " " + tm.getLastName() + " " + tm.getPosition()); teamlist.setModel(teammodel); } } // GEN-LAST:event_addteammemberActionPerformed
// Computation unit = machine_dependent_factor (SU value) * cpu seconds; // Computation units/3600 seconds per hour = Service Units; protected void sumSUCharge( ProcessorTypeArrayList ptlist, ProjectHashMap projecthm, PrincipalInvestigatorHashMap pihm, UtilizationArray ua, Map<String, Float> ghm, Map<String, Float> ohm) { Project p; PrincipalInvestigator pi; // Lookup host information ProcessorType pt = ptlist.lookupProcessorType(hostname); Float suCharge = 0.0F; String cluster = ""; if (pt == null) { suCharge = 1.0F; cluster = "katana"; System.err.println("Error: SU charge arbitrarily set to 1.0 for host: " + hostname); System.err.println("Error: Cluster arbitrarily set to katana for host: " + hostname); } else { suCharge = pt.suCharge; cluster = pt.cluster; } // Do per record service unit calculation Float computationUnitsPerAcctRecord = (suCharge * cpu); // In earth-systems-only mode, only look at Earth Systems project groups // so that utilization totals can be compared to PI totals // apples to apples if (!Global.earthSystemsOnly || projecthm.containsKey(group)) { // Do per cluster utilitzation calculations Integer index = ua.calcIntervalArrayIndex(end_time * 1000L); if (cluster.equals("scluster")) { ua.sclusterLineGraphValues[index] += computationUnitsPerAcctRecord; ua.sclusterServiceUnits += computationUnitsPerAcctRecord; } else { ua.katanaLineGraphValues[index] += computationUnitsPerAcctRecord; ua.katanaServiceUnits += computationUnitsPerAcctRecord; } } if (projecthm.containsKey(group)) { // Sum service units per project p = projecthm.get(group); // In the error check, project = group and project list = project hashmap if (p == null) { System.err.println("Error: Unable to find project " + "\"" + group + "\" in project list"); return; } p.suSum += computationUnitsPerAcctRecord; projecthm.totalServiceUnits += computationUnitsPerAcctRecord; // Sum service units per PI pi = pihm.get(p.piOwnerUserID); // In the error check, and PI list = PI hashmap if (pi == null) { System.err.println("Error: Unable to find PI " + "\"" + p.piOwnerUserID + "\" in PI list"); return; } pi.suSum += computationUnitsPerAcctRecord; pihm.totalServiceUnits += computationUnitsPerAcctRecord; // Print messages if (Global.debug > 1) { System.out.printf( "SCLUSTER group: %8s cpu: %8.2f sucharge: %8.2f gpsum: %f\n", group, cpu, suCharge, projecthm.get(group).suSum); } } else if (Global.debug > 1) { System.out.printf("Other group: %8s cpu: %8.2f sucharge: %8.2f\n", group, cpu, suCharge); } // Sum group, owner SU Float groupSUSum = 0.0F; if (ghm.containsKey(group)) { groupSUSum = ghm.get(group); ghm.remove(group); } ghm.put(group, computationUnitsPerAcctRecord + groupSUSum); Float ownerSUSum = 0.0F; if (ohm.containsKey(owner)) { ownerSUSum = ohm.get(owner); ohm.remove(owner); } ohm.put(owner, computationUnitsPerAcctRecord + ownerSUSum); }
private void addeffortActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addeffortActionPerformed // TODO add your handling code here: if (requirementmodel.isEmpty()) { JOptionPane.showMessageDialog( this, "You must create a requirement before entering efforts", "First create requirement", INFORMATION_MESSAGE); return; } String[] phases = { "Project Management", "Requirements Analysis", "Design", "Coding", "Testing" }; JComboBox typeList = new JComboBox(phases); typeList.setSelectedIndex(0); List<String> reqs = new ArrayList(); for (int i = 0; i < currentProject.getRequirements().size(); i++) { reqs.add(currentProject.getRequirements().get(i).getRequirementDescription()); } JComboBox reqList = new JComboBox(reqs.toArray()); JTextField date = new JTextField(); JTextField hours = new JTextField(); Object[] message = { "For requirement:", reqList, "During SDLC Phase:", typeList, "On Date:", date, "Hours:", hours, }; int option = JOptionPane.showConfirmDialog( this, message, "Enter Effort Information", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { Effort effort = new Effort(); effort.setEffortDate(date.getText()); effort.setEffortDevPhase(typeList.getSelectedItem().toString()); effort.setEffortHours(Integer.parseInt(hours.getText())); // effort.setRequirementID(reqList.getSelectedIndex()); for (int i = 0; i < currentProject.getRequirements().size(); i++) { if (currentProject .getRequirements() .get(i) .getRequirementDescription() .equals(reqList.getSelectedItem().toString())) { effort.setRequirementID(i); effort.setRequirementDesc( currentProject.getRequirements().get(i).getRequirementDescription()); } } currentProject.getEfforts().add(effort); effortmodel.addElement( "For req:" + " " + reqList.getSelectedItem() + " " + typeList.getSelectedItem() + " " + date.getText() + hours.getText()); effortlist.setModel(effortmodel); } } // GEN-LAST:event_addeffortActionPerformed
private void saveActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_saveActionPerformed // TODO add your handling code here: currentProject.setProjectName(projectname.getText()); currentProject.setProjectDescription(projectdescription.getText()); try { File file = new File("projects.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); } // true = append file FileWriter fileWritter = new FileWriter(file.getName(), true); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write( currentProject.getProjectID() + " " + currentProject.getProjectName() + " " + currentProject.getProjectDescription()); for (int i = 0; i < currentProject.getRequirements().size(); i++) { bufferWritter.write( currentProject.getRequirements().get(i).getRequirementID() + " " + currentProject.getRequirements().get(i).getRequirementDescription()); if (currentProject.getRequirements().get(i).getIsFunctionalRequirement() == false) { bufferWritter.write(" non-functional"); } else bufferWritter.write(" functional"); } for (int i = 0; i < currentProject.getTeamMembers().size(); i++) { bufferWritter.write( currentProject.getTeamMembers().get(i).getPersonID() + " " + currentProject.getTeamMembers().get(i).getFirstName() + " " + currentProject.getTeamMembers().get(i).getLastName() + " " + currentProject.getTeamMembers().get(i).getPosition()); } for (int i = 0; i < currentProject.getEfforts().size(); i++) { bufferWritter.write( currentProject.getEfforts().get(i).getEffortID() + " " + currentProject.getEfforts().get(i).getRequirementID() + " " + currentProject.getEfforts().get(i).getEffortDevPhase() + " " + currentProject.getEfforts().get(i).getEffortDate() + " " + currentProject.getEfforts().get(i).getEffortHours()); } for (int i = 0; i < currentProject.getGoals().size(); i++) { bufferWritter.write( currentProject.getGoals().get(i).getGoalID() + " " + currentProject.getGoals().get(i).getGoalType() + " " + currentProject.getGoals().get(i).getGoalDesc()); } for (int i = 0; i < currentProject.getRisks().size(); i++) { bufferWritter.write( currentProject.getRisks().get(i).getRiskID() + " " + currentProject.getRisks().get(i).getRiskName() + " " + currentProject.getRisks().get(i).getRiskStatus()); } bufferWritter.close(); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Couldn't save", "Didn't work", INFORMATION_MESSAGE); } JOptionPane.showMessageDialog( this, "Project Successfully saved", "Success", INFORMATION_MESSAGE); try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection( "jdbc:mysql://127.0.0.1:3306/projectmanagementsystem?zeroDateTimeBehavior=convertToNull", "root", "password"); String query = "insert into project(projectname, projectdesc) values (?, ?)"; PreparedStatement pst = con.prepareStatement(query); pst.setString(1, currentProject.getProjectName()); pst.setString(2, currentProject.getProjectDescription()); pst.executeUpdate(); String query2 = "select idproject from project where projectdesc = ?"; PreparedStatement pst2 = con.prepareStatement(query2); String desc = currentProject.getProjectDescription(); pst2.setString(1, desc); ResultSet rs = pst2.executeQuery(); int id = 0; if (rs.next()) { id = rs.getInt("idproject"); } System.out.println(id); for (int i = 0; i < currentProject.getTeamMembers().size(); i++) { String query3 = "insert into teammember(firstname,lastname,position,teammember_FK) values (?,?,?,?)"; PreparedStatement pst3 = con.prepareStatement(query3); pst3.setString(1, currentProject.getTeamMembers().get(i).getFirstName()); pst3.setString(2, currentProject.getTeamMembers().get(i).getLastName()); pst3.setString(3, currentProject.getTeamMembers().get(i).getPosition()); pst3.setInt(4, id); pst3.executeUpdate(); } for (int i = 0; i < currentProject.getGoals().size(); i++) { String query3 = "insert into goal(goaldesc,goaltype,goal_FK) values (?,?,?)"; PreparedStatement pst3 = con.prepareStatement(query3); pst3.setString(1, currentProject.getGoals().get(i).getGoalDesc()); pst3.setString(2, currentProject.getGoals().get(i).getGoalType()); pst3.setInt(3, id); pst3.executeUpdate(); } for (int i = 0; i < currentProject.getRequirements().size(); i++) { int functional = 0; if (currentProject.getRequirements().get(i).getIsFunctionalRequirement() == true) { functional = 1; } String query3 = "insert into requirement(isFunctionalRequirement,requirementdesc,requirement_FK) values (?,?,?)"; PreparedStatement pst3 = con.prepareStatement(query3); pst3.setInt(1, functional); pst3.setString(2, currentProject.getRequirements().get(i).getRequirementDescription()); pst3.setInt(3, id); pst3.executeUpdate(); } for (int i = 0; i < currentProject.getRisks().size(); i++) { String query3 = "insert into risk(riskname,riskstatus,risk_FK) values (?,?,?)"; PreparedStatement pst3 = con.prepareStatement(query3); pst3.setString(1, currentProject.getRisks().get(i).getRiskName()); pst3.setString(2, currentProject.getRisks().get(i).getRiskStatus()); pst3.setInt(3, id); pst3.executeUpdate(); } for (int i = 0; i < currentProject.getEfforts().size(); i++) { String query4 = "select idrequirement from requirement where requirementdesc = ?"; PreparedStatement pst4 = con.prepareStatement(query4); String desc2 = currentProject.getEfforts().get(i).getRequirementDesc(); pst4.setString(1, desc2); ResultSet rs2 = pst4.executeQuery(); int reqid = 0; if (rs.next()) { reqid = rs2.getInt("idrequirement"); } System.out.println(reqid); String query3 = "insert into effort(effortdate,efforthours,effortdevphase,effort_FK) values (?,?,?,?)"; PreparedStatement pst3 = con.prepareStatement(query3); pst3.setString(1, currentProject.getEfforts().get(i).getEffortDate()); pst3.setInt(2, currentProject.getEfforts().get(i).getEffortHours()); pst3.setString(3, currentProject.getEfforts().get(i).getEffortDevPhase()); pst3.setInt(4, reqid); pst3.executeUpdate(); } } catch (Exception e) { System.out.println(e.toString()); } } // GEN-LAST:event_saveActionPerformed
// ---------------------------------------------------------------// public int editProject(Project project, Connection conn) throws SQLException { PreparedStatement prepStmt = null; int rtrn = -1; java.util.Date date = new java.util.Date(); Timestamp currentdate = new Timestamp(date.getTime()); conn = select(); String sql = "UPDATE PROJECTS SET PROJ_NAME=?,MODIFIED_AT=?,MODIFIED_BY=?,PROJ_ACTIVE=?,PROJ_BUDGET=?,PROJ_DEADLINE=?,PROJ_DESCRIPTION=?,PROJ_FROM=?,PROJ_TYPE=?,PROJ_TO=?,CUST_ID=?,ROWVERSION=ROWVERSION+1" + "WHERE PROJ_ID=?"; prepStmt = conn.prepareStatement(sql); prepStmt.setString(1, project.getName()); prepStmt.setTimestamp(2, currentdate); prepStmt.setString(3, project.getModified_by()); if (project.isActive()) prepStmt.setString(4, "Y"); else prepStmt.setString(4, "N"); if (project.getBudget() != -1) prepStmt.setFloat(5, project.getBudget()); else prepStmt.setInt(5, 0); if (project.getNextDeadline() == null) prepStmt.setDate(6, null); else prepStmt.setDate(6, new java.sql.Date(project.getNextDeadline().getTime())); prepStmt.setString(7, project.getDescription()); prepStmt.setDate(8, new java.sql.Date(project.getStartDate().getTime())); prepStmt.setString(9, project.getProjectType()); if (project.getEndDate() == null) prepStmt.setDate(10, null); else prepStmt.setDate(10, new java.sql.Date(project.getEndDate().getTime())); prepStmt.setInt(11, project.getCustomerID()); prepStmt.setInt(12, project.getProjectID()); prepStmt.executeUpdate(); rtrn = project.getProjectID(); return rtrn; }
// ---------------------------------------------------------------// public int insertProject(Project project, Connection conn) throws SQLException { PreparedStatement prepStmt = null; int rtrn = -1; java.util.Date date = new java.util.Date(); Timestamp currentdate = new Timestamp(date.getTime()); conn = select(); String sql = "INSERT INTO PROJECTS(PROJ_ID,PROJ_NAME,INSERTED_AT,INSERTED_BY,MODIFIED_AT,MODIFIED_BY,PROJ_ACTIVE,PROJ_BUDGET,PROJ_DEADLINE,PROJ_DESCRIPTION,PROJ_FROM,PROJ_TYPE,PROJ_TO,CUST_ID,ROWVERSION)" + " VALUES(PROJ_SEQ.NEXTVAL,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; String cols[] = {"PROJ_ID"}; prepStmt = conn.prepareStatement(sql, cols); prepStmt.setString(1, project.getName()); prepStmt.setTimestamp(2, currentdate); prepStmt.setString(3, project.getInserted_by()); prepStmt.setDate(4, null); prepStmt.setString(5, null); if (project.isActive()) prepStmt.setString(6, "Y"); else prepStmt.setString(6, "N"); if (project.getBudget() != -1) prepStmt.setFloat(7, project.getBudget()); else prepStmt.setInt(7, 0); if (project.getNextDeadline() == null) prepStmt.setDate(8, null); else prepStmt.setDate(8, new java.sql.Date(project.getNextDeadline().getTime())); prepStmt.setString(9, project.getDescription()); prepStmt.setDate(10, new java.sql.Date(project.getStartDate().getTime())); prepStmt.setString(11, project.getProjectType()); if (project.getEndDate() == null) prepStmt.setDate(12, null); else prepStmt.setDate(12, new java.sql.Date(project.getEndDate().getTime())); prepStmt.setInt(13, project.getCustomerID()); prepStmt.setInt(14, project.getRowversion()); prepStmt.executeUpdate(); ResultSet rs = prepStmt.getGeneratedKeys(); if (rs.next()) { rtrn = rs.getInt(1); } rs.close(); return rtrn; }
public ViewProject(int id) { initComponents(); currentProject = new Project(); currentProject.setProjectID(id); try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection( "jdbc:mysql://127.0.0.1:3306/projectmanagementsystem?zeroDateTimeBehavior=convertToNull", "root", "password"); String query2 = "select * from project where idproject = ?"; PreparedStatement pst2 = con.prepareStatement(query2); int projectid = id + 1; pst2.setInt(1, projectid); ResultSet rs = pst2.executeQuery(); if (rs.next()) { projectname.setText(rs.getString("projectname")); projectdescription.setText(rs.getString("projectdesc")); } String query3 = "select * from teammember where teammember_FK = ?"; PreparedStatement pst3 = con.prepareStatement(query3); pst3.setInt(1, projectid); ResultSet rs2 = pst3.executeQuery(); while (rs2.next()) { Person p = new Person(); p.setFirstName(rs2.getString("firstname")); p.setLastName(rs2.getString("lastname")); p.setPosition(rs2.getString("position")); p.setPersonID(rs2.getInt("idteammember")); teammembers.add(p); teammodel.addElement(p.getFirstName() + " " + p.getLastName() + " " + p.getPosition()); } teamlist.setModel(teammodel); String query4 = "select * from goal where goal_FK = ?"; PreparedStatement pst4 = con.prepareStatement(query4); pst4.setInt(1, projectid); ResultSet rs3 = pst4.executeQuery(); while (rs3.next()) { Goal g = new Goal(); g.setGoalID(rs3.getInt("idgoal")); g.setGoalDesc(rs3.getString("goaldesc")); g.setGoalType(rs3.getString("goaltype")); goals.add(g); goalmodel.addElement(g.getGoalType() + " " + g.getGoalDesc()); } goallist.setModel(goalmodel); String query5 = "select * from requirement where requirement_FK = ?"; PreparedStatement pst5 = con.prepareStatement(query5); pst5.setInt(1, projectid); ResultSet rs4 = pst5.executeQuery(); while (rs4.next()) { Requirement r = new Requirement(); String type; r.setRequirementID(rs4.getInt("idrequirement")); r.setRequirementDescription(rs4.getString("requirementdesc")); if (rs4.getInt("isFunctionalRequirement") == 0) { r.setIsFunctionalRequirement(false); type = "Non-functional"; } else type = "Functional"; requirements.add(r); requirementmodel.addElement(type + " " + r.getRequirementDescription()); } requirementlist.setModel(requirementmodel); String query6 = "select * from risk where risk_FK = ?"; PreparedStatement pst6 = con.prepareStatement(query6); pst6.setInt(1, projectid); ResultSet rs5 = pst6.executeQuery(); while (rs5.next()) { Risk r = new Risk(); r.setRiskID(rs5.getInt("idrisk")); r.setRiskName(rs5.getString("riskname")); r.setRiskStatus(rs5.getString("riskstatus")); risks.add(r); riskmodel.addElement(r.getRiskStatus() + " " + r.getRiskName()); } risklist.setModel(riskmodel); String query7 = "select * from effort join requirement on effort.effort_FK = requirement.idrequirement" + " where requirement.requirement_FK = ?"; PreparedStatement pst7 = con.prepareStatement(query7); pst7.setInt(1, projectid); ResultSet rs6 = pst7.executeQuery(); while (rs6.next()) { Effort e = new Effort(); e.setEffortID(rs6.getInt("ideffort")); e.setEffortDate(rs6.getString("effortdate")); e.setEffortDevPhase(rs6.getString("effortdevphase")); e.setEffortHours(rs6.getInt("efforthours")); e.setRequirementID(rs6.getInt("effort_FK")); e.setRequirementDesc(rs6.getString("requirementdesc")); efforts.add(e); effortmodel.addElement( "For req: " + e.getRequirementDesc() + " " + e.getEffortDevPhase() + " " + e.getEffortDate() + " " + e.getEffortHours()); } effortlist.setModel(effortmodel); } catch (Exception e) { System.out.println(e.toString()); } }
private void addriskActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addriskActionPerformed // TODO add your handling code here: String[] types = {"Minor", "Moderate", "Major", "Catastrophic"}; JComboBox typeList = new JComboBox(types); typeList.setSelectedIndex(0); JTextArea description = new JTextArea(); description.setRows(5); description.setColumns(10); description.setLineWrap(true); JScrollPane pane = new JScrollPane(description); Object[] message = { "Risk Type:", typeList, "Description:", pane, }; int option = JOptionPane.showConfirmDialog( this, message, "Enter Risk Information", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { Risk risk = new Risk(); risk.setRiskName(description.getText()); risk.setRiskStatus(typeList.getSelectedItem().toString()); currentProject.getRisks().add(risk); riskmodel.addElement(typeList.getSelectedItem().toString() + " " + description.getText()); risklist.setModel(riskmodel); } } // GEN-LAST:event_addriskActionPerformed
private void addrequirementActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addrequirementActionPerformed // TODO add your handling code here: String[] types = {"Functional", "Non-functional"}; JComboBox typeList = new JComboBox(types); typeList.setSelectedIndex(0); JTextArea description = new JTextArea(); description.setRows(5); description.setColumns(10); description.setLineWrap(true); JScrollPane pane = new JScrollPane(description); Object[] message = { "Requirement Type:", typeList, "Description:", pane, }; int option = JOptionPane.showConfirmDialog( this, message, "Enter Requirement Information", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { Requirement req = new Requirement(); req.setRequirementDescription(description.getText()); if (typeList.getSelectedItem().toString().equals("Functional")) { req.setIsFunctionalRequirement(true); } else req.setIsFunctionalRequirement(false); currentProject.getRequirements().add(req); requirementmodel.addElement(typeList.getSelectedItem() + " " + description.getText()); requirementlist.setModel(requirementmodel); } } // GEN-LAST:event_addrequirementActionPerformed