From 9101f481f882c57e78ffdd47c799b16a3369eeb3 Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Thu, 19 Dec 2024 21:35:16 -0500 Subject: [PATCH] updates --- .../autopsy/casemodule/Bundle.properties | 1 + .../casemodule/Bundle.properties-MERGED | 1 + .../autopsy/casemodule/ImageFilePanel.form | 25 +++++++++++++ .../autopsy/casemodule/ImageFilePanel.java | 35 ++++++++++++++++--- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties b/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties index c53c3085a9..9fc3d3315e 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties @@ -272,3 +272,4 @@ LocalFilesPanel.timeStampToIncludeLabel.text=Timestamps To Include: LocalFilesPanel.timeStampNoteLabel.text=NOTE: Time stamps may have changed when the files were copied to the current location. ImageFilePanel.passwordLabel.text=Bitlocker Password (optional): ImageFilePanel.passwordTextField.text= +ImageFilePanel.loadingLabel.text=loading... diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties-MERGED index 9e7e2d7e81..f711125611 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties-MERGED @@ -510,3 +510,4 @@ LocalFilesPanel.timeStampToIncludeLabel.text=Timestamps To Include: LocalFilesPanel.timeStampNoteLabel.text=NOTE: Time stamps may have changed when the files were copied to the current location. ImageFilePanel.passwordLabel.text=Bitlocker Password (optional): ImageFilePanel.passwordTextField.text= +ImageFilePanel.loadingLabel.text=loading... diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.form index c46749306b..6e3633641d 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.form @@ -310,5 +310,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.java index 7cf1f85183..585a81a1d2 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.java @@ -64,7 +64,7 @@ public class ImageFilePanel extends JPanel { private final String contextName; private final List fileChooserFilters; - private static int VALIDATE_TIMEOUT_MILLIS = 1500; + private static int VALIDATE_TIMEOUT_MILLIS = 1200; static ScheduledThreadPoolExecutor delayedValidationService = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat("ImageFilePanel delayed validation").build()); private Future validateAction = null; @@ -91,6 +91,7 @@ public class ImageFilePanel extends JPanel { sectorSizeComboBox.setSelectedIndex(0); errorLabel.setVisible(false); + loadingLabel.setVisible(false); this.fileChooserFilters = fileChooserFilters; } @@ -198,6 +199,7 @@ public class ImageFilePanel extends JPanel { passwordLabel = new javax.swing.JLabel(); passwordTextField = new javax.swing.JTextField(); javax.swing.JPanel spacer = new javax.swing.JPanel(); + loadingLabel = new javax.swing.JLabel(); setMinimumSize(new java.awt.Dimension(0, 65)); setPreferredSize(new java.awt.Dimension(403, 65)); @@ -425,6 +427,22 @@ public class ImageFilePanel extends JPanel { gridBagConstraints.gridy = 12; gridBagConstraints.weighty = 1.0; add(spacer, gridBagConstraints); + + loadingLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/working_spinner.gif"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(loadingLabel, org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.loadingLabel.text")); // NOI18N + loadingLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); + loadingLabel.setMaximumSize(new java.awt.Dimension(500, 60)); + loadingLabel.setMinimumSize(new java.awt.Dimension(200, 20)); + loadingLabel.setPreferredSize(new java.awt.Dimension(200, 60)); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 11; + gridBagConstraints.gridwidth = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); + add(loadingLabel, gridBagConstraints); }// //GEN-END:initComponents @NbBundle.Messages({"ImageFilePanel.000.confirmationMessage=The selected file" @@ -474,6 +492,7 @@ public class ImageFilePanel extends JPanel { private javax.swing.JLabel errorLabel; private javax.swing.JLabel hashValuesLabel; private javax.swing.JLabel hashValuesNoteLabel; + private javax.swing.JLabel loadingLabel; private javax.swing.JLabel md5HashLabel; private javax.swing.JTextField md5HashTextField; private javax.swing.JCheckBox noFatOrphansCheckbox; @@ -593,10 +612,9 @@ public class ImageFilePanel extends JPanel { "ImageFilePanel_validatePanel_unknownError=

An unknown error occurred while attempting to validate the image

" }) public boolean validatePanel() { - errorLabel.setVisible(false); - String path = getContentPaths(); if (!isImagePathValid()) { + showError(null); return false; } @@ -635,16 +653,18 @@ public class ImageFilePanel extends JPanel { return false; } + showError(null); return true; } /** * Show an error message if error message is non-empty. Otherwise, hide - * error message. + * error message. Either way, hide loading label. * - * @param errorMessage The error message to show. + * @param errorMessage The error message to show or null for no error. */ private void showError(String errorMessage) { + loadingLabel.setVisible(false); if (StringUtils.isNotBlank(errorMessage)) { errorLabel.setVisible(true); errorLabel.setText(errorMessage); @@ -730,6 +750,11 @@ public class ImageFilePanel extends JPanel { if (ImageFilePanel.this.validateAction != null) { ImageFilePanel.this.validateAction.cancel(true); } + + errorLabel.setVisible(false); + if (!ImageFilePanel.this.loadingLabel.isVisible()) { + ImageFilePanel.this.loadingLabel.setVisible(true); + } ImageFilePanel.this.validateAction = ImageFilePanel.this.delayedValidationService.schedule( () -> {