Example usage for javax.swing.table DefaultTableModel setRowCount

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

Introduction

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

Prototype

public void setRowCount(int rowCount) 

Source Link

Document

Sets the number of rows in the model.

Usage

From source file:UserInterface.WaterSupplyAdmin.UsagePatternJPanel.java

private void populateCustomers() {
    DefaultTableModel model = (DefaultTableModel) customerTable.getModel();

    model.setRowCount(0);
    if (customerOrganization != null) {

        for (Employee employee : customerOrganization.getEmployeeDirectory().getEmployeeList()) {
            Object[] row = new Object[4];
            Customer cust = (Customer) employee;
            row[0] = cust.getId();/*  w  w w  . ja v a 2 s .  co  m*/
            row[1] = cust;
            row[2] = cust.getContactNo();
            row[3] = cust.getEmailId();
            model.addRow(row);
        }
        note.setText("");
    } else {
        note.setText("*Note : No Customers Available");
    }
}

From source file:UserInterface.FarmerRole.MyDashboardFarmer.java

public void populateLowQuantityTable() {
    DefaultTableModel dtm = (DefaultTableModel) lowQuantityTable.getModel();
    dtm.setRowCount(0);
    for (InventoryItem item : userAccount.getInventory().getInventoryList()) {
        if (item.getQuantity() < item.getThreshold()) {
            Object row[] = new Object[3];
            row[0] = item;//from w w  w  . jav a 2  s  .  c o  m
            row[1] = item.getThreshold();
            row[2] = item.getQuantity();
            dtm.addRow(row);
        }
    }
}

From source file:userinterface.PatientRole.PatientLikeMeJPanel.java

public void populateRequestTable() {

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

    model.setRowCount(0);

    for (Network n : ecoSystem.getNetworkList()) {
        for (Enterprise ep : n.getEnterpriseDirectory().getEnterpriseList()) {
            if (ep instanceof HospitalEnterprise) {
                for (Organization o : ep.getOrganizationDirectory().getOrganizationList()) {
                    if (o instanceof PatientOrganization) {
                        for (Employee e : o.getEmployeeDirectory().getEmployeeList()) {
                            if (e instanceof Patient) {
                                if (((Patient) e).getPatientChronicDisease() != null) {
                                    if (((Patient) e).getPatientChronicDisease()
                                            .equalsIgnoreCase(patient.getPatientChronicDisease())) {
                                        if (e.getId() != patient.getId()) {
                                            Object[] row = new Object[3];
                                            row[0] = (Patient) e;
                                            row[1] = ((Patient) e).getCity();
                                            row[2] = ((Patient) e).getOccupation();
                                            model.addRow(row);
                                            //                               JOptionPane.showMessageDialog(null, "Hurray found!! " + e.getName());
                                        }
                                    }//w  w w. j  a  v  a 2  s  .co  m
                                }
                            }
                        }

                    }
                }
            }

        }
    }

    /* DefaultTableModel model = (DefaultTableModel)tblPatients.getModel();
             
     model.setRowCount(0);
             
     for(WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()){
    if(request instanceof InspectionRequest){
        Object[] row = new Object[6];
        //row[0] = request;
        row[0] = ((InspectionRequest)request).getDrug();
        row[1] = request.getRequestDate();
        row[2] = ((InspectionRequest)request).getDrugManufacturerEnterprise();
        row[3] = ((InspectionRequest)request).getProblemExperienced();
        row[4] = request.getStatus();
        String result = ((InspectionRequest) request).getTestResult();
        row[5] = result == null ? "Waiting" : result;
                
        //row[4] = request.getStatus();
        model.addRow(row);
    }
     }*/
}

From source file:userinterface.PlasticRecyclingServiceRole.PlasticRecyclingJPanel.java

public void populateRequestTable() {
    DefaultTableModel model = (DefaultTableModel) jPlasticRecycling.getModel();

    model.setRowCount(0);
    for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) {
        Object[] row = new Object[3];
        row[0] = request;//w  ww.  j a  va2  s.c om

        row[2] = ((PlasticRecyclingWorkRequest) request).getSegregatedPlastic();

        row[1] = ((PlasticRecyclingWorkRequest) request).getReceiver();

        model.addRow(row);
    }
}

From source file:UserInterface.Doctor.DoctorWorkAreaJPanel.java

public void populateTable() {
    DefaultTableModel dtm = (DefaultTableModel) tblWorkRequest.getModel();

    dtm.setRowCount(0);
    for (WorkRequest request : account.getWorkQueue().getWorkRequestList()) {
        request1 = (PatientDoctorWorkRequest) request;
        if (!request1.getStatus().equals("Task completed")) {
            Object[] row = new Object[3];
            row[0] = request1;//  w  ww .  j av a2 s.  c  om
            row[1] = request1.getAssignedPatient();
            row[2] = request1.getStatus();
            dtm.addRow(row);
            lbl1.setText("Welcome " + request1.getAssignedDoctor().getFirstName());

        }
    }
}

From source file:userinterface.MetalRecyclingServiceRole.MetalRecyclingServiceJPanel.java

public void populateRequestTable() {
    DefaultTableModel model = (DefaultTableModel) jMetalRecycling.getModel();

    model.setRowCount(0);
    for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) {
        Object[] row = new Object[3];
        row[0] = request;/*w  w  w . j av a 2  s.com*/

        row[2] = ((MetalRecyclingWorkRequest) request).getSegregatedMetal();

        row[1] = ((MetalRecyclingWorkRequest) request).getReceiver();

        model.addRow(row);
    }
}

From source file:userInterface.HospitalDoctor.HospitalDoctorWorkAreaJPanel.java

public void populateAlertsTable() {
    DefaultTableModel dtm = (DefaultTableModel) alertDetailsTable.getModel();
    dtm.setRowCount(0);

    for (WorkRequest request : hdOrg.getWorkQueue().getWorkRequestList()) {
        if (hdOrg.getWorkQueue().getWorkRequestList() != null) {
            Object[] row = new Object[6];

            row[0] = request.getMessage();
            row[1] = request.getSeverity();
            row[2] = ((HospitalWorkRequest) request).getAlert();
            row[3] = request.getRequestDate();
            row[4] = request.getStatus();
            row[5] = request.getResponseDate();

            // row[1] = request.getStatus();

            dtm.addRow(row);//from  www.j  av  a 2 s. com
        }
    }
}

From source file:userinterface.PlasticRecyclingServiceRole.PlasticRecyclingJPanel.java

private void jRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRefreshActionPerformed
    DefaultTableModel model = (DefaultTableModel) jPlasticRecycling.getModel();

    model.setRowCount(0);
    for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) {
        Object[] row = new Object[8];
        row[0] = request;/*from  w  w  w  .  ja  va2  s .com*/
        row[1] = ((PlasticRecyclingWorkRequest) request).getReceiver();
        row[2] = ((PlasticRecyclingWorkRequest) request).getSegregatedPlastic();

        row[3] = ((PlasticRecyclingWorkRequest) request).getNumberOfItemsProduced();
        row[4] = ((PlasticRecyclingWorkRequest) request).getpMoneyEarned();
        row[5] = ((PlasticRecyclingWorkRequest) request).getpTemperature();
        row[6] = ((PlasticRecyclingWorkRequest) request).getpTime();
        row[7] = ((PlasticRecyclingWorkRequest) request).getSentTo();

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

From source file:userinterface.MetalRecyclingServiceRole.MetalRecyclingServiceJPanel.java

private void jRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRefreshActionPerformed
    DefaultTableModel model = (DefaultTableModel) jMetalRecycling.getModel();

    model.setRowCount(0);
    for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) {
        Object[] row = new Object[8];
        row[0] = request;//  www .j  av  a  2s . co  m
        row[1] = ((MetalRecyclingWorkRequest) request).getReceiver();
        row[2] = ((MetalRecyclingWorkRequest) request).getSegregatedMetal();

        row[3] = ((MetalRecyclingWorkRequest) request).getQuantityProduced();
        row[4] = ((MetalRecyclingWorkRequest) request).getMoneyEarned();
        row[5] = ((MetalRecyclingWorkRequest) request).getmTemperature();
        row[6] = ((MetalRecyclingWorkRequest) request).getmTime();
        row[7] = ((MetalRecyclingWorkRequest) request).getSentTo();

        model.addRow(row);
    }

    jTotal.setEnabled(true);
}

From source file:userInterface.HospitalDoctor.HospitalDoctorWorkAreaJPanel.java

public void populatePatientsTable() {
    DefaultTableModel model = (DefaultTableModel) vitalSignjTable.getModel();
    model.setRowCount(0);
    for (WorkRequest request : hdOrg.getWorkQueue().getWorkRequestList()) {
        if (request instanceof HospitalWorkRequest) {
            Person person = request.getPerson();
            for (Member mem : person.getMemberDir().getMemberDirectory()) {
                if (mem.getMemberName().equals(request.getMessage())) {
                    int patientAge = mem.getAge();
                    for (VitalSign vs : mem.getVitalSignList().getVitalSignList()) {
                        Object[] row = new Object[7];
                        row[0] = request;
                        row[1] = vs;//from  w w  w .  j a v a  2s.c o  m
                        row[2] = vs.getRespiratoryRate();
                        row[3] = vs.getHeartRate();
                        row[4] = vs.getBloodPressure();
                        row[5] = vs.getTemperature();
                        row[6] = mem.getVitalSignList().VitalSignStatus(patientAge, vs);
                        model.addRow(row);
                    }
                }

            }

        }
    }
}