/** Close this panel and it's dialog if all reports are done. */ void close() { boolean closeable = true; for (ReportProgressPanel panel : progressPanels) { if (panel.getStatus() != ReportStatus.CANCELED && panel.getStatus() != ReportStatus.COMPLETE) { closeable = false; } } if (closeable) { actionListener.actionPerformed(null); } else { int result = JOptionPane.showConfirmDialog( null, NbBundle.getMessage(this.getClass(), "ReportGenerationPanel.confDlg.sureToClose.msg"), NbBundle.getMessage(this.getClass(), "ReportGenerationPanel.confDlg.title.closing"), JOptionPane.YES_NO_OPTION); if (result == 0) { cancelAllReports(); actionListener.actionPerformed(null); } } }
/** Cancel all reports. */ private void cancelAllReports() { for (ReportProgressPanel panel : progressPanels) { panel.cancel(); } }