List of usage examples for javax.swing.table DefaultTableModel setRowCount
public void setRowCount(int rowCount)
From source file:UserInterface.Supplier.SalesOverviewJPanel.java
public void populateTable() { DefaultTableModel dtm = (DefaultTableModel) performanceJTable.getModel(); dtm.setRowCount(0); Object[] obj = new Object[3]; ArrayList<String> temp = new ArrayList<>(); for (Order o : moc.getMoc()) { if (o.getSupplier().getCompanyName().equals(s.getCompanyName())) { for (OrderItem oi : o.getListOfItemsOrdered()) { if (!temp.contains(oi.getProduct().getTypeOfDevice())) { obj[0] = oi.getProduct().getTypeOfDevice(); obj[1] = oi.getQuantity(); obj[2] = oi.getProduct().getCost() * oi.getQuantity(); dtm.addRow(obj);/*from w w w. ja v a2s . c om*/ temp.add(oi.getProduct().getTypeOfDevice()); } else if (temp.contains(oi.getProduct().getTypeOfDevice())) { for (int i = 0; i < dtm.getRowCount(); i++) { String prodname = (String) dtm.getValueAt(i, 0); if (prodname.equals(oi.getProduct().getTypeOfDevice())) { int q = (int) dtm.getValueAt(i, 1) + oi.getQuantity(); int sale = q * oi.getProduct().getCost(); dtm.setValueAt(q, i, 1); dtm.setValueAt(sale, i, 2); } } } } } } }
From source file:userInterface.cdcRole.OverviewJPanel.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*w w w. j av a 2s . c o m*/ */ public void populate(PhdEnterprise p) { DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel(); dtm.setRowCount(0); for (Organization o : p.getOrganizationDirectory().getOrganizationList()) { if (o instanceof HospitalOrganization) { Object row[] = new Object[1]; row[0] = o; dtm.addRow(row); } } }
From source file:UserInterface.SupplierRole.ProductReportJPanel.java
private void populateProducts() { // Collections.sort(supplier.getProductCatalog().getProductCatalog(), new Comparator<Product>(){ ///*from w w w. j a va 2s. c o m*/ // public int compare(Product o1, Product o2) { // if(o1.getSoldQuantity() < o2.getSoldQuantity()) // return 1; // else if(o1.getSoldQuantity() > o2.getSoldQuantity()) // return -1; // return 0; // } // }); DefaultTableModel dtm = (DefaultTableModel) salestbl.getModel(); dtm.setRowCount(0); for (Product p : supplier.getProductCatalog().getProductCatalog()) { Object row[] = new Object[4]; row[0] = p; row[1] = p.getSoldQuantity(); row[2] = p.getPrice(); row[3] = (p.getSoldQuantity() * p.getPrice()); dtm.addRow(row); } }
From source file:userInterface.cdcRole.OverviewJPanel.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed int s = jTable1.getSelectedRow(); DefaultTableModel dtm = (DefaultTableModel) jTable2.getModel(); dtm.setRowCount(0); if (s < 0) { return;/*ww w. j av a2s . co m*/ } else { HospitalOrganization o = (HospitalOrganization) jTable1.getValueAt(s, 0); for (Inventory i : o.getInventoryCatalog().getInventoryList()) { Object row[] = new Object[2]; row[0] = i.getVaccine().getName(); row[1] = i.getTotalQuantity(); dtm.addRow(row); } } }
From source file:com.cch.aj.entryrecorder.frame.SearchJFrame.java
private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchActionPerformed BusyJFrame bf = new BusyJFrame(); bf.setVisible(true);/* w ww .j a v a2 s .c o m*/ SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { List<Entry> list = entrySearchService.Search(txtShift.getText(), txtProduct.getText(), txtBatch.getText()); DefaultTableModel model = (DefaultTableModel) tblSearch.getModel(); model.setRowCount(0); for (Entry entry : list) { model.addRow(new Object[] { entry.getId(), entry.getShift(), entry.getProductId().getCode(), (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(entry.getCreateDate()) }); } return null; } @Override protected void done() { bf.setVisible(false); } }; worker.execute(); }
From source file:UserInterface.AdministrativeRole.FeedBackJPanel.java
public void populateTable() { DefaultTableModel model = (DefaultTableModel) feedBackTable.getModel(); model.setRowCount(0); for (Organization organization : enterprise.getOrganizationDirectory().getOrganizationList()) { if (organization instanceof AdminOrganization) { for (FarmerFeedbackWorkRequest request : organization.getFeedbackWorkQueue() .getFarmerFeedbackList()) { Object[] row = new Object[2]; row[0] = request;/* w ww. j a v a 2 s .c o m*/ row[1] = request.getDateFiled(); model.addRow(row); } break; } } }
From source file:UserInterface.SupplierRole.ProductSalesReviewJPanel.java
private void populateSalesTable() { DefaultTableModel defaultTableModel = (DefaultTableModel) salesTable.getModel(); defaultTableModel.setRowCount(0); if (null != supplier.getProductCatalog()) { int totalSalesValue = 0; int productSalesValue = 0; for (Product product : supplier.getProductCatalog().getProductList()) { Object[] rows = new Object[4]; productSalesValue = product.getPrice() * (product.getInitialQuantity() - product.getAvailable()); rows[0] = product;/* www. j a va2 s . c o m*/ rows[1] = product.getInitialQuantity() - product.getAvailable(); rows[2] = product.getPrice(); rows[3] = productSalesValue; totalSalesValue = totalSalesValue + productSalesValue; defaultTableModel.addRow(rows); } totalSaleTextField.setText(String.valueOf(totalSalesValue)); } }
From source file:UserInterface.PublisherRole.ViewUserHabitsJPanel.java
public void populateUserHabitsTable(UserPotential userPotential) { int rowCount = userHabitsJTable.getRowCount(); DefaultTableModel model = (DefaultTableModel) userHabitsJTable.getModel(); model.setRowCount(0); for (Tag tag : userPotential.getTagList().getTagList()) { Object row[] = new Object[2]; row[0] = tag.getTagName();//w w w . ja v a 2 s. c o m row[1] = tag.getNumberOfVisits(); model.addRow(row); } }
From source file:UserInterface.PublisherRole.ViewUserHabitsJPanel.java
public void populateUserAccountsTable() { int rowCount = userAccountsJTable.getRowCount(); DefaultTableModel model = (DefaultTableModel) userAccountsJTable.getModel(); model.setRowCount(0); for (UserPotential userPotential : organization.getUserPotentialDirectory().getUserPotentialList()) { Object row[] = new Object[1]; row[0] = userPotential;/* w w w . ja va 2 s . c o m*/ model.addRow(row); } }
From source file:UserInterface.AdminWorkArea.InventoryUsageJPanel.java
public void populateTable() { Collections.sort(typeOfDevicesInInventory, IDeviceType.numberReservedComparator); DefaultTableModel dtm = (DefaultTableModel) deviceUsageJTable.getModel(); dtm.setRowCount(0); Object[] row = new Object[2]; for (IDeviceType idt : typeOfDevicesInInventory) { row[0] = idt;//from w w w . j a v a 2 s .com row[1] = idt.getNumberOfTimesReserved(); dtm.addRow(row); } }