This commit is contained in:
Greg DiCristofaro 2024-12-19 21:35:16 -05:00
parent 3689e89937
commit 9101f481f8
No known key found for this signature in database
4 changed files with 57 additions and 5 deletions

View File

@ -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. 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.passwordLabel.text=Bitlocker Password (optional):
ImageFilePanel.passwordTextField.text= ImageFilePanel.passwordTextField.text=
ImageFilePanel.loadingLabel.text=loading...

View File

@ -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. 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.passwordLabel.text=Bitlocker Password (optional):
ImageFilePanel.passwordTextField.text= ImageFilePanel.passwordTextField.text=
ImageFilePanel.loadingLabel.text=loading...

View File

@ -310,5 +310,30 @@
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
</Container> </Container>
<Component class="javax.swing.JLabel" name="loadingLabel">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/working_spinner.gif"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="ImageFilePanel.loadingLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="verticalAlignment" type="int" value="1"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[500, 60]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[200, 20]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[200, 60]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="11" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="5" insetsRight="5" anchor="18" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -64,7 +64,7 @@ public class ImageFilePanel extends JPanel {
private final String contextName; private final String contextName;
private final List<FileFilter> fileChooserFilters; private final List<FileFilter> 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()); static ScheduledThreadPoolExecutor delayedValidationService = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat("ImageFilePanel delayed validation").build());
private Future<Void> validateAction = null; private Future<Void> validateAction = null;
@ -91,6 +91,7 @@ public class ImageFilePanel extends JPanel {
sectorSizeComboBox.setSelectedIndex(0); sectorSizeComboBox.setSelectedIndex(0);
errorLabel.setVisible(false); errorLabel.setVisible(false);
loadingLabel.setVisible(false);
this.fileChooserFilters = fileChooserFilters; this.fileChooserFilters = fileChooserFilters;
} }
@ -198,6 +199,7 @@ public class ImageFilePanel extends JPanel {
passwordLabel = new javax.swing.JLabel(); passwordLabel = new javax.swing.JLabel();
passwordTextField = new javax.swing.JTextField(); passwordTextField = new javax.swing.JTextField();
javax.swing.JPanel spacer = new javax.swing.JPanel(); javax.swing.JPanel spacer = new javax.swing.JPanel();
loadingLabel = new javax.swing.JLabel();
setMinimumSize(new java.awt.Dimension(0, 65)); setMinimumSize(new java.awt.Dimension(0, 65));
setPreferredSize(new java.awt.Dimension(403, 65)); setPreferredSize(new java.awt.Dimension(403, 65));
@ -425,6 +427,22 @@ public class ImageFilePanel extends JPanel {
gridBagConstraints.gridy = 12; gridBagConstraints.gridy = 12;
gridBagConstraints.weighty = 1.0; gridBagConstraints.weighty = 1.0;
add(spacer, gridBagConstraints); 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);
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@NbBundle.Messages({"ImageFilePanel.000.confirmationMessage=The selected file" @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 errorLabel;
private javax.swing.JLabel hashValuesLabel; private javax.swing.JLabel hashValuesLabel;
private javax.swing.JLabel hashValuesNoteLabel; private javax.swing.JLabel hashValuesNoteLabel;
private javax.swing.JLabel loadingLabel;
private javax.swing.JLabel md5HashLabel; private javax.swing.JLabel md5HashLabel;
private javax.swing.JTextField md5HashTextField; private javax.swing.JTextField md5HashTextField;
private javax.swing.JCheckBox noFatOrphansCheckbox; private javax.swing.JCheckBox noFatOrphansCheckbox;
@ -593,10 +612,9 @@ public class ImageFilePanel extends JPanel {
"ImageFilePanel_validatePanel_unknownError=<html><body><p>An unknown error occurred while attempting to validate the image</p></body></html>" "ImageFilePanel_validatePanel_unknownError=<html><body><p>An unknown error occurred while attempting to validate the image</p></body></html>"
}) })
public boolean validatePanel() { public boolean validatePanel() {
errorLabel.setVisible(false);
String path = getContentPaths(); String path = getContentPaths();
if (!isImagePathValid()) { if (!isImagePathValid()) {
showError(null);
return false; return false;
} }
@ -635,16 +653,18 @@ public class ImageFilePanel extends JPanel {
return false; return false;
} }
showError(null);
return true; return true;
} }
/** /**
* Show an error message if error message is non-empty. Otherwise, hide * 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) { private void showError(String errorMessage) {
loadingLabel.setVisible(false);
if (StringUtils.isNotBlank(errorMessage)) { if (StringUtils.isNotBlank(errorMessage)) {
errorLabel.setVisible(true); errorLabel.setVisible(true);
errorLabel.setText(errorMessage); errorLabel.setText(errorMessage);
@ -730,6 +750,11 @@ public class ImageFilePanel extends JPanel {
if (ImageFilePanel.this.validateAction != null) { if (ImageFilePanel.this.validateAction != null) {
ImageFilePanel.this.validateAction.cancel(true); 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( ImageFilePanel.this.validateAction = ImageFilePanel.this.delayedValidationService.schedule(
() -> { () -> {