List of usage examples for javax.swing.table DefaultTableModel addRow
public void addRow(Object[] rowData)
From source file:UserInterface.PowerStationAdminRole.ReviewPerformanceJPanel.java
/** * Creates new form ReviewVaccinePerformanceJPanel *//* w ww. j a v a2s. c o m*/ public ReviewPerformanceJPanel(JPanel userProcessContainer, Organization organization, Enterprise enterprise) { initComponents(); this.userProcessContainer = userProcessContainer; this.organization = organization; this.enterprise = (EnergyEnterprise) enterprise; this.masterOrderCatalog = masterOrderCatalog; // masterOrderCatalog.addOrder(order); int temp = 0; //populate(); // populateRank(); Collections.sort(organization.getElectricityDirectory().getElecCatalog()); int i = 0; for (Electricity e : organization.getElectricityDirectory().getElecCatalog()) { topElectricitySourceJTextField.setText(e.getElectricitySource()); //e.getNonPeakHourPrice(); i++; if (i == 1) { break; } } DefaultTableModel dtm = (DefaultTableModel) reviewJTable.getModel(); dtm.setRowCount(0); Collections.sort(organization.getElectricityDirectory().getElecCatalog()); int j = 0; for (Electricity e : organization.getElectricityDirectory().getElecCatalog()) { Object row[] = new Object[2]; row[0] = e; row[1] = e.getSoldQuantity(); dtm.addRow(row); } Collections.sort(organization.getElectricityDirectory().getElecCatalog()); int k = 0; for (Electricity e : organization.getElectricityDirectory().getElecCatalog()) { topSalesAmountJTextField.setText(String.valueOf(e.getNonPeakHourPrice())); //e.getNonPeakHourPrice(); k++; if (k == 1) { break; } } Collections.sort(organization.getElectricityDirectory().getElecCatalog()); int l = 0; for (Electricity e : organization.getElectricityDirectory().getElecCatalog()) { l += e.getSoldQuantity(); noOfProductSoldJTextField.setText(String.valueOf(l)); } }
From source file:cz.moz.ctmanager.main.DetailsFrame.java
public void refreshList() { //For emails// w w w . j a va 2s . c o m DefaultTableModel newEmailModel = (DefaultTableModel) emailTable.getModel(); newEmailModel.setRowCount(0); List<Email> emailList = emailsDao.getAll(contact.getID()); for (Email iteratorEmail : emailList) { int id = iteratorEmail.getId(); String email = iteratorEmail.getEmail(); String desc = iteratorEmail.getDescription(); newEmailModel.addRow(new Object[] { id, email, desc }); } emailTable.setModel(newEmailModel); //For phone numbers DefaultTableModel newPhoneModel = (DefaultTableModel) phoneTable.getModel(); newPhoneModel.setRowCount(0); List<PhoneNumber> phoneList = phonesDao.getAll(contact.getID()); for (PhoneNumber iteratorPhone : phoneList) { int id = iteratorPhone.getId(); String email = iteratorPhone.getPhoneNumber(); String desc = iteratorPhone.getDescription(); newPhoneModel.addRow(new Object[] { id, email, desc }); } phoneTable.setModel(newPhoneModel); }
From source file:edu.ku.brc.af.ui.forms.formatters.DataObjFieldFormatMultiplePanel.java
private void createToolbar() { ActionListener addAL = new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultTableModel model = (DefaultTableModel) formatSwitchTbl.getModel(); DataObjSwitchFormatter fmt = formatContainer.getSelectedFormatter(); DataObjDataFieldFormat fld = new DataObjDataFieldFormat(); fmt.add(fld);//from ww w .java2 s .com model.addRow(new Object[] { fld.getValue(), fld, ellipsisButtonLabel }); setHasChanged(true); enableUIControls(); } }; ActionListener delAL = new ActionListener() { public void actionPerformed(ActionEvent e) { int formatColumn = formatSwitchTbl.getColumn(DISPLAY_FORMAT_COL).getModelIndex(); DefaultTableModel model = (DefaultTableModel) formatSwitchTbl.getModel(); DataObjSwitchFormatter fmt = formatContainer.getSelectedFormatter(); int[] rows = formatSwitchTbl.getSelectedRows(); // sort rows in reverse order otherwise removing the first rows // will mess up with the row numbers Integer[] intRows = new Integer[rows.length]; for (int i = 0; i < rows.length; ++i) { intRows[i] = new Integer(rows[i]); } Arrays.sort(intRows, Collections.reverseOrder()); for (int currentRow : intRows) { fmt.remove((DataObjDataFieldFormatIFace) model.getValueAt(currentRow, formatColumn)); model.removeRow(currentRow); } formatSwitchTbl.clearSelection(); setHasChanged(true); enableUIControls(); } }; controlPanel = new EditDeleteAddPanel(null, delAL, addAL); controlPanel.getAddBtn().setEnabled(true); }
From source file:view.transacao.Relatorio.java
public void preencheTabela(String filtro) { final DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); try {/*from w ww. ja v a 2 s .c o m*/ transacaoController = new TransacaoController(); List transacoes = transacaoController.listComFiltro(filtro); Iterator it = transacoes.iterator(); Transacao t; while (it.hasNext()) { t = (Transacao) it.next(); model.addRow(new Object[] { t.id, t.tipoTransacao, t.descricao, t.valor, t.categoria, t.tipoRecorrencia, t.dataInsercao }); } } catch (Exception e) { } }
From source file:userinterface.SystemAdminWorkArea.DisplayOperationJPanel.java
public void populateTable() { DefaultTableModel model = (DefaultTableModel) treatmentTable.getModel(); model.setRowCount(0);/*from ww w .j a va2s. co m*/ Network network = (Network) stateCombo.getSelectedItem(); for (Enterprise enterprise : network.getEnterpriseDirectory().getEnterpriseList()) { TreatedFor t = enterprise.findMaxVal(); Object row[] = new Object[3]; row[0] = enterprise; row[1] = t == null ? "No patient Diagnosed Yet!" : t.getTreatment(); row[2] = t == null ? "No patient Diagnosed Yet!" : t.getCount(); model.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);/*from ww w.j a va 2 s . com*/ if (s < 0) { return; } 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:userinterface.SystemAdminWorkArea.DisplayAllergyJPanel.java
public void populateTable() { DefaultTableModel model = (DefaultTableModel) allergyTable.getModel(); model.setRowCount(0);//from w w w .j a va 2 s. c o m Network network = (Network) stateCombo.getSelectedItem(); for (Enterprise enterprise : network.getEnterpriseDirectory().getEnterpriseList()) { Allergy a = enterprise.findMaxValue(); Object row[] = new Object[3]; row[0] = enterprise; row[1] = a == null ? "No patient Diagnosed Yet!" : a.getAllergyName(); row[2] = a == null ? "No patient Diagnosed Yet!" : a.getCount(); model.addRow(row); } }
From source file:userinterface.BioRecyclingRole.BioRecyclingJPanel.java
public void populateRequestTable() { DefaultTableModel model = (DefaultTableModel) jBioRecycling.getModel(); model.setRowCount(0);/*from w w w . j a v a2s .co m*/ for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) { Object[] row = new Object[3]; row[0] = request; row[2] = ((BioRecyclingWorkRequest) request).getSegregatedDegradable(); row[1] = ((BioRecyclingWorkRequest) request).getReceiver(); model.addRow(row); } }
From source file:edu.ku.brc.af.ui.forms.formatters.DataObjFieldFormatMultiplePanel.java
public void fillWithObjFormatter(final DataObjSwitchFormatter switchFormatter) { // display each formatter as a table row // DefaultTableModel tableModel = (DefaultTableModel) // formatSwitch.getModel(); DefaultTableModel model = getCleanTableModel(); if (switchFormatter != null) { Vector<DataObjDataFieldFormatIFace> formatters = new Vector<DataObjDataFieldFormatIFace>( switchFormatter.getFormatters()); for (DataObjDataFieldFormatIFace formatter : formatters) { model.addRow(new Object[] { formatter.getValue(), formatter, ellipsisButtonLabel }); }/*from w w w . j a va 2s . c o m*/ } formatSwitchTbl.setModel(model); setFormatSwitchTblColumnProperties(); }
From source file:com.wesley.urban_cuts.client.urbancuts.myFrame.java
private void appendToTable(Payment payment) { String data1 = payment.getBarber_name(); String data2 = payment.getStyle_name(); String data3 = Double.toString(payment.getPrice()); Object[] row = { data1, data2, data3 }; DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.addRow(row); Write_to_file w = new Write_to_file(); w.write_to_file(data1, data2, data3); }