mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
Created ReportProgressPanel API and ReportProgressDialog
This commit is contained in:
parent
37e9548d8d
commit
47ca52f8da
@ -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
|
||||
@ -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
|
||||
|
@ -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
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -184,7 +184,7 @@ class ReportKML implements GeneralReportModule {
|
||||
document.addContent(gpsSearchesFolder);
|
||||
document.addContent(gpsTrackpointsFolder);
|
||||
|
||||
ReportProgressPanel.ReportStatus result = ReportProgressPanel.ReportStatus.COMPLETE;
|
||||
ReportProgressDialog.ReportStatus result = ReportProgressDialog.ReportStatus.COMPLETE;
|
||||
|
||||
/**
|
||||
* In the following code, nulls are okay, and are handled when we go to
|
||||
@ -233,12 +233,12 @@ class ReportKML implements GeneralReportModule {
|
||||
logger.log(Level.WARNING, String.format("Error reading file '%s' (id=%d).", fileName, fileId), ex);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "Could not extract photo information.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Could not extract photos with EXIF metadata.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -254,12 +254,12 @@ class ReportKML implements GeneralReportModule {
|
||||
gpsBookmarksFolder.addContent(makePlacemark(bookmarkName, FeatureColor.BLUE, desc, timestamp, point, formattedCoordinates));
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "Could not extract Bookmark information.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Could not get GPS Bookmarks from database.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -275,12 +275,12 @@ class ReportKML implements GeneralReportModule {
|
||||
gpsLastKnownLocationFolder.addContent(makePlacemark("Last Known Location", FeatureColor.PURPLE, desc, timestamp, point, formattedCoordinates)); //NON-NLS
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "Could not extract Last Known Location information.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Could not get GPS Last Known Location from database.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -308,12 +308,12 @@ class ReportKML implements GeneralReportModule {
|
||||
gpsRouteFolder.addContent(makePlacemark("End", FeatureColor.GREEN, desc, timestamp, endingPoint, formattedCoordinates)); //NON-NLS
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "Could not extract GPS Route information.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Could not get GPS Routes from database.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -336,7 +336,7 @@ class ReportKML implements GeneralReportModule {
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Could not get GPS Searches from database.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -362,12 +362,12 @@ class ReportKML implements GeneralReportModule {
|
||||
gpsTrackpointsFolder.addContent(makePlacemark(trackName, FeatureColor.YELLOW, desc, timestamp, point, formattedCoordinates));
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "Could not extract Trackpoint information.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Could not get GPS Trackpoints from database.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
|
||||
// Copy the style sheet
|
||||
@ -377,14 +377,14 @@ class ReportKML implements GeneralReportModule {
|
||||
FileUtil.copy(input, output);
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error placing KML stylesheet. The .KML file will not function properly.", ex); //NON-NLS
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
|
||||
try (FileOutputStream writer = new FileOutputStream(kmlFileFullPath)) {
|
||||
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
|
||||
outputter.output(kmlDocument, writer);
|
||||
String prependedStatus = "";
|
||||
if (result == ReportProgressPanel.ReportStatus.ERROR) {
|
||||
if (result == ReportProgressDialog.ReportStatus.ERROR) {
|
||||
prependedStatus = "Incomplete ";
|
||||
}
|
||||
Case.getCurrentCaseThrows().addReport(kmlFileFullPath,
|
||||
@ -392,14 +392,14 @@ class ReportKML implements GeneralReportModule {
|
||||
prependedStatus + NbBundle.getMessage(this.getClass(), "ReportKML.genReport.reportName"));
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Could not write the KML file.", ex); //NON-NLS
|
||||
progressPanel.complete(ReportProgressPanel.ReportStatus.ERROR);
|
||||
progressPanel.complete(ReportProgressDialog.ReportStatus.ERROR);
|
||||
} catch (TskCoreException ex) {
|
||||
String errorMessage = String.format("Error adding %s to case as a report", kmlFileFullPath); //NON-NLS
|
||||
logger.log(Level.SEVERE, errorMessage, ex);
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Exception while getting open case.", ex);
|
||||
result = ReportProgressPanel.ReportStatus.ERROR;
|
||||
result = ReportProgressDialog.ReportStatus.ERROR;
|
||||
}
|
||||
|
||||
progressPanel.complete(result);
|
||||
|
@ -79,7 +79,7 @@
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportProgressPanel.reportLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportProgressDialog.reportLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@ -91,7 +91,7 @@
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportProgressPanel.pathLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportProgressDialog.pathLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="verticalAlignment" type="int" value="1"/>
|
||||
</Properties>
|
||||
@ -104,14 +104,14 @@
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportProgressPanel.separationLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportProgressDialog.separationLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="statusMessageLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportProgressPanel.statusMessageLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportProgressDialog.statusMessageLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
373
Core/src/org/sleuthkit/autopsy/report/ReportProgressDialog.java
Normal file
373
Core/src/org/sleuthkit/autopsy/report/ReportProgressDialog.java
Normal file
@ -0,0 +1,373 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2019 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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(), "ReportProgressPanel.progress.queuing"));
|
||||
status = ReportStatus.QUEUING;
|
||||
if (null != reportPath) {
|
||||
pathLabel.setText("<html><u>" + shortenPath(reportPath) + "</u></html>"); //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.
|
||||
*/
|
||||
@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(), "ReportProgressPanel.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(), "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")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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))
|
||||
);
|
||||
}// </editor-fold>//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);
|
||||
}
|
||||
|
||||
}
|
305
Core/src/org/sleuthkit/autopsy/report/ReportProgressPanel.java
Normal file → Executable file
305
Core/src/org/sleuthkit/autopsy/report/ReportProgressPanel.java
Normal file → Executable file
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2018 Basis Technology Corp.
|
||||
* Copyright 2011-2019 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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("<html><u>" + shortenPath(reportPath) + "</u></html>"); //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")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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))
|
||||
);
|
||||
}// </editor-fold>//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();
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ class TableReportGenerator {
|
||||
String currentList = "";
|
||||
while (resultSet.next()) {
|
||||
// Check to see if all the TableReportModules have been canceled
|
||||
if (progressPanel.getStatus() == ReportProgressPanel.ReportStatus.CANCELED) {
|
||||
if (progressPanel.getStatus() == ReportProgressDialog.ReportStatus.CANCELED) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -884,7 +884,7 @@ class TableReportGenerator {
|
||||
String currentSet = "";
|
||||
while (resultSet.next()) {
|
||||
// Check to see if all the TableReportModules have been canceled
|
||||
if (progressPanel.getStatus() == ReportProgressPanel.ReportStatus.CANCELED) {
|
||||
if (progressPanel.getStatus() == ReportProgressDialog.ReportStatus.CANCELED) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public final class CaseUcoFormatExporter {
|
||||
* @param selectedDataSourceId Object ID of the data source
|
||||
* @param reportOutputPath Full path to directory where to save CASE-UCO
|
||||
* report file
|
||||
* @param progressPanel ReportProgressPanel to update progress
|
||||
* @param progressPanel ReportProgressDialog to update progress
|
||||
*/
|
||||
@NbBundle.Messages({
|
||||
"ReportCaseUco.noCaseOpen=Unable to open currect case",
|
||||
|
Loading…
x
Reference in New Issue
Block a user