List of usage examples for javax.swing.table DefaultTableModel setRowCount
public void setRowCount(int rowCount)
From source file:UserInterface.CentreForDiseaseControl.AddDiseaseJPanel.java
public void populateDiseaseTable() { DefaultTableModel model = (DefaultTableModel) diseaseJTable.getModel(); model.setRowCount(0); for (Disease disease : enterprise.getDiseaseCatalog().getDiseaseList()) { Object row[] = new Object[1]; row[0] = disease;/*from w w w . ja v a2s . c o m*/ model.addRow(row); } }
From source file:UserInterface.PowerStationAdminRole.ReviewPerformanceJPanel.java
/** * Creates new form ReviewVaccinePerformanceJPanel *//*from w ww. j a va 2s . 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:dylemator.UserList.java
private void filenameComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filenameComboActionPerformed Object item = this.filenameCombo.getSelectedItem(); exportData = new ArrayList<String[]>(); File file = new File(item.toString()); if (file.exists()) { String datePattern = "(\\d+-\\d+-\\d+)"; Pattern r = Pattern.compile(datePattern); Matcher m = r.matcher(file.getName()); String fileDate;// w ww .j a v a 2 s. c o m if (m.find()) { fileDate = m.group(0); } else fileDate = new Date(file.lastModified()).toString(); DefaultTableModel model = (DefaultTableModel) this.personsTable.getModel(); model.setRowCount(0); model.setColumnCount(0); try { InputStreamReader input = new FileReader(file); BufferedReader bufferReader; bufferReader = new BufferedReader(input); // headers String headerLine = bufferReader.readLine(); String[] headers = headerLine.split(";"); // kod osoby i data badania String[] userHeaders = new String[] { headers[0], headers[1] }; String[] valueHeaders = Arrays.copyOfRange(headers, 4, headers.length); Object[] allHeaders = ArrayUtils.addAll(userHeaders, valueHeaders); for (int header = 0; header < allHeaders.length; header++) { model.addColumn(allHeaders[header]); } exportData.add((String[]) allHeaders); String line; while ((line = bufferReader.readLine()) != null) { String[] fields = line.split(";"); String[] userFields = new String[] { fields[0], fileDate }; String[] valueFields = Arrays.copyOfRange(fields, 4, fields.length); Object[] allValues = ArrayUtils.addAll(userFields, valueFields); model.addRow(allValues); exportData.add((String[]) allValues); } } catch (FileNotFoundException ex) { Logger.getLogger(FindDialog.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(FindDialog.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:net.java.sip.communicator.plugin.propertieseditor.SearchField.java
/** * Runs in {@link #filterThread} to apply {@link #filter} to the displayed * <tt>ConfigurationService</tt> properties. *///from w ww.j a v a2s .c o m private void runInFilterThread() { String prevFilter = null; long prevFilterTime = 0; do { final String filter; synchronized (filterSyncRoot) { filter = this.filter; /* * If the currentThread is idle for too long (which also means * that the filter has not been changed), kill it because we do * not want to keep it alive forever. */ if ((prevFilterTime != 0) && StringUtils.equalsIgnoreCase(filter, prevFilter)) { long timeout = FILTER_THREAD_TIMEOUT - (System.currentTimeMillis() - prevFilterTime); if (timeout > 0) { // The currentThread has been idle but not long enough. try { filterSyncRoot.wait(timeout); continue; } catch (InterruptedException ie) { // The currentThread will die bellow at the break. } } // Commit suicide. if (Thread.currentThread().equals(filterThread)) filterThread = null; break; } } List<String> properties = confService.getAllPropertyNames(); final List<Object[]> rows = new ArrayList<Object[]>(properties.size()); for (String property : properties) { String value = (String) confService.getProperty(property); if ((filter == null) || StringUtils.containsIgnoreCase(property, filter) || StringUtils.containsIgnoreCase(value, filter)) { rows.add(new Object[] { property, confService.getProperty(property) }); } } // If in the meantime someone has changed the filter, we don't want // to update the GUI but filter the results again. if (StringUtils.equalsIgnoreCase(filter, this.filter)) { LowPriorityEventQueue.invokeLater(new Runnable() { public void run() { DefaultTableModel model = (DefaultTableModel) table.getModel(); model.setRowCount(0); for (Object[] row : rows) { model.addRow(row); if (filter != SearchField.this.filter) return; } } }); } prevFilter = filter; prevFilterTime = System.currentTimeMillis(); } while (true); }
From source file:Interface.Caruser.Pendingrequest.java
public void populatetable() { DefaultTableModel model = (DefaultTableModel) incomingjTable.getModel(); model.setRowCount(0); for (WorkRequest request : organization.getWorkQueue().getWorkRequestList()) { Object[] row = new Object[7]; row[0] = request;/*from w w w.j av a2 s .c o m*/ row[1] = request.getSender(); row[2] = request.getReceiver(); row[3] = request.getSource(); row[4] = request.getDestination(); Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); row[5] = formatter.format(request.getRequestDate()); row[6] = request.getStatus(); model.addRow(row); } incomingjTable.setSelectionBackground(Color.getHSBColor(0.2F, 0.1F, 0.2F)); incomingjTable.setSelectionForeground(Color.white); }
From source file:edu.harvard.i2b2.patientMapping.ui.AdminToolSetKeyJPanel.java
private void jAuditButtonActionPerformed(java.awt.event.ActionEvent evt) { String userID = jUserIdTextField.getText();//UserInfoBean.getInstance().getUserName(); String patientID = jPatientIdTextField.getText(); String site = jSiteNameTextField.getText(); String projectID = UserInfoBean.getInstance().getProjectId(); String result = IMQueryClient.getAudit(userID, patientID, projectID, site); PDOResponseMessageModel pdoresponsefactory = new PDOResponseMessageModel(); try {//from www . j av a 2s . c o m List<AuditType> factSets = pdoresponsefactory.getAuditsFromResponseXML(result); if (factSets != null) { log.info("Total audits: " + factSets.size()); jTable1.removeAll(); DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.setRowCount(factSets.size()); for (int i = 0; i < factSets.size(); i++) { AuditType audit = factSets.get(i); jTable1.setValueAt(audit.getProjectId(), i, 0); jTable1.setValueAt(audit.getUserId(), i, 1); jTable1.setValueAt(audit.getPid(), i, 2); jTable1.setValueAt(audit.getSource(), i, 3); jTable1.setValueAt(audit.getImportDate(), i, 4); jTable1.setValueAt(audit.getComment(), i, 5); } // for(int i=0; // i<patientDimensionSet.getPatientDimension().size();i++) { // PatientDimensionType patientType = // patientDimensionSet.getPatientDimension().get(i); // System.out.println("PatientNum: " + // patientType.getPatientNum()); // } } else { //return "error"; } } catch (Exception e) { e.printStackTrace(); } // / testing the visit set // PatientDataType.VisitDimensionSet visitSet = // pdoresponsefactory.getVisitSetFromResponseXML(result); // System.out.println("Total visits: "+visitSet.getVisitDimension(). // size()); }
From source file:userinterface.BioRecyclingRole.BioRecyclingJPanel.java
public void populateRequestTable() { DefaultTableModel model = (DefaultTableModel) jBioRecycling.getModel(); model.setRowCount(0); for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) { Object[] row = new Object[3]; row[0] = request;// w ww. j av a 2 s .c om row[2] = ((BioRecyclingWorkRequest) request).getSegregatedDegradable(); row[1] = ((BioRecyclingWorkRequest) request).getReceiver(); model.addRow(row); } }
From source file:cz.moz.ctmanager.main.DetailsFrame.java
public void refreshList() { //For emails/* w w w. j a v a 2s . c om*/ 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:userinterface.BioRecyclingRole.BioRecyclingJPanel.java
private void jRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRefreshActionPerformed DefaultTableModel model = (DefaultTableModel) jBioRecycling.getModel(); model.setRowCount(0); for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) { Object[] row = new Object[8]; row[0] = request;//from w ww . ja v a 2s . co m 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.doctor.ReportingPatientVitalHistJPanel.java
public void populateVitalTable() { nameJTextField.setText(patient.getName()); idJTextField.setText(patient.getId()); DefaultTableModel dtm = (DefaultTableModel) vitalJTable.getModel(); dtm.setRowCount(0); Object row[] = new Object[6]; for (VitalSignInfo vitalInfo : patient.getVitalHistory().getVitalHistory()) { row[0] = vitalInfo.getRespRate(); row[1] = vitalInfo.getHeartRate(); row[2] = vitalInfo.getSystolicBP(); row[3] = vitalInfo.getWeight();// w w w .j a v a 2s .c o m row[4] = vitalInfo.getCurrentTime(); row[5] = vitalInfo.getSensorId(); dtm.addRow(row); } }