private void showProductDetails(int ID) { List<Products> productWithID = products.stream().filter((p) -> p.getProductID() == ID).collect(Collectors.toList()); List<Supplier> supplierWithID = suppliers .stream() .filter((p) -> p.getSupplierID() == p.getSupplierID()) .collect(Collectors.toList()); Products product = productWithID.get(0); Supplier supplier = supplierWithID.get(0); String productName_ = (productLineMap.get(product.getProductLineID()) + " " + product.getDescription() + " " + product.getCharacteristics() + " " + product.getMotors()) .replaceAll("\\s+", " "); String productDescription_ = (product.getDescription() + " " + product.getCharacteristics() + " " + product.getMotors()) .replaceAll("\\s+", " "); iProductName.setText(productName_); iItemNumber.setText(String.valueOf(product.getProductID())); iAddMotoCode.setText(product.getAddmotoCode()); iProductLine.setText(productLineMap.get(product.getProductLineID())); iItemDescription.setText(productDescription_); iSellingPrice.setText(Formatter.format(product.getSellingPrice())); iUnitCost.setText(Formatter.format(product.getUnitPrice())); iOnHandQuantity.setText(String.valueOf(product.getCurrentQuantity())); iQtyThreshold.setText(String.valueOf(product.getThresholdCount())); iStatus.setText("Not Yet Implemented"); iSupplier.setText(supplier.getSupplierName()); iEditUpdateRSP.setEnabled(true); iEditUpdateUC.setEnabled(true); iEditUpdateQT.setEnabled(true); }
private void populateTable() { while (tableModel.getRowCount() > 0) { tableModel.removeRow(0); } products = model.getProducts(); for (Products product : products) { tableModel.addRow( new Object[] { String.valueOf(product.getProductID()), product.getAddmotoCode(), productLineMap.get(product.getProductLineID()), (product.getDescription() + " " + product.getCharacteristics() + " " + product.getMotors()) .replaceAll("\\s+", " ") .trim(), "PhP " + Formatter.format(product.getUnitPrice()), "PhP " + Formatter.format(product.getSellingPrice()) }); } }