public void trimProgressList() { /* * We only trim scans that have completed, so if the user kicks off a load of scans then * we could have a lot more in the list than the 'maximum' */ if (this.progressModel.getSize() > this.getNumberOfScansToShow() + 1) { // Trim past results - the +1 is for the initial 'select scan' message for (int i = 1; i < this.progressModel.getSize(); i++) { int id = this.idForScannerName((String) this.progressModel.getElementAt(i)); GS scan = controller.getScan(id); if (scan != null && scan.isStopped()) { controller.removeScan(id); this.progressModel.removeElementAt(i); if (this.progressModel.getSize() <= this.getNumberOfScansToShow() + 1) { // Have removed enough break; } // Need to remove more, but the indexes will have changed so go back 1 i--; } } } }
public GS getSelectedScanner() { return controller.getScan( this.idForScannerName((String) this.getProgressSelect().getSelectedItem())); }