// Get value for a specific row and column combination. public Object getValueAt(int row, int col) { AbstractSeriesDownloader download = downloadList.get(row); switch (col) { case LOCATION_COLUMN: return download.getNode().getDisplayName(); case COLLECTION_COLUMN: return download.getCollection(); case PATIENT_ID_COLUMN: return download.getPatientId(); case STUDY_ID_COLUMN: return download.getStudyInstanceUid(); case SERIES_ID_COLUMN: return download.getSeriesInstanceUid(); case SERIES_ID_COLUMN + 1: long size = download.getSize(); return computeSizeString(size); case SERIES_ID_COLUMN + 2: return download.getNumberOfImages(); case PROGRESS_COLUMN: // Progress return new Float(download.getProgress()); case SERIES_ID_COLUMN + 4: // Status return AbstractSeriesDownloader.STATUSES[download.getStatus()]; } return ""; }
// Add a new download to the table. public void addDownload(AbstractSeriesDownloader download) { // Register to be notified when the download changes. download.addObserver(this); downloadList.add(download); // Fire table row insertion notification to table. fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1); }