1
0
mirror of https://github.com/elisspace/autopsy.git synced 2026-09-06 02:24:30 +00:00

Add dialog to add image wizard showing non-critical errors

This commit is contained in:
adam-m
2012-06-27 16:29:23 -04:00
parent 6323fd3a51
commit 95c47bebee
6 changed files with 373 additions and 58 deletions

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageErrorsDialog.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="iconImage" type="java.awt.Image" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="null"/>
</Property>
<Property name="iconImages" type="java.util.List" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="null"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" pref="485" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="copyButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="closeButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" pref="219" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="closeButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="copyButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="errorsText">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="editable" type="boolean" value="false"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="copyButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageErrorsDialog.copyButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageErrorsDialog.copyButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="copyButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="closeButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageErrorsDialog.closeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageErrorsDialog.closeButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="closeButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -0,0 +1,145 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.sleuthkit.autopsy.casemodule;
/**
* Modal dialog to show add image error messages
*/
public class AddImageErrorsDialog extends javax.swing.JDialog {
/**
* Creates new form AddImageErrorsDialog
*/
public AddImageErrorsDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
* 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() {
jScrollPane1 = new javax.swing.JScrollPane();
errorsText = new javax.swing.JTextArea();
copyButton = new javax.swing.JButton();
closeButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(org.openide.util.NbBundle.getMessage(AddImageErrorsDialog.class, "AddImageErrorsDialog.title")); // NOI18N
setIconImage(null);
setIconImages(null);
errorsText.setColumns(20);
errorsText.setEditable(false);
errorsText.setRows(5);
jScrollPane1.setViewportView(errorsText);
org.openide.awt.Mnemonics.setLocalizedText(copyButton, org.openide.util.NbBundle.getMessage(AddImageErrorsDialog.class, "AddImageErrorsDialog.copyButton.text")); // NOI18N
copyButton.setToolTipText(org.openide.util.NbBundle.getMessage(AddImageErrorsDialog.class, "AddImageErrorsDialog.copyButton.toolTipText")); // NOI18N
copyButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
copyButtonActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(closeButton, org.openide.util.NbBundle.getMessage(AddImageErrorsDialog.class, "AddImageErrorsDialog.closeButton.text")); // NOI18N
closeButton.setToolTipText(org.openide.util.NbBundle.getMessage(AddImageErrorsDialog.class, "AddImageErrorsDialog.closeButton.toolTipText")); // NOI18N
closeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
closeButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(copyButton)
.addGap(18, 18, 18)
.addComponent(closeButton))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE)
.addGap(0, 0, 0)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(closeButton)
.addComponent(copyButton)))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void copyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyButtonActionPerformed
errorsText.selectAll();
errorsText.copy();
}//GEN-LAST:event_copyButtonActionPerformed
private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
setVisible(false);
}//GEN-LAST:event_closeButtonActionPerformed
void setErrors(String errors) {
errorsText.setText(errors);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(AddImageErrorsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(AddImageErrorsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(AddImageErrorsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(AddImageErrorsDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
AddImageErrorsDialog dialog = new AddImageErrorsDialog(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton closeButton;
private javax.swing.JButton copyButton;
private javax.swing.JTextArea errorsText;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -25,10 +25,10 @@
<Component id="jLabel1" alignment="0" min="-2" pref="552" max="-2" attributes="1"/>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="16" max="32767" attributes="0"/>
<EmptySpace min="0" pref="36" max="32767" attributes="0"/>
</Group>
<Component id="crDbProgressBar" alignment="0" pref="568" max="32767" attributes="1"/>
<Component id="progressLabel" alignment="0" pref="568" max="32767" attributes="0"/>
<Component id="crDbProgressBar" alignment="0" pref="588" max="32767" attributes="1"/>
<Component id="infoPanel" alignment="0" min="-2" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -46,8 +46,8 @@
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="crDbProgressBar" min="-2" pref="24" max="-2" attributes="1"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="progressLabel" pref="12" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="infoPanel" min="-2" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -72,13 +72,6 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="progressLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel2.progressLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@@ -86,5 +79,20 @@
</Property>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="infoPanel">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="588" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="47" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Form>

View File

@@ -16,15 +16,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.casemodule;
import java.awt.Color;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
/**
* The "Add Image" wizard panel 2. Provides checkbox to enable indexing, button
@@ -32,16 +37,38 @@ import javax.swing.JProgressBar;
*/
final class AddImageVisualPanel2 extends JPanel {
/** Creates new form AddImageVisualPanel2 */
private String nonCriticalErrors = null;
private JLabel progressLabel = null;
private JButton errorButton = null;
/**
* Creates new form AddImageVisualPanel2
*/
AddImageVisualPanel2() {
initComponents();
customizeComponents();
}
private void customizeComponents() {
progressLabel = new JLabel();
infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.PAGE_AXIS));
infoPanel.add(progressLabel);
infoPanel.add(Box.createRigidArea(new Dimension(10, 10))); //spacer
}
void resetInfoPanel() {
if (errorButton != null) {
infoPanel.remove(errorButton);
errorButton = null;
}
progressLabel.setText("");
}
/**
* Returns the name of the this panel. This name will be shown on the left
* panel of the "Add Image" wizard panel.
*
* @return name the name of this panel
* @return name the name of this panel
*/
@Override
public String getName() {
@@ -59,9 +86,9 @@ final class AddImageVisualPanel2 extends JPanel {
/**
* Changes the progress bar text and color.
*
* @param text the text to be shown
* @param value the current value of the progress bar
* @param color the color of the progress bar text
* @param text the text to be shown
* @param value the current value of the progress bar
* @param color the color of the progress bar text
*/
public void changeProgressBarTextAndColor(String text, int value, Color color) {
progressLabel.setText(text);
@@ -69,9 +96,28 @@ final class AddImageVisualPanel2 extends JPanel {
crDbProgressBar.setValue(value);
}
/**
void setNonCriticalErrors(final String errors) {
progressLabel.setText("*Image added (non-critical image errors encountered). Click below to view the Add Image Log.");
errorButton = new JButton();
errorButton.setText("View Log");
infoPanel.add(errorButton);
errorButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//JOptionPane.showMessageDialog(null, errors, "Add image non-critical errors", JOptionPane.WARNING_MESSAGE);
AddImageErrorsDialog dialog = new AddImageErrorsDialog(null, true);
dialog.setErrors(errors);
dialog.setVisible(true);
}
});
}
/**
* 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
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -80,18 +126,27 @@ final class AddImageVisualPanel2 extends JPanel {
crDbProgressBar = new javax.swing.JProgressBar();
jLabel5 = new javax.swing.JLabel();
crDbLabel = new javax.swing.JLabel();
progressLabel = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
infoPanel = new javax.swing.JPanel();
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.jLabel5.text")); // NOI18N
crDbLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
crDbLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(crDbLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.crDbLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(progressLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.progressLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.jLabel1.text")); // NOI18N
javax.swing.GroupLayout infoPanelLayout = new javax.swing.GroupLayout(infoPanel);
infoPanel.setLayout(infoPanelLayout);
infoPanelLayout.setHorizontalGroup(
infoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 588, Short.MAX_VALUE)
);
infoPanelLayout.setVerticalGroup(
infoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 47, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -104,9 +159,9 @@ final class AddImageVisualPanel2 extends JPanel {
.addComponent(crDbLabel)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 552, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(0, 16, Short.MAX_VALUE))
.addComponent(crDbProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE)
.addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE))
.addGap(0, 36, Short.MAX_VALUE))
.addComponent(crDbProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 588, Short.MAX_VALUE)
.addComponent(infoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
@@ -121,16 +176,15 @@ final class AddImageVisualPanel2 extends JPanel {
.addGap(18, 18, 18)
.addComponent(crDbProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 12, Short.MAX_VALUE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(infoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(24, 24, 24))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel crDbLabel;
private javax.swing.JProgressBar crDbProgressBar;
private javax.swing.JPanel infoPanel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel progressLabel;
// End of variables declaration//GEN-END:variables
}

View File

@@ -79,7 +79,7 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
* but never displayed, or not all panels are displayed, it is better to
* create only those which really need to be visible.
*
* @return component the UI component of this wizard panel
* @return component the UI component of this wizard panel
*/
@Override
public AddImageVisualPanel2 getComponent() {
@@ -93,7 +93,7 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
* Help for this panel. When the panel is active, this is used as the help
* for the wizard dialog.
*
* @return HelpCtx.DEFAULT_HELP the help for this panel
* @return HelpCtx.DEFAULT_HELP the help for this panel
*/
@Override
public HelpCtx getHelp() {
@@ -105,7 +105,7 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
* Tests whether the panel is finished and it is safe to proceed to the next
* one. If the panel is valid, the "Next" button will be enabled.
*
* @return boolean true if can proceed to the next one, false otherwise
* @return boolean true if can proceed to the next one, false otherwise
*/
@Override
public boolean isValid() {
@@ -130,10 +130,10 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
}
/**
* Sets the isDbCreated variable in this class and also invoke
* Sets the isDbCreated variable in this class and also invoke
* fireChangeEvent() method.
*
* @param created whether the database already created or not
* @param created whether the database already created or not
*/
private void setDbCreated(Boolean created) {
imgAdded = created;
@@ -144,7 +144,7 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
/**
* Adds a listener to changes of the panel's validity.
*
* @param l the change listener to add
* @param l the change listener to add
*/
@Override
public final void addChangeListener(ChangeListener l) {
@@ -156,7 +156,7 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
/**
* Removes a listener to changes of the panel's validity.
*
* @param l the change listener to move
* @param l the change listener to move
*/
@Override
public final void removeChangeListener(ChangeListener l) {
@@ -166,8 +166,8 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
}
/**
* This method is auto-generated. It seems that this method is used to listen
* to any change in this wizard panel.
* This method is auto-generated. It seems that this method is used to
* listen to any change in this wizard panel.
*/
protected final void fireChangeEvent() {
Iterator<ChangeListener> it;
@@ -184,7 +184,7 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
* Load the image locations from the WizardDescriptor settings object, and
* the
*
* @param settings the setting to be read from
* @param settings the setting to be read from
*/
@Override
public void readSettings(WizardDescriptor settings) {
@@ -194,14 +194,14 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
timeZone = settings.getProperty(AddImageAction.TIMEZONE_PROP).toString();
noFatOrphans = ((Boolean) settings.getProperty(AddImageAction.NOFATORPHANS_PROP)).booleanValue();
component.changeProgressBarTextAndColor("", 0, Color.black);
getComponent().resetInfoPanel();
startAddImage();
}
/**
*
* @param settings the setting to be stored to
* @param settings the setting to be stored to
*/
@Override
public void storeSettings(WizardDescriptor settings) {
@@ -213,10 +213,12 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
// be cancelled if all goes well, and availble if we return to this
// panel so the the previously added image can be reverted
settings.putProperty(AddImageAction.IMAGECLEANUPTASK_PROP, cleanupImage);
getComponent().resetInfoPanel();
}
/**
* Thread that will make the JNI call to ingest the image.
* Thread that will make the JNI call to ingest the image.
*/
private class AddImgTask extends SwingWorker<Integer, Integer> {
@@ -233,20 +235,19 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
}
/**
* Starts the addImage process, but does not commit the results.
*
* Starts the addImage process, but does not commit the results.
*
* @return
* @throws Exception
* @throws Exception
*/
@Override
protected Integer doInBackground() {
this.setProgress(0);
// Add a cleanup task to interupt the backgroud process if the
// wizard exits while the background process is running.
AddImageAction.CleanupTask cancelledWhileRunning = action.new CleanupTask() {
@Override
void cleanup() throws Exception {
logger.log(Level.INFO, "Add image process interrupted.");
@@ -259,7 +260,6 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
//lock DB for writes in EWT thread
//wait until lock acquired in EWT
EventQueue.invokeAndWait(new Runnable() {
@Override
public void run() {
SleuthkitCase.dbWriteLock();
@@ -280,12 +280,12 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
try {
process.run(new String[]{imgPath});
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Errors occurred while running add image. ", ex);
logger.log(Level.WARNING, "Core errors occurred while running add image. ", ex);
//critical core/system error and process needs to be interrupted
hasCritError = true;
errorString = ex.getMessage();
} catch (TskDataException ex) {
logger.log(Level.WARNING, "Errors occurred while running add image. ", ex);
logger.log(Level.WARNING, "Data errors occurred while running add image. ", ex);
errorString = ex.getMessage();
} finally {
// process is over, doesn't need to be dealt with if cancel happens
@@ -296,7 +296,7 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
}
/**
*
*
* (called by EventDispatch Thread after doInBackground finishes)
*/
@Override
@@ -317,6 +317,7 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
logger.log(Level.INFO, "Handling errors or interruption that occured in add image process");
revert();
if (hasCritError) {
//core error
StringBuilder errMsgB = new StringBuilder();
errMsgB.append("<html>*Failed to add image");
if (errorString != null) {
@@ -325,7 +326,12 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
errMsgB.append("</html>");
getComponent().changeProgressBarTextAndColor(errMsgB.toString(), 0, Color.black);
}
return;
} else if (errorString != null) {
//data error (non-critical)
logger.log(Level.INFO, "Handling non-critical errors that occured in add image process");
getComponent().setNonCriticalErrors(errorString);
}
}
@@ -344,7 +350,8 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
};
cleanupImage.enable();
getComponent().changeProgressBarTextAndColor("*Image added.", 100, Color.black); // complete progress bar
if (errorString == null)
getComponent().changeProgressBarTextAndColor("*Image added.", 100, Color.black); // complete progress bar
// Get attention for the process finish
java.awt.Toolkit.getDefaultToolkit().beep(); //BEEP!

View File

@@ -90,7 +90,6 @@ OpenRecentCasePanel.jLabel1.text=Recent Cases
AddImageVisualPanel1.imgInfoLabel.text=Enter Disk Image Information:
AddImageVisualPanel2.crDbLabel.text=Adding Image
AddImageVisualPanel2.jLabel5.text=Processing Image and Adding to Database :
AddImageVisualPanel2.progressLabel.text=
AddImageVisualPanel2.jLabel1.text=<html> We are now analyzing the disk image to extract volume and file system data and populate a local database. </html>
AddImageVisualPanel1.timeZoneLabel.text=Please select the image timezone:
AddImageVisualPanel1.imgPathTextField.text=
@@ -121,3 +120,8 @@ NewCaseVisualPanel2.optionalLabel.text=Optional: Set Case Number and Examiner
AddImageVisualPanel1.noFatOrphansCheckbox.toolTipText=
AddImageVisualPanel1.noFatOrphansCheckbox.text=Ignore orphan files in FAT file systems
AddImageVisualPanel1.optionsLabel1.text=Options to produce results faster (although some data will not be searched):
AddImageErrorsDialog.title=Add Image Log
AddImageErrorsDialog.copyButton.toolTipText=Copy errors to clipboard
AddImageErrorsDialog.copyButton.text=Copy
AddImageErrorsDialog.closeButton.toolTipText=Close this window
AddImageErrorsDialog.closeButton.text=Close