List of usage examples for javax.swing.table DefaultTableModel setRowCount
public void setRowCount(int rowCount)
From source file:drugsupplychain.neu.css.gui.common.pharmaco.ProductDistributionDetailJPanel.java
/** * populate distribution table// w ww . j av a 2 s .c o m */ private void populateDistributionTable() { DefaultTableModel defaultTableModel = (DefaultTableModel) distributionTable.getModel(); defaultTableModel.setRowCount(0); if (null != product) { if (null != product.getProductTracker()) { for (String id : product.getProductTracker().keySet()) { TrackOrganization trackOrganization = product.getProductTracker().get(id); if (trackOrganization.getOrganization() instanceof RegionalDistributor) { Object[] rows = new Object[5]; rows[0] = trackOrganization.getOrganization().getLocation(); rows[1] = trackOrganization; rows[2] = trackOrganization.getOrganization(); rows[3] = trackOrganization.getQuantity(); rows[4] = trackOrganization.getQuantity() * product.getPrice(); defaultTableModel.addRow(rows); } } } } }
From source file:UserInterface.CDC.VaccineCityDistributionJPanel.java
private void populateTable() { DefaultTableModel model = (DefaultTableModel) summaryjTable.getModel(); model.setRowCount(0); if (business.getStateList() != null) { for (CityNetwork city : state.getCityList()) { Object[] row = new Object[2]; row[0] = city;/*w w w. jav a2 s. co m*/ row[1] = city.getTotalVaccinesDistributedInCity(); model.addRow(row); } } }
From source file:UserInterface.CDC.VARESCityReportingJPanel.java
private void populateTable() { DefaultTableModel model = (DefaultTableModel) summaryjTable.getModel(); model.setRowCount(0); if (business.getStateList() != null) { for (CityNetwork city : state.getCityList()) { Object[] row = new Object[3]; row[0] = city;// w w w. j a v a 2 s .c om row[1] = city.getTotalVaccinesAdministeredInCity(); row[2] = city.getTotalFailedVaccinesInCity(); model.addRow(row); } } }
From source file:gui.ResultadoDistFreq.java
public void preencherTabela(ArrayList<String> valores, int[] freqAbs) { DefaultTableModel modelo = (DefaultTableModel) tabelaItens.getModel(); int totalValores = 0; for (int i = 0; i < freqAbs.length; i++) { totalValores += freqAbs[i];// w w w . j ava2s. c om } modelo.setRowCount(valores.size()); for (int i = 0; i < modelo.getRowCount(); i++) { modelo.setValueAt(("" + (i + 1)), i, 0); modelo.setValueAt(valores.get(i), i, 1); modelo.setValueAt(String.valueOf(freqAbs[i]), i, 2); modelo.setValueAt(String.valueOf((((freqAbs[i] * 1.0) / 25) * 100)), i, 3); } }
From source file:UserInterface.FinanceRole.DonationsReceivedJPanel.java
private void populateDonationTable() { DefaultTableModel dtm = (DefaultTableModel) donationsJTable.getModel(); dtm.setRowCount(0); for (Transaction objTransaction : objWorldEnterprise.getObjTransactionDirectory().getTransactionList()) { if (objTransaction.getTransactionSource() .equals(Transaction.TransactionSourceType.FromDonor.getValue())) { if (objTransaction.getTransactionMode().equals(Transaction.TransactionModeType.Real.getValue())) { Object row[] = new Object[5]; row[0] = objTransaction; row[1] = objTransaction.getObjUserAccountSource().getObjPerson(); row[2] = objTransaction.getObjUserAccountSource(); row[3] = "$ " + String.valueOf(objTransaction.getTransactionBDAmount()); row[4] = objTransaction.getTransactionDateToDisplay(); dtm.addRow(row);//from w ww. j av a 2s. c om } } } }
From source file:userinterface.PatientRole.PatientAppointmentsJPanel.java
public void populateAppointments() { DefaultTableModel model = (DefaultTableModel) appointMentRequestJTable1.getModel(); model.setRowCount(0); for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) { if (request instanceof AppointmentWorkRequest) { Object[] row = new Object[5]; row[0] = request;/*from www . j a va 2 s.c o m*/ row[1] = request.getReceiver() == null ? null : request.getReceiver().getEmployee().getName(); row[2] = ((AppointmentWorkRequest) request).getAppointmentDateTime() == null ? null : ((AppointmentWorkRequest) request).getAppointmentDateTime(); row[3] = request.getStatus(); String result = ((AppointmentWorkRequest) request).getTestResult(); row[4] = result == null ? "Waiting" : result; model.addRow(row); } } }
From source file:stockit.allStocks.java
public void setupTable() { try {//from w w w . j a v a2 s .c o m DBConnection dbcon = new DBConnection(); dbcon.establishConnection(); Statement stmt = dbcon.con.createStatement(); ResultSet rs = stmt.executeQuery( "select stock.StockID, stock.Publicly_Traded, stock.StockName, stock_sector.Sector, stock_daily_performance.Volume, stock_daily_performance.Currency, stock_daily_performance.Opening_Price, stock_daily_performance.Closing_Price, stock_daily_performance.High, stock_daily_performance.Low, stock_daily_performance.Date\n" + "from stock, stock_sector, stock_daily_performance\n" + "WHERE stock.StockID = stock_sector.StockID AND stock_daily_performance.StockID = stock.StockID AND stock_daily_performance.Date IN\n" + "( Select * from\n" + "(\n" + "SELECT max(Date) \n" + "FROM stock_daily_performance, stock\n" + "where stock_daily_performance.StockID=stock.StockID\n" + "group by stock.StockID\n" + "ORDER BY Date \n" + "\n" + ") temp_table)"); DefaultTableModel model = (DefaultTableModel) table.getModel(); model.setRowCount(0); while (rs.next()) { model.addRow(new Object[] { rs.getString("StockID"), rs.getString("StockName"), rs.getString("Publicly_Traded"), rs.getString("Sector"), rs.getString("Volume"), rs.getString("Currency"), rs.getString("Opening_Price"), rs.getString("Closing_Price"), rs.getString("High"), rs.getString("Low"), rs.getString("Date") }); } dbcon.con.close(); } catch (Exception ex) { Logger.getLogger(clientLogin.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:UserInterface.DoctorRole.ViewPatientReport.java
public void PopulateTable() { DefaultTableModel model = (DefaultTableModel) summaryTable.getModel(); model.setRowCount(0); for (Test vs : testdir.getTestdir()) { Object row[] = new Object[4]; row[0] = vs;/*w ww.j a v a2 s . c o m*/ row[1] = vs.getBloodPressure(); row[2] = vs.getBloodPlatlets(); row[3] = vs.getHemoglobinLevel(); model.addRow(row); } }
From source file:UserInterface.VaccineManufacturer.TrackVaccineWastage.java
public void populateVaccineTable() { DefaultTableModel model = (DefaultTableModel) vaccineJTable.getModel(); model.setRowCount(0); for (Vaccine vaccine : enterprise.getVaccineCatalog().getVaccineList()) { Object row[] = new Object[2]; row[0] = vaccine;/*from ww w. j ava2 s. c o m*/ row[1] = vaccine.getDisease(); model.addRow(row); } }
From source file:UserInterface.VaccineManufacturer.TrackVaccineWastage.java
public void populateWastageTable(Vaccine vaccine) { DefaultTableModel model = (DefaultTableModel) wastageJTable.getModel(); model.setRowCount(0); int totalWastage = 0; for (Vaccine vaccineForSale : enterprise.getVaccineInventory().getVaccineInventoryList()) { if (vaccineForSale.getBatchAvailability() > 0 && vaccineForSale.getExpiryDate().before(new Date()) && vaccineForSale.getName().equals(vaccine.getName())) { Object row[] = new Object[2]; row[0] = vaccineForSale.getManufacturingBatch(); totalWastage = totalWastage + vaccineForSale.getBatchAvailability(); row[1] = vaccineForSale.getBatchAvailability(); model.addRow(row);//from w ww . j av a 2 s . c o m } } totalWastageJTextField.setText(String.valueOf(totalWastage)); }