Example usage for javax.swing.table DefaultTableModel addRow

List of usage examples for javax.swing.table DefaultTableModel addRow

Introduction

In this page you can find the example usage for javax.swing.table DefaultTableModel addRow.

Prototype

public void addRow(Object[] rowData) 

Source Link

Document

Adds a row to the end of the model.

Usage

From source file:UserInterfaces.HAdministration.MedicationJPanel.java

private void populateTable() {

    DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
    model.setRowCount(0);//w  w w . jav  a  2 s  . c  o m

    for (WorkRequest w : enterprise.getWorkQueue().getWorkRequestList()) {
        if (w.getLevel2().equals(ErrorUtil.MEDICATION_OR_OTHER)) {
            Object[] row = new Object[3];
            row[0] = w.getDateoferror();
            row[1] = w.getMedicationtype();
            row[2] = w.getSource();
            model.addRow(row);

        }
    }
}

From source file:Interface.FoodCollectionSupervisor.FoodCollectionWorkArea.java

private void populateDriverUseraccount() {

    DefaultTableModel model = (DefaultTableModel) tblDriverUserAccount.getModel();
    model.setRowCount(0);//from   ww w. jav  a 2s.c  o  m

    for (UserAccount ua : organization.getUserAccountDirectory().getUserAccountList()) {
        Object row[] = new Object[2];
        row[0] = ua;
        row[1] = ua.getRole();
        model.addRow(row);
    }

}

From source file:userinterface.BioRecyclingRole.BioRecyclingJPanel.java

private void jRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRefreshActionPerformed

    DefaultTableModel model = (DefaultTableModel) jBioRecycling.getModel();

    model.setRowCount(0);/*from   w  ww  .  j  av a 2s  .  c o m*/
    for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) {
        Object[] row = new Object[8];
        row[0] = request;
        row[1] = ((BioRecyclingWorkRequest) request).getReceiver();
        row[2] = ((BioRecyclingWorkRequest) request).getSegregatedDegradable();

        row[3] = ((BioRecyclingWorkRequest) request).getQuantityProduced();
        row[4] = ((BioRecyclingWorkRequest) request).getMoneyEarned();
        row[5] = ((BioRecyclingWorkRequest) request).getbTemperature();
        row[6] = ((BioRecyclingWorkRequest) request).getbTime();
        row[7] = ((BioRecyclingWorkRequest) request).getSentTo();

        model.addRow(row);
    }
    jTotal.setEnabled(true);
}

From source file:userinterface.HealthAnalystRole.ViewReportJPanel.java

public void populateEffectsonBodyTable(Device d) {
    //device = (Device) tblHealthTable.getValueAt(selectedRow, 0);
    //tblHealthTable.setValueAt(device,selectedRow,0);
    value1.setText(d.getIMEINo());// ww w  .j  ava 2 s  .  c  o  m
    DefaultTableModel mod = (DefaultTableModel) tblBodyEffects.getModel();
    mod.setRowCount(0);
    for (EffectsOnBody b : d.getEffectsOnBodyList().getEffectsOnBodyList()) {
        Object row[] = new Object[3];
        row[0] = b;
        row[1] = b.getDiseaseType();
        //row[1] = d.getModelNo();
        //row[2] = d.getCallEndTime();
        // row[1] = d.getAvgSAR();
        // row[2] = d.getMaxSAR();
        //row[3] = d.getValueRF();
        //row[4] = d.getCallEndTime();
        // row[5] = b.getEffectsOnOrgans();
        // row[6] = b.getDiseaseType();
        mod.addRow(row);
    }

}

From source file:UserInterface.FinanceRole.DonationsReceivedJPanel.java

private void populateDonationTable() {

    DefaultTableModel dtm = (DefaultTableModel) donationsJTable.getModel();
    dtm.setRowCount(0);//www. j  av a 2s. co  m
    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 source file:UserInterface.DoctorAdmin.TakeRequestJPanel.java

public void populateTable() {

    DefaultTableModel model = (DefaultTableModel) tblDocWorkRequest.getModel();
    model.setRowCount(0);/*from  ww w  . java2s  .  c o  m*/
    for (WorkRequest request : organization.getWorkQueue().getWorkRequestList()) {
        if (organization instanceof DoctorAdminOrganization) {
            pdwrequest = (PatientDoctorWorkRequest) request;
            if (!pdwrequest.getStatus().equals("Task completed")) {
                Object[] row = new Object[4];

                row[0] = pdwrequest;
                row[1] = pdwrequest.getSender().getUserName();
                row[2] = pdwrequest.getReceiver() == null ? "Not assigned"
                        : request.getReceiver().getEmployee().getFirstName();
                row[3] = pdwrequest.getStatus();
                model.addRow(row);
            }
        }
    }
}

From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java

private void populateDetailsOrderTable() {

    //get the selected order
    int selectedRow = deliveryJTable.getSelectedRow();
    if (selectedRow < 0) {
        JOptionPane.showMessageDialog(this, "Please select an order from the list");
        return;/*  w  w w.  j  av a2 s .c  o m*/
    }

    Order o = (Order) deliveryJTable.getValueAt(selectedRow, 0);
    if (null == o) {
        JOptionPane.showMessageDialog(this, "Failed to retrieve selected order's information");
        return;
    }

    int rowCount = detailsorderJTable.getRowCount();
    DefaultTableModel dtm = (DefaultTableModel) detailsorderJTable.getModel();

    //delete all the previous rows
    for (int i = rowCount - 1; i >= 0; i--) {
        dtm.removeRow(i);
    }

    for (OrderItem oi : o.getOrderItemList()) {
        Object[] row = new Object[4];
        row[0] = oi;
        row[1] = oi.getMedicalDevice().getPrice();
        row[2] = oi.getQuantity();
        row[3] = (oi.getMedicalDevice().getPrice() * oi.getQuantity());
        dtm.addRow(row);
    }
}

From source file:UserInterfaces.HAdministration.BloodReportJPanel.java

private void populateTbale() {

    DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
    model.setRowCount(0);/*from ww w .j  a  va2  s.co m*/

    for (WorkRequest w : enterprise.getWorkQueue().getWorkRequestList()) {
        if (w.getLevel2().equals(ErrorUtil.BLOOD_OR_BLOOD_PRODUCT)) {
            Object[] row = new Object[4];
            row[0] = w.getDateoferror();
            row[1] = w.getBloodtyep();
            row[2] = w.getBloodstage();
            row[3] = w.getSource();

            model.addRow(row);

        }
    }

}

From source file:UserInterfaces.HAdministration.SurgeryJPanel.java

private void populateTable() {

    DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
    model.setRowCount(0);//from   w  ww  .j a  v  a  2s  . com

    for (WorkRequest w : enterprise.getWorkQueue().getWorkRequestList()) {
        if (w.getLevel2().equals(ErrorUtil.SURGERY_OR_ANESTHESIA)) {
            Object[] row = new Object[3];
            row[0] = w.getDateoferror();
            row[1] = w.getSurgeryevent();
            row[2] = w.getSource();
            model.addRow(row);

        }
    }
}

From source file:gdt.jgui.entity.fields.JFieldsEditor.java

private void replaceTable(Core[] ca) {
    try {//from   ww  w.j  av  a  2 s.  com
        table = (JTable) scrollPane.getViewport().getView();
        DefaultTableModel model = (DefaultTableModel) table.getModel();
        while (model.getRowCount() > 0)
            model.removeRow(0);
        int cnt = ca.length;
        if (cnt < 1)
            return;
        for (int i = 0; i < cnt; i++)
            model.addRow(new String[] { ca[i].name, ca[i].value });
    } catch (Exception e) {
        LOGGER.severe(e.toString());
    }
}