diff --git a/Core/src/org/sleuthkit/autopsy/report/Bundle.properties b/Core/src/org/sleuthkit/autopsy/report/Bundle.properties
index 45e66b1092..fd94e5fe55 100644
--- a/Core/src/org/sleuthkit/autopsy/report/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/report/Bundle.properties
@@ -12,10 +12,6 @@ ReportVisualPanel2.advancedButton.text=Data Types
ArtifactSelectionDialog.deselectAllButton.text=Deselect All
ArtifactSelectionDialog.selectAllButton.text=Select All
ReportGenerationPanel.closeButton.text=Close
-ReportProgressPanel.reportLabel.text=reportLabel
-ReportProgressPanel.pathLabel.text=pathLabel
-ReportProgressPanel.separationLabel.text=:
-ReportProgressPanel.statusMessageLabel.text=processingLabel
ReportGenerationPanel.titleLabel.text=Report Generation Progress
ReportVisualPanel2.taggedResultsRadioButton.text=Tagged Results
ReportVisualPanel2.allResultsRadioButton.text=All Results
@@ -200,15 +196,15 @@ ReportHTML.writeSum.modulesEnabledHeading=Enabled Modules:
ReportHTML.writeSum.autopsyVersion=Autopsy Version:
ReportHTML.writeSum.timezone=Timezone:
ReportHTML.writeSum.path=Path:
-ReportProgressPanel.progress.queuing=Queuing...
-ReportProgressPanel.initPathLabel.noFile=No report file
-ReportProgressPanel.start.cancelButton.text=Cancel
-ReportProgressPanel.start.progress.text=Starting report...
-ReportProgressPanel.complete.processLbl.text=Complete
-ReportProgressPanel.complete.processLb2.text=Completed with error
-ReportProgressPanel.complete.cancelButton.text=Complete
-ReportProgressPanel.cancel.cancelButton.toolTipText=Canceled
-ReportProgressPanel.cancel.procLbl.text=Canceled
+ReportProgressDialog.progress.queuing=Queuing...
+ReportProgressDialog.initPathLabel.noFile=No report file
+ReportProgressDialog.start.cancelButton.text=Cancel
+ReportProgressDialog.start.progress.text=Starting report...
+ReportProgressDialog.complete.processLbl.text=Complete
+ReportProgressDialog.complete.processLb2.text=Completed with error
+ReportProgressDialog.complete.cancelButton.text=Complete
+ReportProgressDialog.cancel.cancelButton.toolTipText=Canceled
+ReportProgressDialog.cancel.procLbl.text=Canceled
ReportVisualPanel1.getName.text=Select and Configure Report Modules
ReportVisualPanel2.getName.text=Configure Artifact Reports
ReportWizardAction.actionName.text=Generate Report
@@ -270,3 +266,7 @@ ReportFileTextConfigurationPanel.commaDelimitedButton.text=Comma delimited
PortableCaseTagsListPanel.descLabel.text=Include the following tags:
PortableCaseInterestingItemsListPanel.descLabel.text=Include Interesting Items from these sets:
ReportWizardPortableCaseOptionsVisualPanel.compressCheckbox.toolTipText=
+ReportProgressDialog.separationLabel.text=:
+ReportProgressDialog.pathLabel.text=pathLabel
+ReportProgressDialog.reportLabel.text=reportLabel
+ReportProgressDialog.statusMessageLabel.text=processingLabel
diff --git a/Core/src/org/sleuthkit/autopsy/report/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/report/Bundle.properties-MERGED
index 53aa1acfbd..ea5d7670a5 100755
--- a/Core/src/org/sleuthkit/autopsy/report/Bundle.properties-MERGED
+++ b/Core/src/org/sleuthkit/autopsy/report/Bundle.properties-MERGED
@@ -72,10 +72,6 @@ ReportVisualPanel2.advancedButton.text=Data Types
ArtifactSelectionDialog.deselectAllButton.text=Deselect All
ArtifactSelectionDialog.selectAllButton.text=Select All
ReportGenerationPanel.closeButton.text=Close
-ReportProgressPanel.reportLabel.text=reportLabel
-ReportProgressPanel.pathLabel.text=pathLabel
-ReportProgressPanel.separationLabel.text=:
-ReportProgressPanel.statusMessageLabel.text=processingLabel
ReportGenerationPanel.titleLabel.text=Report Generation Progress
ReportVisualPanel2.taggedResultsRadioButton.text=Tagged Results
ReportVisualPanel2.allResultsRadioButton.text=All Results
@@ -260,15 +256,15 @@ ReportHTML.writeSum.modulesEnabledHeading=Enabled Modules:
ReportHTML.writeSum.autopsyVersion=Autopsy Version:
ReportHTML.writeSum.timezone=Timezone:
ReportHTML.writeSum.path=Path:
-ReportProgressPanel.progress.queuing=Queuing...
-ReportProgressPanel.initPathLabel.noFile=No report file
-ReportProgressPanel.start.cancelButton.text=Cancel
-ReportProgressPanel.start.progress.text=Starting report...
-ReportProgressPanel.complete.processLbl.text=Complete
-ReportProgressPanel.complete.processLb2.text=Completed with error
-ReportProgressPanel.complete.cancelButton.text=Complete
-ReportProgressPanel.cancel.cancelButton.toolTipText=Canceled
-ReportProgressPanel.cancel.procLbl.text=Canceled
+ReportProgressDialog.progress.queuing=Queuing...
+ReportProgressDialog.initPathLabel.noFile=No report file
+ReportProgressDialog.start.cancelButton.text=Cancel
+ReportProgressDialog.start.progress.text=Starting report...
+ReportProgressDialog.complete.processLbl.text=Complete
+ReportProgressDialog.complete.processLb2.text=Completed with error
+ReportProgressDialog.complete.cancelButton.text=Complete
+ReportProgressDialog.cancel.cancelButton.toolTipText=Canceled
+ReportProgressDialog.cancel.procLbl.text=Canceled
ReportVisualPanel1.getName.text=Select and Configure Report Modules
ReportVisualPanel2.getName.text=Configure Artifact Reports
ReportWizardAction.actionName.text=Generate Report
@@ -330,5 +326,9 @@ ReportFileTextConfigurationPanel.commaDelimitedButton.text=Comma delimited
PortableCaseTagsListPanel.descLabel.text=Include the following tags:
PortableCaseInterestingItemsListPanel.descLabel.text=Include Interesting Items from these sets:
ReportWizardPortableCaseOptionsVisualPanel.compressCheckbox.toolTipText=
+ReportProgressDialog.separationLabel.text=:
+ReportProgressDialog.pathLabel.text=pathLabel
+ReportProgressDialog.reportLabel.text=reportLabel
+ReportProgressDialog.statusMessageLabel.text=processingLabel
ReportWizardPortableCaseOptionsVisualPanel.getName.title=Choose Portable Case settings
TableReportGenerator.StatusColumn.Header=Review Status
diff --git a/Core/src/org/sleuthkit/autopsy/report/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/report/Bundle_ja.properties
index b4c2844989..6c2db29da2 100644
--- a/Core/src/org/sleuthkit/autopsy/report/Bundle_ja.properties
+++ b/Core/src/org/sleuthkit/autopsy/report/Bundle_ja.properties
@@ -11,10 +11,6 @@ ReportVisualPanel2.advancedButton.text=\u30c7\u30fc\u30bf\u30bf\u30a4\u30d7
ArtifactSelectionDialog.deselectAllButton.text=\u5168\u3066\u9078\u629e\u89e3\u9664
ArtifactSelectionDialog.selectAllButton.text=\u5168\u3066\u9078\u629e
ReportGenerationPanel.closeButton.text=\u9589\u3058\u308b
-ReportProgressPanel.reportLabel.text=\u30ec\u30dd\u30fc\u30c8\u30e9\u30d9\u30eb
-ReportProgressPanel.pathLabel.text=\u30d1\u30b9\u30e9\u30d9\u30eb
-ReportProgressPanel.separationLabel.text=:
-ReportProgressPanel.statusMessageLabel.text=\u30d7\u30ed\u30bb\u30b7\u30f3\u30b0\u30e9\u30d9\u30eb
ReportGenerationPanel.titleLabel.text=\u30ec\u30dd\u30fc\u30c8\u751f\u6210\u30d7\u30ed\u30b0\u30ec\u30b9
ReportVisualPanel2.taggedResultsRadioButton.text=\u30bf\u30b0\u3055\u308c\u305f\u7d50\u679c
ReportVisualPanel2.allResultsRadioButton.text=\u5168\u3066\u306e\u7d50\u679c
@@ -244,3 +240,7 @@ ReportGenerationPanel.confDlg.cancelReport.msg=\u672c\u5f53\u306b\u30ec\u30dd\u3
ReportProgressPanel.complete.processLb2.text=\u5b8c\u4e86\u3057\u307e\u3057\u305f\u304c\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f
ReportGenerationPanel.cancelButton.actionCommand=\u30ad\u30e3\u30f3\u30bb\u30eb
ReportGenerationPanel.cancelButton.text=\u30ad\u30e3\u30f3\u30bb\u30eb
+ReportProgressDialog.separationLabel.text=:
+ReportProgressDialog.pathLabel.text=\u30d1\u30b9\u30e9\u30d9\u30eb
+ReportProgressDialog.reportLabel.text=\u30ec\u30dd\u30fc\u30c8\u30e9\u30d9\u30eb
+ReportProgressDialog.statusMessageLabel.text=\u30d7\u30ed\u30bb\u30b7\u30f3\u30b0\u30e9\u30d9\u30eb
diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportGenerationPanel.java b/Core/src/org/sleuthkit/autopsy/report/ReportGenerationPanel.java
index c9bf291314..53c17b3543 100644
--- a/Core/src/org/sleuthkit/autopsy/report/ReportGenerationPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/report/ReportGenerationPanel.java
@@ -24,7 +24,6 @@ import java.beans.PropertyChangeEvent;
import javax.swing.Box;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
-
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus;
@@ -39,7 +38,7 @@ class ReportGenerationPanel extends javax.swing.JPanel {
private final GridBagConstraints constraints;
private final Component glue;
private ActionListener actionListener;
- ReportProgressPanel progressPanel;
+ ReportProgressDialog progressPanel;
/**
* Constructs a panel that displays a panel used by a report generation
@@ -65,13 +64,13 @@ class ReportGenerationPanel extends javax.swing.JPanel {
*
* @return The report generation progress panel.
*/
- ReportProgressPanel addReport(String reportName, String reportPath) {
+ ReportProgressDialog addReport(String reportName, String reportPath) {
/*
* Remove the "glue."
*/
reportPanel.remove(glue);
- progressPanel = new ReportProgressPanel(reportName, reportPath);
+ progressPanel = new ReportProgressDialog(reportName, reportPath);
constraints.weighty = 0.0;
constraints.anchor = GridBagConstraints.NORTH;
reportPanel.add(progressPanel, constraints);
diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java
index 3a092efc83..55f5809a7e 100644
--- a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java
+++ b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java
@@ -184,7 +184,7 @@ class ReportKML implements GeneralReportModule {
document.addContent(gpsSearchesFolder);
document.addContent(gpsTrackpointsFolder);
- ReportProgressPanel.ReportStatus result = ReportProgressPanel.ReportStatus.COMPLETE;
+ ReportProgressDialog.ReportStatus result = ReportProgressPanel.ReportStatus.COMPLETE;
/**
* In the following code, nulls are okay, and are handled when we go to
diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportProgressPanel.form b/Core/src/org/sleuthkit/autopsy/report/ReportProgressDialog.form
similarity index 90%
rename from Core/src/org/sleuthkit/autopsy/report/ReportProgressPanel.form
rename to Core/src/org/sleuthkit/autopsy/report/ReportProgressDialog.form
index 597dd89df4..8979a5d188 100644
--- a/Core/src/org/sleuthkit/autopsy/report/ReportProgressPanel.form
+++ b/Core/src/org/sleuthkit/autopsy/report/ReportProgressDialog.form
@@ -79,7 +79,7 @@
-
+
@@ -91,7 +91,7 @@
-
+
@@ -104,14 +104,14 @@
-
+
-
+
diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportProgressDialog.java b/Core/src/org/sleuthkit/autopsy/report/ReportProgressDialog.java
new file mode 100644
index 0000000000..ddb32686e9
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/report/ReportProgressDialog.java
@@ -0,0 +1,373 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2011-2019 Basis Technology Corp.
+ * Contact: carrier sleuthkit org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.sleuthkit.autopsy.report;
+
+import org.openide.util.NbBundle;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Desktop;
+import java.awt.EventQueue;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Level;
+import org.sleuthkit.autopsy.coreutils.Logger;
+
+/**
+ * A panel used by a report generation module to show progress.
+ */
+@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
+public class ReportProgressDialog extends javax.swing.JPanel implements ReportProgressPanel {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger logger = Logger.getLogger(ReportProgressDialog.class.getName());
+ private static final Color GREEN = new Color(50, 205, 50);
+ private static final Color RED = new Color(178, 34, 34);
+ private volatile ReportProgressPanel.ReportStatus status;
+
+ /**
+ * Constructs a panel used by report generation module to show progress.
+ *
+ * @param reportName The name of the report being generated.
+ * @param reportPath The path to the report file.
+ */
+ ReportProgressDialog(String reportName, String reportPath) {
+ initComponents();
+ reportProgressBar.setIndeterminate(true);
+ reportProgressBar.setMaximum(100);
+ reportLabel.setText(reportName);
+ statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressDialog.progress.queuing"));
+ status = ReportStatus.QUEUING;
+ if (null != reportPath) {
+ pathLabel.setText("" + shortenPath(reportPath) + ""); //NON-NLS
+ pathLabel.setToolTipText(reportPath);
+ String linkPath = reportPath;
+ pathLabel.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseClicked(MouseEvent mouseEvent) {
+ }
+
+ @Override
+ public void mousePressed(MouseEvent mouseEvent) {
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent mouseEvent) {
+ File file = new File(linkPath);
+ try {
+ Desktop.getDesktop().open(file);
+ } catch (IOException ioex) {
+ logger.log(Level.SEVERE, "Error opening report file", ioex);
+ } catch (IllegalArgumentException iaEx) {
+ logger.log(Level.SEVERE, "Error opening report file", iaEx);
+ try {
+ Desktop.getDesktop().open(file.getParentFile());
+ } catch (IOException ioEx2) {
+ logger.log(Level.SEVERE, "Error opening report file parent", ioEx2);
+ }
+ }
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e3) {
+ pathLabel.setForeground(Color.DARK_GRAY);
+ setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e4) {
+ pathLabel.setForeground(Color.BLACK);
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ });
+ } else {
+ pathLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressDialog.initPathLabel.noFile"));
+ }
+ }
+
+ /**
+ * Gets the current status of the generation of the report.
+ *
+ * @return The report generation status as a ReportStatus enum.
+ */
+ @Override
+ public ReportStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * Starts the progress bar component of this panel.
+ */
+ @Override
+ public void start() {
+ EventQueue.invokeLater(() -> {
+ statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressDialog.start.progress.text"));
+ status = ReportStatus.RUNNING;
+ });
+ }
+
+ /**
+ * Sets the maximum value of the progress bar component of this panel.
+ *
+ * @param max The maximum value.
+ */
+ @Override
+ public void setMaximumProgress(int max) {
+ EventQueue.invokeLater(() -> {
+ if (status != ReportStatus.CANCELED) {
+ reportProgressBar.setMaximum(max);
+ }
+ });
+ }
+
+ /**
+ * Increments the current value of the progress bar component of this panel
+ * by one unit.
+ */
+ @Override
+ public void increment() {
+ EventQueue.invokeLater(() -> {
+ if (status != ReportStatus.CANCELED) {
+ reportProgressBar.setValue(reportProgressBar.getValue() + 1);
+ }
+ });
+ }
+
+ /**
+ * Sets the current value of the progress bar component of this panel.
+ *
+ * @param value The value to be set.
+ */
+ @Override
+ public void setProgress(int value) {
+ EventQueue.invokeLater(() -> {
+ if (status != ReportStatus.CANCELED) {
+ reportProgressBar.setValue(value);
+ }
+ });
+ }
+
+ /**
+ * Changes the the progress bar component of this panel to be determinate or
+ * indeterminate.
+ *
+ * @param indeterminate True if the progress bar should be set to
+ * indeterminate.
+ */
+ @Override
+ public void setIndeterminate(boolean indeterminate) {
+ EventQueue.invokeLater(() -> {
+ if (status != ReportStatus.CANCELED) {
+ reportProgressBar.setIndeterminate(indeterminate);
+ }
+ });
+ }
+
+ /**
+ * Changes the status message label component of this panel to show a given
+ * processing status message. For example, updateStatusLabel("Now processing
+ * files...") sets the label text to "Now processing files..."
+ *
+ * @param statusMessage String to use as label text.
+ */
+ @Override
+ public void updateStatusLabel(String statusMessage) {
+ EventQueue.invokeLater(() -> {
+ if (status != ReportStatus.CANCELED) {
+ statusMessageLabel.setText(statusMessage);
+ }
+ });
+ }
+
+ /**
+ * Makes the components of this panel indicate the final status of
+ * generation of the report.
+ *
+ * @param reportStatus The final status, must be COMPLETE or ERROR.
+ */
+ @Override
+ public void complete(ReportStatus reportStatus) {
+ EventQueue.invokeLater(() -> {
+ reportProgressBar.setIndeterminate(false);
+ if (status != ReportStatus.CANCELED) {
+ switch (reportStatus) {
+ case COMPLETE: {
+ ReportStatus oldValue = status;
+ status = ReportStatus.COMPLETE;
+ statusMessageLabel.setForeground(Color.BLACK);
+ statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressDialog.complete.processLbl.text"));
+ reportProgressBar.setValue(reportProgressBar.getMaximum());
+ reportProgressBar.setStringPainted(true);
+ reportProgressBar.setForeground(GREEN);
+ reportProgressBar.setString("Complete"); //NON-NLS
+ firePropertyChange(ReportStatus.COMPLETE.toString(), oldValue, status);
+ break;
+ }
+ case ERROR: {
+ ReportStatus oldValue = status;
+ status = ReportStatus.ERROR;
+ statusMessageLabel.setForeground(RED);
+ statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressDialog.complete.processLb2.text"));
+ reportProgressBar.setValue(reportProgressBar.getMaximum());
+ reportProgressBar.setStringPainted(true);
+ reportProgressBar.setForeground(RED);
+ reportProgressBar.setString("Error"); //NON-NLS
+ firePropertyChange(ReportStatus.COMPLETE.toString(), oldValue, status);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Makes the components of this panel indicate generation of the report was
+ * cancelled.
+ */
+ void cancel() {
+ switch (status) {
+ case COMPLETE:
+ break;
+ case CANCELED:
+ break;
+ case ERROR:
+ break;
+ default:
+ ReportStatus oldValue = status;
+ status = ReportStatus.CANCELED;
+ reportProgressBar.setIndeterminate(false);
+ reportProgressBar.setValue(0);
+ reportProgressBar.setStringPainted(true);
+ reportProgressBar.setForeground(RED); // Red
+ reportProgressBar.setString("Cancelled"); //NON-NLS
+ firePropertyChange(ReportStatus.CANCELED.toString(), oldValue, status);
+ statusMessageLabel.setForeground(RED);
+ statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressDialog.cancel.procLbl.text"));
+ break;
+ }
+ }
+
+ /**
+ * Gets a shortened version of a file path.
+ *
+ * @param path The path to shorten.
+ *
+ * @return The shortened path.
+ */
+ private String shortenPath(String path) {
+ if (path.length() > 100) {
+ return path.substring(0, 10 + path.substring(10).indexOf(File.separator) + 1) + "..."
+ + path.substring((path.length() - 70) + path.substring(path.length() - 70).indexOf(File.separator));
+ } else {
+ return path;
+ }
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ reportProgressBar = new javax.swing.JProgressBar();
+ reportLabel = new javax.swing.JLabel();
+ pathLabel = new javax.swing.JLabel();
+ separationLabel = new javax.swing.JLabel();
+ statusMessageLabel = new javax.swing.JLabel();
+
+ setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11));
+ setMinimumSize(new java.awt.Dimension(486, 68));
+
+ reportProgressBar.setFont(reportProgressBar.getFont().deriveFont(reportProgressBar.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
+
+ reportLabel.setFont(reportLabel.getFont().deriveFont(reportLabel.getFont().getStyle() | java.awt.Font.BOLD, 11));
+ org.openide.awt.Mnemonics.setLocalizedText(reportLabel, org.openide.util.NbBundle.getMessage(ReportProgressDialog.class, "ReportProgressDialog.reportLabel.text")); // NOI18N
+
+ pathLabel.setFont(pathLabel.getFont().deriveFont(pathLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
+ org.openide.awt.Mnemonics.setLocalizedText(pathLabel, org.openide.util.NbBundle.getMessage(ReportProgressDialog.class, "ReportProgressDialog.pathLabel.text")); // NOI18N
+ pathLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
+
+ separationLabel.setFont(separationLabel.getFont().deriveFont(separationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
+ org.openide.awt.Mnemonics.setLocalizedText(separationLabel, org.openide.util.NbBundle.getMessage(ReportProgressDialog.class, "ReportProgressDialog.separationLabel.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(statusMessageLabel, org.openide.util.NbBundle.getMessage(ReportProgressDialog.class, "ReportProgressDialog.statusMessageLabel.text")); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(statusMessageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(reportProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(reportLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(separationLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pathLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 548, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(reportProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(reportLabel)
+ .addComponent(pathLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(separationLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(statusMessageLabel)
+ .addGap(13, 13, 13))
+ );
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel pathLabel;
+ private javax.swing.JLabel reportLabel;
+ private javax.swing.JProgressBar reportProgressBar;
+ private javax.swing.JLabel separationLabel;
+ private javax.swing.JLabel statusMessageLabel;
+ // End of variables declaration//GEN-END:variables
+
+ /**
+ * Makes the components of this panel indicate the generation of the report
+ * is completed.
+ *
+ * @deprecated Use {@link #complete(ReportStatus)}
+ */
+ @Deprecated
+ @Override
+ public void complete() {
+ complete(ReportStatus.COMPLETE);
+ }
+
+}
diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportProgressLogger.java b/Core/src/org/sleuthkit/autopsy/report/ReportProgressLogger.java
new file mode 100755
index 0000000000..210fdc2815
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/report/ReportProgressLogger.java
@@ -0,0 +1,157 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2019 Basis Technology Corp.
+ * Contact: carrier sleuthkit org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.sleuthkit.autopsy.report;
+
+import java.util.logging.Level;
+import org.sleuthkit.autopsy.coreutils.Logger;
+
+/**
+ * Writes progress and status messages to the application log.
+ */
+class ReportProgressLogger implements ReportProgressPanel {
+
+ private static final Logger logger = Logger.getLogger(ReportProgressLogger.class.getName());
+ private volatile ReportProgressPanel.ReportStatus status;
+
+ ReportProgressLogger() {
+ status = ReportStatus.QUEUING;
+ }
+
+ /**
+ * Gets the current status of the generation of the report.
+ *
+ * @return The report generation status as a ReportStatus enum.
+ */
+ @Override
+ public ReportStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * Logs that the report has been started.
+ */
+ @Override
+ public void start() {
+ status = ReportStatus.RUNNING;
+ logger.log(Level.INFO, "Report started");
+ }
+
+ /**
+ * NO-OP.
+ *
+ * @param max The maximum value.
+ */
+ @Override
+ public void setMaximumProgress(int max) {
+ }
+
+ /**
+ * NO-OP.
+ */
+ @Override
+ public void increment() {
+ }
+
+ /**
+ * NO-OP.
+ *
+ * @param value The value to be set.
+ */
+ @Override
+ public void setProgress(int value) {
+ }
+
+ /**
+ * NO-OP.
+ *
+ * @param indeterminate True if the progress bar should be set to
+ * indeterminate.
+ */
+ @Override
+ public void setIndeterminate(boolean indeterminate) {
+ }
+
+ /**
+ * Logs the status message.
+ *
+ * @param statusMessage String to use as label text.
+ */
+ @Override
+ public void updateStatusLabel(String statusMessage) {
+ if (status != ReportStatus.CANCELED) {
+ logger.log(Level.INFO, statusMessage);
+ }
+ }
+
+ /**
+ * Logs the final status of the report generation.
+ *
+ * @param reportStatus The final status, must be COMPLETE or ERROR.
+ */
+ @Override
+ public void complete(ReportStatus reportStatus) {
+ if (status != ReportStatus.CANCELED) {
+ switch (reportStatus) {
+ case COMPLETE: {
+ status = ReportStatus.COMPLETE;
+ logger.log(Level.INFO, "Report completed");
+ break;
+ }
+ case ERROR: {
+ status = ReportStatus.ERROR;
+ logger.log(Level.INFO, "Report completed with errors");
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Logs that the generation of the report was cancelled.
+ */
+ void cancel() {
+ switch (status) {
+ case COMPLETE:
+ break;
+ case CANCELED:
+ break;
+ case ERROR:
+ break;
+ default:
+ status = ReportStatus.CANCELED;
+ logger.log(Level.INFO, "Report cancelled");
+ break;
+ }
+ }
+
+ /**
+ * Logs the final status of the report generation.
+ *
+ * @deprecated Use {@link #complete(ReportStatus)}
+ */
+ @Deprecated
+ @Override
+ public void complete() {
+ complete(ReportStatus.COMPLETE);
+ }
+
+}
diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportProgressPanel.java b/Core/src/org/sleuthkit/autopsy/report/ReportProgressPanel.java
old mode 100644
new mode 100755
index 9d3fd1bf41..4e985163f7
--- a/Core/src/org/sleuthkit/autopsy/report/ReportProgressPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/report/ReportProgressPanel.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2011-2018 Basis Technology Corp.
+ * Copyright 2011-2019 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,31 +18,13 @@
*/
package org.sleuthkit.autopsy.report;
-import org.openide.util.NbBundle;
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Desktop;
-import java.awt.EventQueue;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.io.IOException;
-import java.util.logging.Level;
-import org.sleuthkit.autopsy.coreutils.Logger;
-
/**
- * A panel used by a report generation module to show progress.
+ * This interface is necessary in order to not break backwards compatibility
+ * of GeneralReportModule interface. See JIRA-5354.
*/
-@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
-public class ReportProgressPanel extends javax.swing.JPanel {
-
- private static final long serialVersionUID = 1L;
- private static final Logger logger = Logger.getLogger(ReportProgressPanel.class.getName());
- private static final Color GREEN = new Color(50, 205, 50);
- private static final Color RED = new Color(178, 34, 34);
- private volatile ReportStatus status;
-
- /**
+public interface ReportProgressPanel {
+
+ /**
* Used by a report generation module to communicate report generation
* status to this panel and its listeners.
*/
@@ -53,125 +35,39 @@ public class ReportProgressPanel extends javax.swing.JPanel {
COMPLETE,
CANCELED,
ERROR
- }
-
- /**
- * Constructs a panel used by report generation module to show progress.
- *
- * @param reportName The name of the report being generated.
- * @param reportPath The path to the report file.
- */
- public ReportProgressPanel(String reportName, String reportPath) {
- initComponents();
- reportProgressBar.setIndeterminate(true);
- reportProgressBar.setMaximum(100);
- reportLabel.setText(reportName);
- statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressPanel.progress.queuing"));
- status = ReportStatus.QUEUING;
- if (null != reportPath) {
- pathLabel.setText("" + shortenPath(reportPath) + ""); //NON-NLS
- pathLabel.setToolTipText(reportPath);
- String linkPath = reportPath;
- pathLabel.addMouseListener(new MouseListener() {
-
- @Override
- public void mouseClicked(MouseEvent mouseEvent) {
- }
-
- @Override
- public void mousePressed(MouseEvent mouseEvent) {
- }
-
- @Override
- public void mouseReleased(MouseEvent mouseEvent) {
- File file = new File(linkPath);
- try {
- Desktop.getDesktop().open(file);
- } catch (IOException ioex) {
- logger.log(Level.SEVERE, "Error opening report file", ioex);
- } catch (IllegalArgumentException iaEx) {
- logger.log(Level.SEVERE, "Error opening report file", iaEx);
- try {
- Desktop.getDesktop().open(file.getParentFile());
- } catch (IOException ioEx2) {
- logger.log(Level.SEVERE, "Error opening report file parent", ioEx2);
- }
- }
- }
-
- @Override
- public void mouseEntered(MouseEvent e3) {
- pathLabel.setForeground(Color.DARK_GRAY);
- setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- }
-
- @Override
- public void mouseExited(MouseEvent e4) {
- pathLabel.setForeground(Color.BLACK);
- setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- }
- });
- } else {
- pathLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressPanel.initPathLabel.noFile"));
- }
- }
-
+ }
+
/**
* Gets the current status of the generation of the report.
*
* @return The report generation status as a ReportStatus enum.
*/
- public ReportStatus getStatus() {
- return status;
- }
+ public ReportStatus getStatus();
/**
* Starts the progress bar component of this panel.
*/
- public void start() {
- EventQueue.invokeLater(() -> {
- statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressPanel.start.progress.text"));
- status = ReportStatus.RUNNING;
- });
- }
+ public void start();
/**
* Sets the maximum value of the progress bar component of this panel.
*
* @param max The maximum value.
*/
- public void setMaximumProgress(int max) {
- EventQueue.invokeLater(() -> {
- if (status != ReportStatus.CANCELED) {
- reportProgressBar.setMaximum(max);
- }
- });
- }
+ public void setMaximumProgress(int max);
/**
* Increments the current value of the progress bar component of this panel
* by one unit.
*/
- public void increment() {
- EventQueue.invokeLater(() -> {
- if (status != ReportStatus.CANCELED) {
- reportProgressBar.setValue(reportProgressBar.getValue() + 1);
- }
- });
- }
+ public void increment();
/**
* Sets the current value of the progress bar component of this panel.
*
* @param value The value to be set.
*/
- public void setProgress(int value) {
- EventQueue.invokeLater(() -> {
- if (status != ReportStatus.CANCELED) {
- reportProgressBar.setValue(value);
- }
- });
- }
+ public void setProgress(int value);
/**
* Changes the the progress bar component of this panel to be determinate or
@@ -180,13 +76,7 @@ public class ReportProgressPanel extends javax.swing.JPanel {
* @param indeterminate True if the progress bar should be set to
* indeterminate.
*/
- public void setIndeterminate(boolean indeterminate) {
- EventQueue.invokeLater(() -> {
- if (status != ReportStatus.CANCELED) {
- reportProgressBar.setIndeterminate(indeterminate);
- }
- });
- }
+ public void setIndeterminate(boolean indeterminate);
/**
* Changes the status message label component of this panel to show a given
@@ -195,13 +85,7 @@ public class ReportProgressPanel extends javax.swing.JPanel {
*
* @param statusMessage String to use as label text.
*/
- public void updateStatusLabel(String statusMessage) {
- EventQueue.invokeLater(() -> {
- if (status != ReportStatus.CANCELED) {
- statusMessageLabel.setText(statusMessage);
- }
- });
- }
+ public void updateStatusLabel(String statusMessage);
/**
* Makes the components of this panel indicate the final status of
@@ -209,159 +93,7 @@ public class ReportProgressPanel extends javax.swing.JPanel {
*
* @param reportStatus The final status, must be COMPLETE or ERROR.
*/
- public void complete(ReportStatus reportStatus) {
- EventQueue.invokeLater(() -> {
- reportProgressBar.setIndeterminate(false);
- if (status != ReportStatus.CANCELED) {
- switch (reportStatus) {
- case COMPLETE: {
- ReportStatus oldValue = status;
- status = ReportStatus.COMPLETE;
- statusMessageLabel.setForeground(Color.BLACK);
- statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressPanel.complete.processLbl.text"));
- reportProgressBar.setValue(reportProgressBar.getMaximum());
- reportProgressBar.setStringPainted(true);
- reportProgressBar.setForeground(GREEN);
- reportProgressBar.setString("Complete"); //NON-NLS
- firePropertyChange(ReportStatus.COMPLETE.toString(), oldValue, status);
- break;
- }
- case ERROR: {
- ReportStatus oldValue = status;
- status = ReportStatus.ERROR;
- statusMessageLabel.setForeground(RED);
- statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressPanel.complete.processLb2.text"));
- reportProgressBar.setValue(reportProgressBar.getMaximum());
- reportProgressBar.setStringPainted(true);
- reportProgressBar.setForeground(RED);
- reportProgressBar.setString("Error"); //NON-NLS
- firePropertyChange(ReportStatus.COMPLETE.toString(), oldValue, status);
- break;
- }
- default: {
- break;
- }
- }
- }
- });
- }
-
- /**
- * Makes the components of this panel indicate generation of the report was
- * cancelled.
- */
- void cancel() {
- switch (status) {
- case COMPLETE:
- break;
- case CANCELED:
- break;
- case ERROR:
- break;
- default:
- ReportStatus oldValue = status;
- status = ReportStatus.CANCELED;
- reportProgressBar.setIndeterminate(false);
- reportProgressBar.setValue(0);
- reportProgressBar.setStringPainted(true);
- reportProgressBar.setForeground(RED); // Red
- reportProgressBar.setString("Cancelled"); //NON-NLS
- firePropertyChange(ReportStatus.CANCELED.toString(), oldValue, status);
- statusMessageLabel.setForeground(RED);
- statusMessageLabel.setText(NbBundle.getMessage(this.getClass(), "ReportProgressPanel.cancel.procLbl.text"));
- break;
- }
- }
-
- /**
- * Gets a shortened version of a file path.
- *
- * @param path The path to shorten.
- *
- * @return The shortened path.
- */
- private String shortenPath(String path) {
- if (path.length() > 100) {
- return path.substring(0, 10 + path.substring(10).indexOf(File.separator) + 1) + "..."
- + path.substring((path.length() - 70) + path.substring(path.length() - 70).indexOf(File.separator));
- } else {
- return path;
- }
- }
-
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- reportProgressBar = new javax.swing.JProgressBar();
- reportLabel = new javax.swing.JLabel();
- pathLabel = new javax.swing.JLabel();
- separationLabel = new javax.swing.JLabel();
- statusMessageLabel = new javax.swing.JLabel();
-
- setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11));
- setMinimumSize(new java.awt.Dimension(486, 68));
-
- reportProgressBar.setFont(reportProgressBar.getFont().deriveFont(reportProgressBar.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
-
- reportLabel.setFont(reportLabel.getFont().deriveFont(reportLabel.getFont().getStyle() | java.awt.Font.BOLD, 11));
- org.openide.awt.Mnemonics.setLocalizedText(reportLabel, org.openide.util.NbBundle.getMessage(ReportProgressPanel.class, "ReportProgressPanel.reportLabel.text")); // NOI18N
-
- pathLabel.setFont(pathLabel.getFont().deriveFont(pathLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
- org.openide.awt.Mnemonics.setLocalizedText(pathLabel, org.openide.util.NbBundle.getMessage(ReportProgressPanel.class, "ReportProgressPanel.pathLabel.text")); // NOI18N
- pathLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
-
- separationLabel.setFont(separationLabel.getFont().deriveFont(separationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
- org.openide.awt.Mnemonics.setLocalizedText(separationLabel, org.openide.util.NbBundle.getMessage(ReportProgressPanel.class, "ReportProgressPanel.separationLabel.text")); // NOI18N
-
- org.openide.awt.Mnemonics.setLocalizedText(statusMessageLabel, org.openide.util.NbBundle.getMessage(ReportProgressPanel.class, "ReportProgressPanel.statusMessageLabel.text")); // NOI18N
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
- this.setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(statusMessageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(reportProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addComponent(reportLabel)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(separationLabel)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pathLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 548, Short.MAX_VALUE)))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(reportProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(reportLabel)
- .addComponent(pathLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(separationLabel))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(statusMessageLabel)
- .addGap(13, 13, 13))
- );
- }// //GEN-END:initComponents
-
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JLabel pathLabel;
- private javax.swing.JLabel reportLabel;
- private javax.swing.JProgressBar reportProgressBar;
- private javax.swing.JLabel separationLabel;
- private javax.swing.JLabel statusMessageLabel;
- // End of variables declaration//GEN-END:variables
+ public void complete(ReportStatus reportStatus);
/**
* Makes the components of this panel indicate the generation of the report
@@ -370,8 +102,5 @@ public class ReportProgressPanel extends javax.swing.JPanel {
* @deprecated Use {@link #complete(ReportStatus)}
*/
@Deprecated
- public void complete() {
- complete(ReportStatus.COMPLETE);
- }
-
+ public void complete();
}