private void populateTable() { DefaultTableModel model = (DefaultTableModel) billjTable1.getModel(); model.setRowCount(0); for (Network n : business.getNetworkList()) { for (Enterprise enterprise : n.getEnterpriseDirectory().getEnterpriseList()) { if (enterprise instanceof DistributorEnterprise) { for (WorkRequest request : enterprise.getWorkQueue().getWorkRequestList()) { Object[] row = new Object[5]; row[0] = request; // row[] = request.getSender().getEmployee().getName(); row[1] = request.getReceiver() == null ? null : request.getReceiver().getEmployee().getName(); row[2] = ((ProviderWorkRequest) request).getOrder(); row[3] = ((ProviderWorkRequest) request).getTotalPrice(); row[4] = request.getStatus(); model.addRow(row); } } } } }
private void forwardBilljButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_forwardBilljButtonActionPerformed int selectedRow = billjTable1.getSelectedRow(); if (selectedRow < 0) { return; } else { ProviderWorkRequest request2 = (ProviderWorkRequest) billjTable1.getValueAt(selectedRow, 0); if (request2.getStatus().equals("Pending")) { JOptionPane.showMessageDialog(null, "Order is Pending"); } else if (request2.getStatus().equals("Completed")) { Enterprise ent = null; for (Enterprise ent1 : n.getEnterpriseDirectory().getEnterpriseList()) { if (ent1 instanceof CDCEnterprise) { ent = ent1; break; } } if (ent != null) { System.out.println(request2.getOrder() + "order check"); int price = calculatePrice(request2.getOrder()); request2.setTotalPrice(price); System.out.println(price + "dddd"); ent.getWorkQueue().getWorkRequestList().add(request2); // userAccount.getWorkQueue().getWorkRequestList(); // System.out.println(price +"sss"); } } else { JOptionPane.showMessageDialog(null, "Order is Pending"); } } // TODO add your handling code here: } // GEN-LAST:event_forwardBilljButtonActionPerformed