Conflicts:
	Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java
This commit is contained in:
Jeff Wallace 2013-09-19 13:22:20 -04:00
commit 1c6fcbe15f
30 changed files with 1016 additions and 1123 deletions

View File

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Component id="statusLabel" pref="472" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="crDbLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="crDbLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="statusLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="67" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="statusLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageDonePanel.statusLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="crDbLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageDonePanel.crDbLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -1,76 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012 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.casemodule;
public class AddImageDonePanel extends javax.swing.JPanel {
/**
* Creates new form AddImageDonePanel
*/
public AddImageDonePanel() {
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() {
statusLabel = new javax.swing.JLabel();
crDbLabel = new javax.swing.JLabel();
org.openide.awt.Mnemonics.setLocalizedText(statusLabel, org.openide.util.NbBundle.getMessage(AddImageDonePanel.class, "AddImageDonePanel.statusLabel.text")); // NOI18N
crDbLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(crDbLabel, org.openide.util.NbBundle.getMessage(AddImageDonePanel.class, "AddImageDonePanel.crDbLabel.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)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 472, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(crDbLabel)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(crDbLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(statusLabel)
.addContainerGap(67, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel crDbLabel;
private javax.swing.JLabel statusLabel;
// End of variables declaration//GEN-END:variables
}

View File

@ -15,6 +15,7 @@
</Properties> </Properties>
<SyntheticProperties> <SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties> </SyntheticProperties>
<AuxValues> <AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>

View File

@ -107,7 +107,7 @@ public class AddImageErrorsDialog extends javax.swing.JDialog {
}//GEN-LAST:event_closeButtonActionPerformed }//GEN-LAST:event_closeButtonActionPerformed
void setErrors(String errors) { public void setErrors(String errors) {
errorsText.setText(errors); errorsText.setText(errors);
} }

View File

@ -1,144 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="crDbProgressBar" alignment="0" max="32767" attributes="1"/>
<Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="crDbLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" pref="552" max="-2" attributes="1"/>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="Label_CurrentDirectory_Static" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="infoPanel" alignment="0" min="-2" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="crDbLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" pref="14" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="crDbProgressBar" min="-2" pref="24" max="-2" attributes="1"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="infoPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="Label_CurrentDirectory_Static" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="63" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="crDbLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageLoadingPanel.crDbLabel.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">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageLoadingPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageLoadingPanel.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JProgressBar" name="crDbProgressBar">
</Component>
<Container class="javax.swing.JPanel" name="infoPanel">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="707" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="15" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JLabel" name="Label_CurrentDirectory_Static">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageLoadingPanel.Label_CurrentDirectory_Static.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
<Property name="verticalScrollBarPolicy" type="int" value="21"/>
</Properties>
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="TextArea_CurrentDirectory">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="f0" green="f0" red="f0" type="rgb"/>
</Property>
<Property name="columns" type="int" value="20"/>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="5"/>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Text Cursor"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -1,230 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012 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.casemodule;
import java.awt.Color;
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.JLabel;
import javax.swing.JProgressBar;
public class AddImageLoadingPanel extends javax.swing.JPanel {
private JLabel progressLabel = null;
private JButton errorButton = null;
/**
* Creates new form AddImageLoadingPanel
*/
public AddImageLoadingPanel() {
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
this.jScrollPane1.setBorder(null);
this.TextArea_CurrentDirectory.setBackground(this.getBackground());
}
void resetInfoPanel() {
if (errorButton != null) {
infoPanel.remove(errorButton);
errorButton = null;
}
progressLabel.setText("");
}
public JProgressBar getCrDbProgressBar() {
return this.crDbProgressBar;
}
public JLabel getProgressLabel() {
return this.progressLabel;
}
/**
* 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
*/
public void changeProgressBarTextAndColor(String text, int value, Color color) {
progressLabel.setText(text);
progressLabel.setForeground(color);
crDbProgressBar.setValue(value);
}
/**
* append progress text to progress label
* @param text
*/
public void appendProgressText(String text) {
progressLabel.setText(progressLabel.getText() + " " + text);
}
/**
* Updates the currently processing directory
* @param dir the text to update with
*/
public void changeCurrentDir(String dir){
this.TextArea_CurrentDirectory.setText(dir);
}
/**
* Sets the CurrentlyProcessing tag and text area to be invisible
*/
public void setProcessInvis(){
this.Label_CurrentDirectory_Static.setVisible(false);
this.TextArea_CurrentDirectory.setText("");
this.TextArea_CurrentDirectory.setVisible(false);
}
void setErrors(final String errors, boolean critical) {
crDbProgressBar.setValue(100); //always invoked when process completed
if (critical) {
progressLabel.setText("*Failed to add image (critical errors encountered). Click below to view the log.");
}
else {
progressLabel.setText("*Data Source added (non-critical errors encountered). Click below to view the 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
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
crDbLabel = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
crDbProgressBar = new javax.swing.JProgressBar();
infoPanel = new javax.swing.JPanel();
Label_CurrentDirectory_Static = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
TextArea_CurrentDirectory = new javax.swing.JTextArea();
crDbLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(crDbLabel, org.openide.util.NbBundle.getMessage(AddImageLoadingPanel.class, "AddImageLoadingPanel.crDbLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AddImageLoadingPanel.class, "AddImageLoadingPanel.jLabel1.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(AddImageLoadingPanel.class, "AddImageLoadingPanel.jLabel5.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, 707, Short.MAX_VALUE)
);
infoPanelLayout.setVerticalGroup(
infoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 15, Short.MAX_VALUE)
);
org.openide.awt.Mnemonics.setLocalizedText(Label_CurrentDirectory_Static, org.openide.util.NbBundle.getMessage(AddImageLoadingPanel.class, "AddImageLoadingPanel.Label_CurrentDirectory_Static.text")); // NOI18N
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
TextArea_CurrentDirectory.setEditable(false);
TextArea_CurrentDirectory.setBackground(new java.awt.Color(240, 240, 240));
TextArea_CurrentDirectory.setColumns(20);
TextArea_CurrentDirectory.setLineWrap(true);
TextArea_CurrentDirectory.setRows(5);
TextArea_CurrentDirectory.setWrapStyleWord(true);
TextArea_CurrentDirectory.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
TextArea_CurrentDirectory.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
jScrollPane1.setViewportView(TextArea_CurrentDirectory);
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(crDbProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(crDbLabel)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 552, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(Label_CurrentDirectory_Static))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(infoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(crDbLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(crDbProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(infoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Label_CurrentDirectory_Static)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel Label_CurrentDirectory_Static;
private javax.swing.JTextArea TextArea_CurrentDirectory;
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.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}

View File

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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="mainPanel" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="mainPanel" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="mainPanel">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="334" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="277" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Form>

View File

@ -1,166 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 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.casemodule;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
/**
* The "Add Image" wizard panel 2. Provides checkbox to enable indexing, button
* to start process, and progress bar.
*/
final class AddImageVisualPanel2 extends JPanel {
private AddImageLoadingPanel loadingPanel;
private AddImageDonePanel donePanel;
/**
* Creates new form AddImageVisualPanel2
*/
AddImageVisualPanel2() {
loadingPanel = new AddImageLoadingPanel();
donePanel = new AddImageDonePanel();
initComponents();
customizeComponents();
}
private void customizeComponents() {
mainPanel.setLayout(new BorderLayout());
mainPanel.removeAll();
mainPanel.add(loadingPanel, BorderLayout.CENTER);
mainPanel.validate();
mainPanel.repaint();
}
AddImageLoadingPanel getLoadingPanel() {
return loadingPanel;
}
AddImageDonePanel getDonePanel() {
return donePanel;
}
void done() {
mainPanel.removeAll();
mainPanel.add(donePanel, BorderLayout.CENTER);
mainPanel.validate();
mainPanel.repaint();
}
void resetInfoPanel() {
loadingPanel.resetInfoPanel();
}
/**
* 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
*/
@Override
public String getName() {
return "Add Data Source";
}
public JProgressBar getCrDbProgressBar() {
return loadingPanel.getCrDbProgressBar();
}
public JLabel getProgressLabel() {
return loadingPanel.getProgressLabel();
}
/**
* 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
*/
public void changeProgressBarTextAndColor(String text, int value, Color color) {
loadingPanel.changeProgressBarTextAndColor(text, value, color);
}
/**
* append progress text to progress label
* @param text
*/
public void appendProgressText(String text) {
loadingPanel.appendProgressText(text);
}
/**
* Updates the currently processing directory
* @param dir the text to update with
*/
public void changeCurrentDir(String dir){
loadingPanel.changeCurrentDir(dir);
}
/**
* Sets the CurrentlyProcessing tag and text area to be invisible
*/
public void setProcessInvis(){
loadingPanel.setProcessInvis();
}
void setErrors(final String errors, boolean critical) {
loadingPanel.setErrors(errors, critical);
}
/**
* 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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
mainPanel = new javax.swing.JPanel();
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 334, Short.MAX_VALUE)
);
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 277, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel mainPanel;
// End of variables declaration//GEN-END:variables
}

View File

@ -29,17 +29,26 @@ import org.openide.util.HelpCtx;
import org.openide.util.Lookup; import org.openide.util.Lookup;
/** /**
* The "Add Data Source" wizard panel2. Handles processing the image in a worker * The final panel of the add image wizard. It displays a progress bar and
* thread, and any errors that may occur during the add process. * status updates.
*
* All the real work is kicked off in the previous panel:
* {@link AddImageWizardIngestConfigPanel} (which is a bit weird if you ask m
* -jm)
*/ */
class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> { class AddImageWizardAddingProgressPanel implements WizardDescriptor.Panel<WizardDescriptor> {
private boolean imgAdded = false;
/**
* flag to indicate that the image adding process is finished and this panel
* is completed(valid)
*/
private boolean imgAdded = false;
/** /**
* The visual component that displays this panel. If you need to access the * The visual component that displays this panel. If you need to access the
* component from this class, just use getComponent(). * component from this class, just use getComponent().
*/ */
private AddImageVisualPanel2 component; private AddImageWizardAddingProgressVisual component;
private final Set<ChangeListener> listeners = new HashSet<>(1); // or can use ChangeSupport in NB 6.0
/** /**
* Get the visual component for the panel. In this template, the component * Get the visual component for the panel. In this template, the component
@ -47,12 +56,14 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
* but never displayed, or not all panels are displayed, it is better to * but never displayed, or not all panels are displayed, it is better to
* create only those which really need to be visible. * create only those which really need to be visible.
* *
* It also separates the view from the control - jm
*
* @return component the UI component of this wizard panel * @return component the UI component of this wizard panel
*/ */
@Override @Override
public AddImageVisualPanel2 getComponent() { public AddImageWizardAddingProgressVisual getComponent() {
if (component == null) { if (component == null) {
component = new AddImageVisualPanel2(); component = new AddImageWizardAddingProgressVisual();
} }
return component; return component;
} }
@ -89,8 +100,8 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
* Updates the UI to display the add image process has begun. * Updates the UI to display the add image process has begun.
*/ */
void setStateStarted() { void setStateStarted() {
component.getCrDbProgressBar().setIndeterminate(true); component.getProgressBar().setIndeterminate(true);
component.changeProgressBarTextAndColor("*This process take some time for large data sources.", 0, Color.black); component.setProgressBarTextAndColor("*This process take some time for large data sources.", 0, Color.black);
} }
/** /**
@ -98,9 +109,9 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
*/ */
void setStateFinished() { void setStateFinished() {
imgAdded = true; imgAdded = true;
getComponent().setStateFinished();
fireChangeEvent(); fireChangeEvent();
} }
private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
/** /**
* Adds a listener to changes of the panel's validity. * Adds a listener to changes of the panel's validity.
@ -149,22 +160,34 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
*/ */
@Override @Override
public void readSettings(WizardDescriptor settings) { public void readSettings(WizardDescriptor settings) {
settings.setOptions(new Object[] {WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, WizardDescriptor.FINISH_OPTION, WizardDescriptor.CANCEL_OPTION}); settings.setOptions(new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, WizardDescriptor.FINISH_OPTION, WizardDescriptor.CANCEL_OPTION});
if(imgAdded) { if (imgAdded) {
getComponent().done(); getComponent().setStateFinished();
} }
} }
/** /**
* this doesn't appear to store anything? plus, there are no settings in
* this panel -jm
* *
* @param settings the setting to be stored to * @param settings the setting to be stored to
*/ */
@Override @Override
public void storeSettings(WizardDescriptor settings) { public void storeSettings(WizardDescriptor settings) {
//why do we do this?
getComponent().resetInfoPanel(); getComponent().resetInfoPanel();
} }
/**
* forward errors to visual component
*
* should this be modified to handle a list of errors? -jm
*
*
* @param errorString the error string to be displayed
* @param critical true if this is a critical error
*/
void setErrors(String errorString, boolean critical) {
getComponent().showErrors(errorString, critical);
}
} }

View File

@ -0,0 +1,240 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="loadingPanel" min="-2" max="-2" attributes="0"/>
<Component id="donePanel" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="loadingPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="donePanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="donePanel">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="viewLogButton" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="crDbLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="statusLabel" alignment="0" min="-2" pref="463" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="crDbLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="statusLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="viewLogButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="statusLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardAddingProgressVisual.statusLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="crDbLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardAddingProgressVisual.crDbLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="viewLogButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardAddingProgressVisual.viewLogButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="loadingPanel">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="addingDataSourceLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" pref="552" max="-2" attributes="1"/>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="progressBar" alignment="0" min="-2" pref="489" max="-2" attributes="1"/>
</Group>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="progressLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="infoPanel" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="TextArea_CurrentDirectory" alignment="0" min="-2" pref="487" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="addingDataSourceLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" pref="14" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="progressBar" min="-2" pref="24" max="-2" attributes="1"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="TextArea_CurrentDirectory" min="-2" pref="91" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="infoPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="progressLabel" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="addingDataSourceLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardAddingProgressVisual.addingDataSourceLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</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="AddImageWizardAddingProgressVisual.progressLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="null"/>
</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">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardAddingProgressVisual.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardAddingProgressVisual.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JProgressBar" name="progressBar">
</Component>
<Container class="javax.swing.JPanel" name="infoPanel">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="73" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="25" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JTextArea" name="TextArea_CurrentDirectory">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="f0" green="f0" red="f0" type="rgb"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="5"/>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Currently Adding:">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
<ResourceString PropertyName="titleX" bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardAddingProgressVisual.TextArea_CurrentDirectory.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</TitledBorder>
</Border>
</Property>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Text Cursor"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,302 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012 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.casemodule;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JProgressBar;
/**
* visual component to display progress bar and status updates while adding an
* image in the wizard
*/
public class AddImageWizardAddingProgressVisual extends javax.swing.JPanel {
/**
* 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
*/
@Override
public String getName() {
return "Add Data Source";
}
/**
* hide the progress components and show the "done" components
*/
void setStateFinished() {
loadingPanel.setVisible(false);
donePanel.setVisible(true);
//force repaint just in case
validate();
repaint();
}
/**
* Creates new form AddImageLoadingPanel
*/
public AddImageWizardAddingProgressVisual() {
initComponents();
customizeComponents();
}
private void customizeComponents() {
//done and log button are both hidden to start
donePanel.setVisible(false);
viewLogButton.setVisible(false);
//match visual background of panel
this.TextArea_CurrentDirectory.setBackground(this.getBackground());
}
/**
* reset some of the visual components.
*
* is this ever invoked?
*/
void resetInfoPanel() {
viewLogButton.setVisible(false);
progressLabel.setText("");
}
public JProgressBar getProgressBar() {
return this.progressBar;
}
/**
* update the progress bar and label 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
*/
public void setProgressBarTextAndColor(String text, int value, Color color) {
progressLabel.setText(text);
progressLabel.setForeground(color);
progressBar.setValue(value);
}
/**
* Updates the currently processing directory
*
* @param dir the text to update with
*/
public void setCurrentDirText(String dir) {
this.TextArea_CurrentDirectory.setText(dir);
}
/**
* reconfigure the components to indicate error(s) and show "view log
* button"
*
*
* @param errors a string containing a description of the error(s)
* @param critical true to indicate the error(s) are critical
*/
void showErrors(final String errors, boolean critical) {
progressBar.setValue(100); //always invoked when process completed
if (critical) {
statusLabel.setText("*Failed to add image (critical errors encountered). Click below to view the log.");
} else {
statusLabel.setText("*Data Source added (non-critical errors encountered). Click below to view the log.");
}
viewLogButton.setVisible(true);
viewLogButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//show error dialog
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
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
donePanel = new javax.swing.JPanel();
statusLabel = new javax.swing.JLabel();
crDbLabel = new javax.swing.JLabel();
viewLogButton = new javax.swing.JButton();
loadingPanel = new javax.swing.JPanel();
addingDataSourceLabel = new javax.swing.JLabel();
progressLabel = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
progressBar = new javax.swing.JProgressBar();
infoPanel = new javax.swing.JPanel();
TextArea_CurrentDirectory = new javax.swing.JTextArea();
org.openide.awt.Mnemonics.setLocalizedText(statusLabel, org.openide.util.NbBundle.getMessage(AddImageWizardAddingProgressVisual.class, "AddImageWizardAddingProgressVisual.statusLabel.text")); // NOI18N
crDbLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(crDbLabel, org.openide.util.NbBundle.getMessage(AddImageWizardAddingProgressVisual.class, "AddImageWizardAddingProgressVisual.crDbLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(viewLogButton, org.openide.util.NbBundle.getMessage(AddImageWizardAddingProgressVisual.class, "AddImageWizardAddingProgressVisual.viewLogButton.text")); // NOI18N
javax.swing.GroupLayout donePanelLayout = new javax.swing.GroupLayout(donePanel);
donePanel.setLayout(donePanelLayout);
donePanelLayout.setHorizontalGroup(
donePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(donePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(donePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(donePanelLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(viewLogButton))
.addComponent(crDbLabel)
.addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 463, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
donePanelLayout.setVerticalGroup(
donePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(donePanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(crDbLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(statusLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(viewLogButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
addingDataSourceLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(addingDataSourceLabel, org.openide.util.NbBundle.getMessage(AddImageWizardAddingProgressVisual.class, "AddImageWizardAddingProgressVisual.addingDataSourceLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(progressLabel, org.openide.util.NbBundle.getMessage(AddImageWizardAddingProgressVisual.class, "AddImageWizardAddingProgressVisual.progressLabel.text")); // NOI18N
progressLabel.setPreferredSize(null);
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AddImageWizardAddingProgressVisual.class, "AddImageWizardAddingProgressVisual.jLabel1.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(AddImageWizardAddingProgressVisual.class, "AddImageWizardAddingProgressVisual.jLabel5.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, 73, Short.MAX_VALUE)
);
infoPanelLayout.setVerticalGroup(
infoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 25, Short.MAX_VALUE)
);
TextArea_CurrentDirectory.setEditable(false);
TextArea_CurrentDirectory.setBackground(new java.awt.Color(240, 240, 240));
TextArea_CurrentDirectory.setLineWrap(true);
TextArea_CurrentDirectory.setRows(5);
TextArea_CurrentDirectory.setWrapStyleWord(true);
TextArea_CurrentDirectory.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), org.openide.util.NbBundle.getMessage(AddImageWizardAddingProgressVisual.class, "AddImageWizardAddingProgressVisual.TextArea_CurrentDirectory.border.title"))); // NOI18N
TextArea_CurrentDirectory.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
TextArea_CurrentDirectory.setFocusable(false);
javax.swing.GroupLayout loadingPanelLayout = new javax.swing.GroupLayout(loadingPanel);
loadingPanel.setLayout(loadingPanelLayout);
loadingPanelLayout.setHorizontalGroup(
loadingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(loadingPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(loadingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, loadingPanelLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(loadingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(addingDataSourceLabel)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 552, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 489, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(loadingPanelLayout.createSequentialGroup()
.addGroup(loadingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(loadingPanelLayout.createSequentialGroup()
.addComponent(progressLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(infoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(TextArea_CurrentDirectory, javax.swing.GroupLayout.PREFERRED_SIZE, 487, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))))
);
loadingPanelLayout.setVerticalGroup(
loadingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(loadingPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(addingDataSourceLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(TextArea_CurrentDirectory, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(loadingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(loadingPanelLayout.createSequentialGroup()
.addComponent(infoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(loadingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(donePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(loadingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(donePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextArea TextArea_CurrentDirectory;
private javax.swing.JLabel addingDataSourceLabel;
private javax.swing.JLabel crDbLabel;
private javax.swing.JPanel donePanel;
private javax.swing.JPanel infoPanel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel loadingPanel;
private javax.swing.JProgressBar progressBar;
private javax.swing.JLabel progressLabel;
private javax.swing.JLabel statusLabel;
private javax.swing.JButton viewLogButton;
// End of variables declaration//GEN-END:variables
}

View File

@ -37,13 +37,13 @@ import org.sleuthkit.autopsy.coreutils.ModuleSettings;
* The "Add Image" wizard panel1 handling the logic of selecting image file(s) * The "Add Image" wizard panel1 handling the logic of selecting image file(s)
* to add to Case, and pick the time zone. * to add to Case, and pick the time zone.
*/ */
class AddImageWizardPanel1 implements WizardDescriptor.Panel<WizardDescriptor>, PropertyChangeListener { class AddImageWizardChooseDataSourcePanel implements WizardDescriptor.Panel<WizardDescriptor>, PropertyChangeListener {
/** /**
* The visual component that displays this panel. If you need to access the * The visual component that displays this panel. If you need to access the
* component from this class, just use getComponent(). * component from this class, just use getComponent().
*/ */
private AddImageVisualPanel1 component; private AddImageWizardChooseDataSourceVisual component;
private boolean isNextEnable = false; private boolean isNextEnable = false;
private static final String PROP_LASTDATASOURCE_PATH = "LBL_LastDataSource_PATH"; private static final String PROP_LASTDATASOURCE_PATH = "LBL_LastDataSource_PATH";
private static final String PROP_LASTDATASOURCE_TYPE = "LBL_LastDataSource_TYPE"; private static final String PROP_LASTDATASOURCE_TYPE = "LBL_LastDataSource_TYPE";
@ -59,9 +59,9 @@ class AddImageWizardPanel1 implements WizardDescriptor.Panel<WizardDescriptor>,
* @return component the UI component of this wizard panel * @return component the UI component of this wizard panel
*/ */
@Override @Override
public AddImageVisualPanel1 getComponent() { public AddImageWizardChooseDataSourceVisual getComponent() {
if (component == null) { if (component == null) {
component = new AddImageVisualPanel1(this); component = new AddImageWizardChooseDataSourceVisual(this);
} }
component.addPropertyChangeListener(this); component.addPropertyChangeListener(this);
return component; return component;
@ -194,7 +194,7 @@ class AddImageWizardPanel1 implements WizardDescriptor.Panel<WizardDescriptor>,
try { try {
cleanupTask.cleanup(); cleanupTask.cleanup();
} catch (Exception ex) { } catch (Exception ex) {
Logger logger = Logger.getLogger(AddImageWizardPanel1.class.getName()); Logger logger = Logger.getLogger(AddImageWizardChooseDataSourcePanel.class.getName());
logger.log(Level.WARNING, "Error cleaning up image task", ex); logger.log(Level.WARNING, "Error cleaning up image task", ex);
} finally { } finally {
cleanupTask.disable(); cleanupTask.disable();

View File

@ -7,7 +7,7 @@
<Component class="javax.swing.JLabel" name="jLabel2"> <Component class="javax.swing.JLabel" name="jLabel2">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardChooseDataSourceVisual.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
@ -85,14 +85,14 @@
<Component class="javax.swing.JLabel" name="nextLabel"> <Component class="javax.swing.JLabel" name="nextLabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.nextLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardChooseDataSourceVisual.nextLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="timeZoneLabel"> <Component class="javax.swing.JLabel" name="timeZoneLabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.timeZoneLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardChooseDataSourceVisual.timeZoneLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
@ -110,17 +110,17 @@
<Component class="javax.swing.JCheckBox" name="noFatOrphansCheckbox"> <Component class="javax.swing.JCheckBox" name="noFatOrphansCheckbox">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.noFatOrphansCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardChooseDataSourceVisual.noFatOrphansCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.noFatOrphansCheckbox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardChooseDataSourceVisual.noFatOrphansCheckbox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="descLabel"> <Component class="javax.swing.JLabel" name="descLabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.descLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardChooseDataSourceVisual.descLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
@ -170,7 +170,7 @@
<Component class="javax.swing.JLabel" name="typeTabel"> <Component class="javax.swing.JLabel" name="typeTabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.typeTabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardChooseDataSourceVisual.typeTabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
@ -215,7 +215,7 @@
<Font name="Tahoma" size="14" style="1"/> <Font name="Tahoma" size="14" style="1"/>
</Property> </Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.imgInfoLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardChooseDataSourceVisual.imgInfoLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>

View File

@ -34,13 +34,16 @@ import javax.swing.event.ListDataListener;
import org.sleuthkit.autopsy.casemodule.ContentTypePanel.ContentType; import org.sleuthkit.autopsy.casemodule.ContentTypePanel.ContentType;
/** /**
* The "Add Image" wizard panel 1. This class is used to design the "form" of * visual component for the first panel of add image wizard. Allows user to pick
* the panel 1 for "Add Image" wizard panel. * data source and timezone.
* *
*/ */
final class AddImageVisualPanel1 extends JPanel { final class AddImageWizardChooseDataSourceVisual extends JPanel {
enum EVENT {UPDATE_UI, FOCUS_NEXT}; enum EVENT {
UPDATE_UI, FOCUS_NEXT
};
static final List<String> rawExt = Arrays.asList(new String[]{".img", ".dd", ".001", ".aa", ".raw"}); static final List<String> rawExt = Arrays.asList(new String[]{".img", ".dd", ".001", ".aa", ".raw"});
static final String rawDesc = "Raw Images (*.img, *.dd, *.001, *.aa, *.raw)"; static final String rawDesc = "Raw Images (*.img, *.dd, *.001, *.aa, *.raw)";
static GeneralFilter rawFilter = new GeneralFilter(rawExt, rawDesc); static GeneralFilter rawFilter = new GeneralFilter(rawExt, rawDesc);
@ -48,22 +51,23 @@ final class AddImageVisualPanel1 extends JPanel {
static final String encaseDesc = "Encase Images (*.e01)"; static final String encaseDesc = "Encase Images (*.e01)";
static GeneralFilter encaseFilter = new GeneralFilter(encaseExt, encaseDesc); static GeneralFilter encaseFilter = new GeneralFilter(encaseExt, encaseDesc);
static final List<String> allExt = new ArrayList<String>(); static final List<String> allExt = new ArrayList<String>();
static { static {
allExt.addAll(rawExt); allExt.addAll(rawExt);
allExt.addAll(encaseExt); allExt.addAll(encaseExt);
} }
static final String allDesc = "All Supported Types"; static final String allDesc = "All Supported Types";
static GeneralFilter allFilter = new GeneralFilter(allExt, allDesc); static GeneralFilter allFilter = new GeneralFilter(allExt, allDesc);
private AddImageWizardPanel1 wizPanel; private AddImageWizardChooseDataSourcePanel wizPanel;
private ContentTypeModel model; private ContentTypeModel model;
private ContentTypePanel currentPanel; private ContentTypePanel currentPanel;
/** /**
* Creates new form AddImageVisualPanel1 * Creates new form AddImageVisualPanel1
*
* @param wizPanel corresponding WizardPanel to handle logic of wizard step * @param wizPanel corresponding WizardPanel to handle logic of wizard step
*/ */
AddImageVisualPanel1(AddImageWizardPanel1 wizPanel) { AddImageWizardChooseDataSourceVisual(AddImageWizardChooseDataSourcePanel wizPanel) {
initComponents(); initComponents();
this.wizPanel = wizPanel; this.wizPanel = wizPanel;
createTimeZoneList(); createTimeZoneList();
@ -80,6 +84,7 @@ final class AddImageVisualPanel1 extends JPanel {
/** /**
* Changes the current panel to the given panel. * Changes the current panel to the given panel.
*
* @param panel instance of ImageTypePanel to change to * @param panel instance of ImageTypePanel to change to
*/ */
private void updateCurrentPanel(ContentTypePanel panel) { private void updateCurrentPanel(ContentTypePanel panel) {
@ -89,17 +94,15 @@ final class AddImageVisualPanel1 extends JPanel {
typePanel.validate(); typePanel.validate();
typePanel.repaint(); typePanel.repaint();
currentPanel.addPropertyChangeListener(new PropertyChangeListener() { currentPanel.addPropertyChangeListener(new PropertyChangeListener() {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
if(evt.getPropertyName().equals(AddImageVisualPanel1.EVENT.UPDATE_UI.toString())) { if (evt.getPropertyName().equals(AddImageWizardChooseDataSourceVisual.EVENT.UPDATE_UI.toString())) {
updateUI(null); updateUI(null);
} }
if(evt.getPropertyName().equals(AddImageVisualPanel1.EVENT.FOCUS_NEXT.toString())) { if (evt.getPropertyName().equals(AddImageWizardChooseDataSourceVisual.EVENT.FOCUS_NEXT.toString())) {
wizPanel.moveFocusToNext(); wizPanel.moveFocusToNext();
} }
} }
}); });
currentPanel.select(); currentPanel.select();
if (currentPanel.getContentType().equals(ContentType.LOCAL)) { if (currentPanel.getContentType().equals(ContentType.LOCAL)) {
@ -107,8 +110,7 @@ final class AddImageVisualPanel1 extends JPanel {
noFatOrphansCheckbox.setEnabled(false); noFatOrphansCheckbox.setEnabled(false);
descLabel.setEnabled(false); descLabel.setEnabled(false);
timeZoneComboBox.setEnabled(false); timeZoneComboBox.setEnabled(false);
} } else {
else {
noFatOrphansCheckbox.setEnabled(true); noFatOrphansCheckbox.setEnabled(true);
descLabel.setEnabled(true); descLabel.setEnabled(true);
timeZoneComboBox.setEnabled(true); timeZoneComboBox.setEnabled(true);
@ -154,6 +156,7 @@ final class AddImageVisualPanel1 extends JPanel {
/** /**
* Sets the image path of the current panel. * Sets the image path of the current panel.
*
* @param s the image path to set * @param s the image path to set
*/ */
public void setContentPath(String s) { public void setContentPath(String s) {
@ -194,17 +197,13 @@ final class AddImageVisualPanel1 extends JPanel {
String item = String.format("(GMT%+d:%02d) %s", hour, minutes, id); String item = String.format("(GMT%+d:%02d) %s", hour, minutes, id);
/* /*
DateFormat dfm = new SimpleDateFormat("z"); * DateFormat dfm = new SimpleDateFormat("z");
dfm.setTimeZone(zone); * dfm.setTimeZone(zone); boolean hasDaylight =
boolean hasDaylight = zone.useDaylightTime(); * zone.useDaylightTime(); String first = dfm.format(new Date(2010,
String first = dfm.format(new Date(2010, 1, 1)); * 1, 1)); String second = dfm.format(new Date(2011, 6, 6)); int mid
String second = dfm.format(new Date(2011, 6, 6)); * = hour * -1; String result = first + Integer.toString(mid);
int mid = hour * -1; * if(hasDaylight){ result = result + second; }
String result = first + Integer.toString(mid); * timeZoneComboBox.addItem(item + " (" + result + ")");
if(hasDaylight){
result = result + second;
}
timeZoneComboBox.addItem(item + " (" + result + ")");
*/ */
timeZoneComboBox.addItem(item); timeZoneComboBox.addItem(item);
} }
@ -240,24 +239,24 @@ final class AddImageVisualPanel1 extends JPanel {
typeComboBox = new javax.swing.JComboBox<ContentTypePanel>(); typeComboBox = new javax.swing.JComboBox<ContentTypePanel>();
imgInfoLabel = new javax.swing.JLabel(); imgInfoLabel = new javax.swing.JLabel();
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.jLabel2.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(AddImageWizardChooseDataSourceVisual.class, "AddImageWizardChooseDataSourceVisual.jLabel2.text")); // NOI18N
setPreferredSize(new java.awt.Dimension(588, 328)); setPreferredSize(new java.awt.Dimension(588, 328));
org.openide.awt.Mnemonics.setLocalizedText(nextLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.nextLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(nextLabel, org.openide.util.NbBundle.getMessage(AddImageWizardChooseDataSourceVisual.class, "AddImageWizardChooseDataSourceVisual.nextLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(timeZoneLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.timeZoneLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(timeZoneLabel, org.openide.util.NbBundle.getMessage(AddImageWizardChooseDataSourceVisual.class, "AddImageWizardChooseDataSourceVisual.timeZoneLabel.text")); // NOI18N
timeZoneComboBox.setMaximumRowCount(30); timeZoneComboBox.setMaximumRowCount(30);
org.openide.awt.Mnemonics.setLocalizedText(noFatOrphansCheckbox, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.noFatOrphansCheckbox.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(noFatOrphansCheckbox, org.openide.util.NbBundle.getMessage(AddImageWizardChooseDataSourceVisual.class, "AddImageWizardChooseDataSourceVisual.noFatOrphansCheckbox.text")); // NOI18N
noFatOrphansCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.noFatOrphansCheckbox.toolTipText")); // NOI18N noFatOrphansCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(AddImageWizardChooseDataSourceVisual.class, "AddImageWizardChooseDataSourceVisual.noFatOrphansCheckbox.toolTipText")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(descLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.descLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(descLabel, org.openide.util.NbBundle.getMessage(AddImageWizardChooseDataSourceVisual.class, "AddImageWizardChooseDataSourceVisual.descLabel.text")); // NOI18N
inputPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); inputPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
org.openide.awt.Mnemonics.setLocalizedText(typeTabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.typeTabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(typeTabel, org.openide.util.NbBundle.getMessage(AddImageWizardChooseDataSourceVisual.class, "AddImageWizardChooseDataSourceVisual.typeTabel.text")); // NOI18N
typePanel.setMinimumSize(new java.awt.Dimension(0, 65)); typePanel.setMinimumSize(new java.awt.Dimension(0, 65));
typePanel.setPreferredSize(new java.awt.Dimension(521, 65)); typePanel.setPreferredSize(new java.awt.Dimension(521, 65));
@ -301,7 +300,7 @@ final class AddImageVisualPanel1 extends JPanel {
); );
imgInfoLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N imgInfoLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(imgInfoLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.imgInfoLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(imgInfoLabel, org.openide.util.NbBundle.getMessage(AddImageWizardChooseDataSourceVisual.class, "AddImageWizardChooseDataSourceVisual.imgInfoLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
@ -346,7 +345,6 @@ final class AddImageVisualPanel1 extends JPanel {
.addGap(0, 0, 0)) .addGap(0, 0, 0))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1; private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JLabel descLabel; private javax.swing.JLabel descLabel;
@ -378,10 +376,10 @@ final class AddImageVisualPanel1 extends JPanel {
* ComboBoxModel to control typeComboBox and supply ImageTypePanels. * ComboBoxModel to control typeComboBox and supply ImageTypePanels.
*/ */
private class ContentTypeModel implements ComboBoxModel<ContentTypePanel> { private class ContentTypeModel implements ComboBoxModel<ContentTypePanel> {
private ContentTypePanel selected; private ContentTypePanel selected;
private ContentTypePanel[] types = ContentTypePanel.getPanels(); private ContentTypePanel[] types = ContentTypePanel.getPanels();
@Override @Override
public void setSelectedItem(Object anItem) { public void setSelectedItem(Object anItem) {
selected = (ContentTypePanel) anItem; selected = (ContentTypePanel) anItem;
@ -410,6 +408,5 @@ final class AddImageVisualPanel1 extends JPanel {
@Override @Override
public void removeListDataListener(ListDataListener l) { public void removeListDataListener(ListDataListener l) {
} }
} }
} }

View File

@ -41,7 +41,6 @@ import org.sleuthkit.autopsy.casemodule.ContentTypePanel.ContentType;
import org.sleuthkit.autopsy.casemodule.services.FileManager; import org.sleuthkit.autopsy.casemodule.services.FileManager;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.ingest.IngestDialog;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.Image;
@ -52,12 +51,14 @@ import org.sleuthkit.datamodel.TskDataException;
import org.sleuthkit.datamodel.TskException; import org.sleuthkit.datamodel.TskException;
/** /**
* The "Add Image" wizard panel3. Presents the options to finish/cancel * second panel of add image wizard, allows user to configure ingest modules.
* image-add and run ingest. *
* TODO: review this for dead code. think about moving logic of adding image to
* 3rd panel( {@link AddImageWizardAddingProgressPanel}) separate class -jm
*/ */
class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> { class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDescriptor> {
private static final Logger logger = Logger.getLogger(AddImageWizardPanel3.class.getName()); private static final Logger logger = Logger.getLogger(AddImageWizardIngestConfigPanel.class.getName());
private IngestConfigurator ingestConfig; private IngestConfigurator ingestConfig;
/** /**
* The visual component that displays this panel. If you need to access the * The visual component that displays this panel. If you need to access the
@ -76,20 +77,18 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
private boolean noFatOrphans; private boolean noFatOrphans;
// task that will clean up the created database file if the wizard is cancelled before it finishes // task that will clean up the created database file if the wizard is cancelled before it finishes
private AddImageAction.CleanupTask cleanupImage; // initialized to null in readSettings() private AddImageAction.CleanupTask cleanupImage; // initialized to null in readSettings()
// flag to control the availiablity of next action
private boolean imgAdded; // initalized to false in readSettings()
private CurrentDirectoryFetcher fetcher; private CurrentDirectoryFetcher fetcher;
private AddImageProcess process; private AddImageProcess process;
private AddImageAction action; private AddImageAction action;
private AddImageTask addImageTask; private AddImageTask addImageTask;
private AddLocalFilesTask addLocalFilesTask; private AddLocalFilesTask addLocalFilesTask;
private AddImageWizardPanel2 wizPanel; private AddImageWizardAddingProgressPanel progressPanel;
AddImageWizardPanel3(AddImageAction action, AddImageWizardPanel2 wizPanel) { AddImageWizardIngestConfigPanel(AddImageAction action, AddImageWizardAddingProgressPanel proPanel) {
this.action = action; this.action = action;
this.wizPanel = wizPanel; this.progressPanel = proPanel;
ingestConfig = Lookup.getDefault().lookup(IngestConfigurator.class); ingestConfig = Lookup.getDefault().lookup(IngestConfigurator.class);
List<String> messages = ingestConfig.setContext(AddImageWizardPanel3.class.getCanonicalName()); List<String> messages = ingestConfig.setContext(AddImageWizardIngestConfigPanel.class.getCanonicalName());
if (messages.isEmpty() == false) { if (messages.isEmpty() == false) {
StringBuilder warning = new StringBuilder(); StringBuilder warning = new StringBuilder();
for (String message : messages) { for (String message : messages) {
@ -110,7 +109,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
@Override @Override
public Component getComponent() { public Component getComponent() {
if (component == null) { if (component == null) {
component = new AddImageVisualPanel3(ingestConfig.getIngestConfigPanel()); component = new AddImageWizardIngestConfigVisual(ingestConfig.getIngestConfigPanel());
} }
return component; return component;
} }
@ -183,7 +182,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
settings.setOptions(new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, WizardDescriptor.FINISH_OPTION, cancel}); settings.setOptions(new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, WizardDescriptor.FINISH_OPTION, cancel});
cleanupImage = null; cleanupImage = null;
readyToIngest = false; readyToIngest = false;
imgAdded = false;
newContents.clear(); newContents.clear();
dataSourcePath = (String) settings.getProperty(AddImageAction.DATASOURCEPATH_PROP); dataSourcePath = (String) settings.getProperty(AddImageAction.DATASOURCEPATH_PROP);
dataSourceType = (ContentType) settings.getProperty(AddImageAction.DATASOURCETYPE_PROP); dataSourceType = (ContentType) settings.getProperty(AddImageAction.DATASOURCETYPE_PROP);
@ -228,7 +227,8 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
ingested = true; ingested = true;
ingestConfig.setContent(newContents); ingestConfig.setContent(newContents);
ingestConfig.start(); ingestConfig.start();
wizPanel.getComponent().appendProgressText(" Ingest started."); progressPanel.setStateFinished();
} }
} }
@ -240,10 +240,10 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
AddImageTask task; AddImageTask task;
JProgressBar prog; JProgressBar prog;
AddImageVisualPanel2 wiz; AddImageWizardAddingProgressVisual wiz;
AddImageProcess proc; AddImageProcess proc;
CurrentDirectoryFetcher(JProgressBar prog, AddImageVisualPanel2 wiz, AddImageProcess proc) { CurrentDirectoryFetcher(JProgressBar prog, AddImageWizardAddingProgressVisual wiz, AddImageProcess proc) {
this.wiz = wiz; this.wiz = wiz;
this.proc = proc; this.proc = proc;
this.prog = prog; this.prog = prog;
@ -260,7 +260,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
wiz.changeCurrentDir(proc.currentDirectory()); wiz.setCurrentDirText(proc.currentDirectory());
} }
}); });
@ -271,14 +271,6 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
return -1; return -1;
} }
} }
/**
* When done, set the Wizards processing tags to be invisible
*/
@Override
protected void done() {
wiz.setProcessInvis();
}
} }
/** /**
@ -301,7 +293,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
private Logger logger = Logger.getLogger(AddLocalFilesTask.class.getName()); private Logger logger = Logger.getLogger(AddLocalFilesTask.class.getName());
protected AddLocalFilesTask(WizardDescriptor settings) { protected AddLocalFilesTask(WizardDescriptor settings) {
this.progressBar = wizPanel.getComponent().getCrDbProgressBar(); this.progressBar = progressPanel.getComponent().getProgressBar();
currentCase = Case.getCurrentCase(); currentCase = Case.getCurrentCase();
this.settings = settings; this.settings = settings;
} }
@ -310,6 +302,7 @@ class AddImageWizardPanel3 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 * @return
*
* @throws Exception * @throws Exception
*/ */
@Override @Override
@ -326,10 +319,10 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
}; };
cancelledWhileRunning.enable(); cancelledWhileRunning.enable();
final LocalFilesAddProgressUpdater progUpdater = new LocalFilesAddProgressUpdater(this.progressBar, wizPanel.getComponent()); final LocalFilesAddProgressUpdater progUpdater = new LocalFilesAddProgressUpdater(this.progressBar, progressPanel.getComponent());
try { try {
final FileManager fileManager = currentCase.getServices().getFileManager(); final FileManager fileManager = currentCase.getServices().getFileManager();
wizPanel.setStateStarted(); progressPanel.setStateStarted();
String[] paths = dataSourcePath.split(LocalFilesPanel.FILES_SEP); String[] paths = dataSourcePath.split(LocalFilesPanel.FILES_SEP);
List<String> absLocalPaths = new ArrayList<String>(); List<String> absLocalPaths = new ArrayList<String>();
for (String path : paths) { for (String path : paths) {
@ -363,29 +356,31 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
setProgress(100); setProgress(100);
//clear updates //clear updates
wizPanel.getComponent().setProcessInvis(); // progressPanel.getComponent().setProcessInvis();
if (interrupted || hasCritError) { if (interrupted || hasCritError) {
logger.log(Level.INFO, "Handling errors or interruption that occured in logical files process"); logger.log(Level.INFO, "Handling errors or interruption that occured in logical files process");
if (hasCritError) { if (hasCritError) {
//core error //core error
wizPanel.getComponent().setErrors(errorString, true); progressPanel.getComponent().showErrors(errorString, true);
} }
return; return;
} else if (errorString != null) { } else {
if (errorString != null) {
//data error (non-critical) //data error (non-critical)
logger.log(Level.INFO, "Handling non-critical errors that occured in logical files process"); logger.log(Level.INFO, "Handling non-critical errors that occured in logical files process");
wizPanel.getComponent().setErrors(errorString, false); progressPanel.getComponent().showErrors(errorString, false);
}
} }
try { try {
// When everything happens without an error: // When everything happens without an error:
if (errorString == null) { // complete progress bar if (errorString == null) { // complete progress bar
wizPanel.getComponent().changeProgressBarTextAndColor("*Logical Files added.", 100, Color.black); progressPanel.getComponent().setProgressBarTextAndColor("*Logical Files added.", 100, Color.black);
} }
// Get attention for the process finish // Get attention for the process finish
java.awt.Toolkit.getDefaultToolkit().beep(); //BEEP! java.awt.Toolkit.getDefaultToolkit().beep(); //BEEP!
AddImageVisualPanel2 panel = wizPanel.getComponent(); AddImageWizardAddingProgressVisual panel = progressPanel.getComponent();
if (panel != null) { if (panel != null) {
Window w = SwingUtilities.getWindowAncestor(panel); Window w = SwingUtilities.getWindowAncestor(panel);
if (w != null) { if (w != null) {
@ -393,7 +388,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
} }
} }
wizPanel.setStateFinished(); progressPanel.setStateFinished();
//notify the case //notify the case
if (!newContents.isEmpty()) { if (!newContents.isEmpty()) {
@ -406,7 +401,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
} catch (Exception ex) { } catch (Exception ex) {
//handle unchecked exceptions //handle unchecked exceptions
logger.log(Level.WARNING, "Unexpected errors occurred while running post add image cleanup. ", ex); logger.log(Level.WARNING, "Unexpected errors occurred while running post add image cleanup. ", ex);
wizPanel.getComponent().changeProgressBarTextAndColor("*Failed to add image.", 0, Color.black); // set error message progressPanel.getComponent().setProgressBarTextAndColor("*Failed to add image.", 0, Color.black); // set error message
logger.log(Level.SEVERE, "Error adding image to case", ex); logger.log(Level.SEVERE, "Error adding image to case", ex);
} }
} }
@ -418,9 +413,9 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
private int count = 0; private int count = 0;
private JProgressBar prog; private JProgressBar prog;
private AddImageVisualPanel2 wiz; private AddImageWizardAddingProgressVisual wiz;
LocalFilesAddProgressUpdater(JProgressBar prog, AddImageVisualPanel2 wiz) { LocalFilesAddProgressUpdater(JProgressBar prog, AddImageWizardAddingProgressVisual wiz) {
this.wiz = wiz; this.wiz = wiz;
this.prog = prog; this.prog = prog;
} }
@ -431,7 +426,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
wiz.changeCurrentDir(newFile.getParentPath() + "/" + newFile.getName()); wiz.setCurrentDirText(newFile.getParentPath() + "/" + newFile.getName());
} }
}); });
@ -452,25 +447,25 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
private boolean interrupted = false; private boolean interrupted = false;
private boolean hasCritError = false; private boolean hasCritError = false;
private String errorString = null; private String errorString = null;
private long start; private WizardDescriptor wizDescriptor;
private WizardDescriptor settings;
private Logger logger = Logger.getLogger(AddImageTask.class.getName()); private Logger logger = Logger.getLogger(AddImageTask.class.getName());
protected AddImageTask(WizardDescriptor settings) { protected AddImageTask(WizardDescriptor settings) {
this.progressBar = wizPanel.getComponent().getCrDbProgressBar(); this.progressBar = progressPanel.getComponent().getProgressBar();
currentCase = Case.getCurrentCase(); currentCase = Case.getCurrentCase();
this.settings = settings; this.wizDescriptor = settings;
} }
/** /**
* Starts the addImage process, but does not commit the results. * Starts the addImage process, but does not commit the results.
* *
* @return * @return
*
* @throws Exception * @throws Exception
*/ */
@Override @Override
protected Integer doInBackground() { protected Integer doInBackground() {
start = System.currentTimeMillis();
this.setProgress(0); this.setProgress(0);
@ -504,10 +499,10 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
} }
process = currentCase.makeAddImageProcess(timeZone, true, noFatOrphans); process = currentCase.makeAddImageProcess(timeZone, true, noFatOrphans);
fetcher = new CurrentDirectoryFetcher(this.progressBar, wizPanel.getComponent(), process); fetcher = new CurrentDirectoryFetcher(this.progressBar, progressPanel.getComponent(), process);
cancelledWhileRunning.enable(); cancelledWhileRunning.enable();
try { try {
wizPanel.setStateStarted(); progressPanel.setStateStarted();
fetcher.execute(); fetcher.execute();
process.run(new String[]{dataSourcePath}); process.run(new String[]{dataSourcePath});
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
@ -541,6 +536,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
* *
* @param settings property set to get AddImageProcess and CleanupTask * @param settings property set to get AddImageProcess and CleanupTask
* from * from
*
* @throws Exception if commit or adding the image to the case failed * @throws Exception if commit or adding the image to the case failed
*/ */
private void commitImage(WizardDescriptor settings) throws Exception { private void commitImage(WizardDescriptor settings) throws Exception {
@ -591,13 +587,15 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
revert(); revert();
if (hasCritError) { if (hasCritError) {
//core error //core error
wizPanel.getComponent().setErrors(errorString, true); progressPanel.getComponent().showErrors(errorString, true);
} }
return; return;
} else if (errorString != null) { } else {
if (errorString != null) {
//data error (non-critical) //data error (non-critical)
logger.log(Level.INFO, "Handling non-critical errors that occured in add image process"); logger.log(Level.INFO, "Handling non-critical errors that occured in add image process");
wizPanel.getComponent().setErrors(errorString, false); progressPanel.setErrors(errorString, false);
}
} }
@ -617,12 +615,12 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
cleanupImage.enable(); cleanupImage.enable();
if (errorString == null) { // complete progress bar if (errorString == null) { // complete progress bar
wizPanel.getComponent().changeProgressBarTextAndColor("*Data Source added.", 100, Color.black); progressPanel.getComponent().setProgressBarTextAndColor("*Data Source added.", 100, Color.black);
} }
// Get attention for the process finish // Get attention for the process finish
java.awt.Toolkit.getDefaultToolkit().beep(); //BEEP! java.awt.Toolkit.getDefaultToolkit().beep(); //BEEP!
AddImageVisualPanel2 panel = wizPanel.getComponent(); AddImageWizardAddingProgressVisual panel = progressPanel.getComponent();
if (panel != null) { if (panel != null) {
Window w = SwingUtilities.getWindowAncestor(panel); Window w = SwingUtilities.getWindowAncestor(panel);
if (w != null) { if (w != null) {
@ -631,7 +629,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
} }
// Tell the panel we're done // Tell the panel we're done
wizPanel.setStateFinished(); progressPanel.setStateFinished();
// Commit the image // Commit the image
if (!newContents.isEmpty()) //already commited if (!newContents.isEmpty()) //already commited
@ -643,7 +641,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
if (process != null) { // and if we're done configuring ingest if (process != null) { // and if we're done configuring ingest
// commit anything // commit anything
try { try {
commitImage(settings); commitImage(wizDescriptor);
} catch (Exception ex) { } catch (Exception ex) {
// Log error/display warning // Log error/display warning
logger.log(Level.SEVERE, "Error adding image to case.", ex); logger.log(Level.SEVERE, "Error adding image to case.", ex);
@ -660,7 +658,7 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
logger.log(Level.WARNING, "Unexpected errors occurred while running post add image cleanup. ", ex); logger.log(Level.WARNING, "Unexpected errors occurred while running post add image cleanup. ", ex);
wizPanel.getComponent().changeProgressBarTextAndColor("*Failed to add image.", 0, Color.black); // set error message progressPanel.getComponent().setProgressBarTextAndColor("*Failed to add image.", 0, Color.black); // set error message
// Log error/display warning // Log error/display warning

View File

@ -53,14 +53,14 @@
<Font name="Tahoma" size="14" style="1"/> <Font name="Tahoma" size="14" style="1"/>
</Property> </Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel3.titleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardIngestConfigVisual.titleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="subtitleLabel"> <Component class="javax.swing.JLabel" name="subtitleLabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel3.subtitleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageWizardIngestConfigVisual.subtitleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>

View File

@ -16,20 +16,26 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.casemodule; package org.sleuthkit.autopsy.casemodule;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import javax.swing.JPanel; import javax.swing.JPanel;
/** /**
* Data Source added, ingest configure wizard visual panel 3 * visual component of 2nd panle in add image wizard. allows the user to
* configure ingest modules. delegates most details to ingestPanel attribute.
*
*
*/ */
public class AddImageVisualPanel3 extends javax.swing.JPanel { public class AddImageWizardIngestConfigVisual extends javax.swing.JPanel {
//could this be something more specific than JPanel? - jm
private JPanel ingestPanel = null; private JPanel ingestPanel = null;
/** Creates new form AddImageVisualPanel3 */ /**
public AddImageVisualPanel3(JPanel ingestPanel) { * Creates new form AddImageVisualPanel3
*/
public AddImageWizardIngestConfigVisual(JPanel ingestPanel) {
this.ingestPanel = ingestPanel; this.ingestPanel = ingestPanel;
initComponents(); initComponents();
customizeComponents(); customizeComponents();
@ -52,10 +58,10 @@ public class AddImageVisualPanel3 extends javax.swing.JPanel {
return "Configure Ingest Modules"; return "Configure Ingest Modules";
} }
/** This method is called from within the constructor to /**
* initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is always
* always regenerated by the Form Editor. * regenerated by the Form Editor.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@ -68,9 +74,9 @@ public class AddImageVisualPanel3 extends javax.swing.JPanel {
setPreferredSize(new java.awt.Dimension(569, 300)); setPreferredSize(new java.awt.Dimension(569, 300));
titleLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N titleLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
titleLabel.setText(org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.titleLabel.text")); // NOI18N titleLabel.setText(org.openide.util.NbBundle.getMessage(AddImageWizardIngestConfigVisual.class, "AddImageWizardIngestConfigVisual.titleLabel.text")); // NOI18N
subtitleLabel.setText(org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.subtitleLabel.text")); // NOI18N subtitleLabel.setText(org.openide.util.NbBundle.getMessage(AddImageWizardIngestConfigVisual.class, "AddImageWizardIngestConfigVisual.subtitleLabel.text")); // NOI18N
configPanel.setPreferredSize(new java.awt.Dimension(569, 255)); configPanel.setPreferredSize(new java.awt.Dimension(569, 255));

View File

@ -47,10 +47,10 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator<WizardDescript
*/ */
private List<WizardDescriptor.Panel<WizardDescriptor>> getPanels() { private List<WizardDescriptor.Panel<WizardDescriptor>> getPanels() {
if (panels == null) { if (panels == null) {
AddImageWizardPanel2 wizPanel = new AddImageWizardPanel2(); AddImageWizardAddingProgressPanel wizPanel = new AddImageWizardAddingProgressPanel();
panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>(); panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
panels.add(new AddImageWizardPanel1()); panels.add(new AddImageWizardChooseDataSourcePanel());
panels.add(new AddImageWizardPanel3(action, wizPanel)); panels.add(new AddImageWizardIngestConfigPanel(action, wizPanel));
panels.add(wizPanel); panels.add(wizPanel);
String[] steps = new String[panels.size()]; String[] steps = new String[panels.size()];

View File

@ -94,8 +94,6 @@ NewJPanel.jFormattedTextField1.text=jFormattedTextField1
NewJPanel.jButton1.text=Rename NewJPanel.jButton1.text=Rename
NewJPanel.jLabel4.text=Database: NewJPanel.jLabel4.text=Database:
AddImageVisualPanel2.indexImageCheckBox.text=Index image for keyword search AddImageVisualPanel2.indexImageCheckBox.text=Index image for keyword search
AddImageVisualPanel3.titleLabel.text=Configure Ingest Modules
AddImageVisualPanel3.subtitleLabel.text=Configure the ingest modules you would like to run on this data source.
CasePropertiesForm.caseNumberLabel.text=Case Number: CasePropertiesForm.caseNumberLabel.text=Case Number:
CasePropertiesForm.examinerLabel.text=Examiner: CasePropertiesForm.examinerLabel.text=Examiner:
CasePropertiesForm.caseNumberTextField.text= CasePropertiesForm.caseNumberTextField.text=
@ -116,23 +114,11 @@ ImageFilePanel.pathLabel.text=Browse for an image file:
ImageFilePanel.browseButton.text=Browse ImageFilePanel.browseButton.text=Browse
ImageFilePanel.pathTextField.text= ImageFilePanel.pathTextField.text=
LocalDiskPanel.diskLabel.text=Select a local disk: LocalDiskPanel.diskLabel.text=Select a local disk:
AddImageVisualPanel1.nextLabel.text=<html> Press 'Next' to analyze the input data, extract volume and file system data, and populate a local database.</html>
MissingImageDialog.selectButton.text=Select Image MissingImageDialog.selectButton.text=Select Image
MissingImageDialog.typeTabel.text=Select input type to add: MissingImageDialog.typeTabel.text=Select input type to add:
MissingImageDialog.titleLabel.text=Search for missing image MissingImageDialog.titleLabel.text=Search for missing image
AddImageVisualPanel1.jLabel2.text=jLabel2
AddImageVisualPanel1.descLabel.text=(faster results, although some data will not be searched)
AddImageVisualPanel1.timeZoneLabel.text=Please select the input timezone:
AddImageVisualPanel1.noFatOrphansCheckbox.toolTipText=
AddImageVisualPanel1.noFatOrphansCheckbox.text=Ignore orphan files in FAT file systems
MissingImageDialog.cancelButton.text=Cancel MissingImageDialog.cancelButton.text=Cancel
LocalDiskPanel.errorLabel.text=Error Label LocalDiskPanel.errorLabel.text=Error Label
AddImageVisualPanel1.typeTabel.text=Select source type to add:
AddImageVisualPanel1.imgInfoLabel.text=Enter Data Source Information:
AddImageLoadingPanel.crDbLabel.text=Adding Data Source
AddImageLoadingPanel.Label_CurrentDirectory_Static.text=Currently Adding:
AddImageLoadingPanel.jLabel5.text=Processing Data Source and Adding to Database
AddImageLoadingPanel.jLabel1.text=File system information is being added to a local database. File analysis will start when this finishes.
AddImageDonePanel.statusLabel.text=File system has been added to the local database. Files are being analyzed. AddImageDonePanel.statusLabel.text=File system has been added to the local database. Files are being analyzed.
AddImageDonePanel.crDbLabel.text=Adding Data Source - Complete AddImageDonePanel.crDbLabel.text=Adding Data Source - Complete
LocalFilesPanel.infoLabel.text=Add local files and folders: LocalFilesPanel.infoLabel.text=Add local files and folders:
@ -145,3 +131,21 @@ LocalFilesPanel.selectedPaths.toolTipText=
LocalFilesPanel.localFileChooser.approveButtonText=Select LocalFilesPanel.localFileChooser.approveButtonText=Select
LocalFilesPanel.localFileChooser.approveButtonToolTipText= LocalFilesPanel.localFileChooser.approveButtonToolTipText=
LocalFilesPanel.selectButton.actionCommand=Add LocalFilesPanel.selectButton.actionCommand=Add
AddImageWizardIngestConfigVisual.subtitleLabel.text=Configure the ingest modules you would like to run on this data source.
AddImageWizardIngestConfigVisual.titleLabel.text=Configure Ingest Modules
AddImageWizardAddingProgressVisual.statusLabel.text=File system has been added to the local database. Files are being analyzed.
AddImageWizardAddingProgressVisual.crDbLabel.text=Adding Data Source - Complete
AddImageWizardAddingProgressVisual.addingDataSourceLabel.text=Adding Data Source
AddImageWizardAddingProgressVisual.jLabel1.text=File system information is being added to a local database. File analysis will start when this finishes.
AddImageWizardAddingProgressVisual.jLabel5.text=Processing Data Source and Adding to Database
AddImageWizardChooseDataSourceVisual.noFatOrphansCheckbox.toolTipText=
AddImageWizardChooseDataSourceVisual.noFatOrphansCheckbox.text=Ignore orphan files in FAT file systems
AddImageWizardChooseDataSourceVisual.descLabel.text=(faster results, although some data will not be searched)
AddImageWizardChooseDataSourceVisual.typeTabel.text=Select source type to add:
AddImageWizardChooseDataSourceVisual.jLabel2.text=jLabel2
AddImageWizardChooseDataSourceVisual.timeZoneLabel.text=Please select the input timezone:
AddImageWizardChooseDataSourceVisual.nextLabel.text=<html> Press 'Next' to analyze the input data, extract volume and file system data, and populate a local database.</html>
AddImageWizardChooseDataSourceVisual.imgInfoLabel.text=Enter Data Source Information:
AddImageWizardAddingProgressVisual.progressLabel.text=<progress>
AddImageWizardAddingProgressVisual.TextArea_CurrentDirectory.border.title=Currently Adding:
AddImageWizardAddingProgressVisual.viewLogButton.text=View Log

View File

@ -43,9 +43,9 @@ public class ImageFilePanel extends ContentTypePanel implements DocumentListener
fc.setDragEnabled(false); fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false); fc.setMultiSelectionEnabled(false);
fc.addChoosableFileFilter(AddImageVisualPanel1.rawFilter); fc.addChoosableFileFilter(AddImageWizardChooseDataSourceVisual.rawFilter);
fc.addChoosableFileFilter(AddImageVisualPanel1.encaseFilter); fc.addChoosableFileFilter(AddImageWizardChooseDataSourceVisual.encaseFilter);
fc.setFileFilter(AddImageVisualPanel1.allFilter); fc.setFileFilter(AddImageWizardChooseDataSourceVisual.allFilter);
} }
/** /**
@ -131,7 +131,7 @@ public class ImageFilePanel extends ContentTypePanel implements DocumentListener
String path = fc.getSelectedFile().getPath(); String path = fc.getSelectedFile().getPath();
pathTextField.setText(path); pathTextField.setText(path);
} }
pcs.firePropertyChange(AddImageVisualPanel1.EVENT.FOCUS_NEXT.toString(), false, true); pcs.firePropertyChange(AddImageWizardChooseDataSourceVisual.EVENT.FOCUS_NEXT.toString(), false, true);
}//GEN-LAST:event_browseButtonActionPerformed }//GEN-LAST:event_browseButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
@ -194,17 +194,17 @@ public class ImageFilePanel extends ContentTypePanel implements DocumentListener
*/ */
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
pcs.firePropertyChange(AddImageVisualPanel1.EVENT.UPDATE_UI.toString(), false, true); pcs.firePropertyChange(AddImageWizardChooseDataSourceVisual.EVENT.UPDATE_UI.toString(), false, true);
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
pcs.firePropertyChange(AddImageVisualPanel1.EVENT.UPDATE_UI.toString(), false, true); pcs.firePropertyChange(AddImageWizardChooseDataSourceVisual.EVENT.UPDATE_UI.toString(), false, true);
} }
@Override @Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
pcs.firePropertyChange(AddImageVisualPanel1.EVENT.UPDATE_UI.toString(), false, true); pcs.firePropertyChange(AddImageWizardChooseDataSourceVisual.EVENT.UPDATE_UI.toString(), false, true);
} }
/** /**

View File

@ -234,7 +234,7 @@ public class LocalDiskPanel extends ContentTypePanel {
if(ready) { if(ready) {
selected = anItem; selected = anItem;
enableNext = true; enableNext = true;
pcs.firePropertyChange(AddImageVisualPanel1.EVENT.UPDATE_UI.toString(), false, true); pcs.firePropertyChange(AddImageWizardChooseDataSourceVisual.EVENT.UPDATE_UI.toString(), false, true);
} }
} }

View File

@ -98,7 +98,7 @@ public class LocalFilesPanel extends ContentTypePanel {
currentFiles.clear(); currentFiles.clear();
selectedPaths.setText(""); selectedPaths.setText("");
enableNext = false; enableNext = false;
pcs.firePropertyChange(AddImageVisualPanel1.EVENT.UPDATE_UI.toString(), false, true); pcs.firePropertyChange(AddImageWizardChooseDataSourceVisual.EVENT.UPDATE_UI.toString(), false, true);
} }
@Override @Override
@ -231,7 +231,7 @@ public class LocalFilesPanel extends ContentTypePanel {
else { else {
enableNext = false; enableNext = false;
} }
pcs.firePropertyChange(AddImageVisualPanel1.EVENT.UPDATE_UI.toString(), false, true); pcs.firePropertyChange(AddImageWizardChooseDataSourceVisual.EVENT.UPDATE_UI.toString(), false, true);
}//GEN-LAST:event_selectButtonActionPerformed }//GEN-LAST:event_selectButtonActionPerformed
private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed

View File

@ -108,10 +108,10 @@ public class MissingImageDialog extends javax.swing.JDialog {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
if(evt.getPropertyName().equals(AddImageVisualPanel1.EVENT.UPDATE_UI.toString())) { if(evt.getPropertyName().equals(AddImageWizardChooseDataSourceVisual.EVENT.UPDATE_UI.toString())) {
updateSelectButton(); updateSelectButton();
} }
if(evt.getPropertyName().equals(AddImageVisualPanel1.EVENT.FOCUS_NEXT.toString())) { if(evt.getPropertyName().equals(AddImageWizardChooseDataSourceVisual.EVENT.FOCUS_NEXT.toString())) {
moveFocusToSelect(); moveFocusToSelect();
} }
} }

View File

@ -38,6 +38,7 @@ import org.sleuthkit.datamodel.LocalFile;
import org.sleuthkit.datamodel.VirtualDirectory; import org.sleuthkit.datamodel.VirtualDirectory;
import org.sleuthkit.datamodel.LayoutFile; import org.sleuthkit.datamodel.LayoutFile;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.Transaction;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskFileRange; import org.sleuthkit.datamodel.TskFileRange;
@ -78,10 +79,12 @@ public class FileManager implements Closeable {
/** /**
* Finds a set of files that meets the name criteria. * Finds a set of files that meets the name criteria.
*
* @param dataSource Root data source to limit search results to (Image, * @param dataSource Root data source to limit search results to (Image,
* VirtualDirectory, etc.). * VirtualDirectory, etc.).
* @param fileName Pattern of the name of the file or directory to match (case * @param fileName Pattern of the name of the file or directory to match
* insensitive, used in LIKE SQL statement). * (case insensitive, used in LIKE SQL statement).
*
* @return a list of AbstractFile for files/directories whose name matches * @return a list of AbstractFile for files/directories whose name matches
* the given fileName * the given fileName
*/ */
@ -92,15 +95,17 @@ public class FileManager implements Closeable {
return tskCase.findFiles(dataSource, fileName); return tskCase.findFiles(dataSource, fileName);
} }
/** /**
* Finds a set of files that meets the name criteria. * Finds a set of files that meets the name criteria.
*
* @param dataSource Root data source to limit search results to (Image, * @param dataSource Root data source to limit search results to (Image,
* VirtualDirectory, etc.). * VirtualDirectory, etc.).
* @param fileName Pattern of the name of the file or directory to match (case * @param fileName Pattern of the name of the file or directory to match
* insensitive, used in LIKE SQL statement). * (case insensitive, used in LIKE SQL statement).
* @param dirName Pattern of the name of the parent directory to use as the root * @param dirName Pattern of the name of the parent directory to use as
* of the search (case insensitive, used in LIKE SQL statement). * the root of the search (case insensitive, used in LIKE
* SQL statement).
*
* @return a list of AbstractFile for files/directories whose name matches * @return a list of AbstractFile for files/directories whose name matches
* fileName and whose parent directory contains dirName. * fileName and whose parent directory contains dirName.
*/ */
@ -113,13 +118,16 @@ public class FileManager implements Closeable {
/** /**
* Finds a set of files that meets the name criteria. * Finds a set of files that meets the name criteria.
*
* @param dataSource Root data source to limit search results to (Image, * @param dataSource Root data source to limit search results to (Image,
* VirtualDirectory, etc.). * VirtualDirectory, etc.).
* @param fileName Pattern of the name of the file or directory to match (case * @param fileName Pattern of the name of the file or directory to match
* insensitive, used in LIKE SQL statement). * (case insensitive, used in LIKE SQL statement).
* @param parentFile Object of root/parent directory to restrict search to. * @param parentFile Object of root/parent directory to restrict search to.
*
* @return a list of AbstractFile for files/directories whose name matches * @return a list of AbstractFile for files/directories whose name matches
* fileName and that were inside a directory described by parentFsContent. * fileName and that were inside a directory described by
* parentFsContent.
*/ */
public synchronized List<AbstractFile> findFiles(Content dataSource, String fileName, AbstractFile parentFile) throws TskCoreException { public synchronized List<AbstractFile> findFiles(Content dataSource, String fileName, AbstractFile parentFile) throws TskCoreException {
if (tskCase == null) { if (tskCase == null) {
@ -133,6 +141,7 @@ public class FileManager implements Closeable {
* VirtualDirectory) where to find files * VirtualDirectory) where to find files
* @param filePath The full path to the file(s) of interest. This can * @param filePath The full path to the file(s) of interest. This can
* optionally include the image and volume names. * optionally include the image and volume names.
*
* @return a list of AbstractFile that have the given file path. * @return a list of AbstractFile that have the given file path.
*/ */
public synchronized List<AbstractFile> openFiles(Content dataSource, String filePath) throws TskCoreException { public synchronized List<AbstractFile> openFiles(Content dataSource, String filePath) throws TskCoreException {
@ -146,25 +155,30 @@ public class FileManager implements Closeable {
* Creates a derived file, adds it to the database and returns it. * Creates a derived file, adds it to the database and returns it.
* *
* @param fileName file name the derived file * @param fileName file name the derived file
* @param localPath local path of the derived file, including the file name. * @param localPath local path of the derived file, including the file
* The path is relative to the database path. * name. The path is relative to the database path.
* @param size size of the derived file in bytes * @param size size of the derived file in bytes
* @param ctime * @param ctime
* @param crtime * @param crtime
* @param atime * @param atime
* @param mtime * @param mtime
* @param isFile whether a file or directory, true if a file * @param isFile whether a file or directory, true if a file
* @param parentFile the parent file object this the new file was derived * @param parentFile the parent file object this the new file was
* from, either a fs file or parent derived file/dikr\\r * derived from, either a fs file or parent derived
* file/dikr\\r
* @param rederiveDetails details needed to re-derive file (will be specific * @param rederiveDetails details needed to re-derive file (will be specific
* to the derivation method), currently unused * to the derivation method), currently unused
* @param toolName name of derivation method/tool, currently unused * @param toolName name of derivation method/tool, currently unused
* @param toolVersion version of derivation method/tool, currently unused * @param toolVersion version of derivation method/tool, currently
* @param otherDetails details of derivation method/tool, currently unused * unused
* @param otherDetails details of derivation method/tool, currently
* unused
*
* @return newly created derived file object added to the database * @return newly created derived file object added to the database
*
* @throws TskCoreException exception thrown if the object creation failed * @throws TskCoreException exception thrown if the object creation failed
* due to a critical system error or of the file manager has already been * due to a critical system error or of the file
* closed * manager has already been closed
* *
*/ */
public synchronized DerivedFile addDerivedFile(String fileName, String localPath, long size, public synchronized DerivedFile addDerivedFile(String fileName, String localPath, long size,
@ -189,8 +203,9 @@ public class FileManager implements Closeable {
* extension) * extension)
* @param carvedFileSize size of the carved file to add * @param carvedFileSize size of the carved file to add
* @param systemId the ID of the parent volume or file system * @param systemId the ID of the parent volume or file system
* @param sectors a list of SectorGroups giving this sectors that make up * @param sectors a list of SectorGroups giving this sectors that
* this carved file. * make up this carved file.
*
* @throws TskCoreException exception thrown when critical tsk error * @throws TskCoreException exception thrown when critical tsk error
* occurred and carved file could not be added * occurred and carved file could not be added
*/ */
@ -224,12 +239,16 @@ public class FileManager implements Closeable {
* @param localAbsPaths list of absolute paths to local files and dirs * @param localAbsPaths list of absolute paths to local files and dirs
* @param addProgressUpdater notifier to receive progress notifications on * @param addProgressUpdater notifier to receive progress notifications on
* folders added, or null if not used * folders added, or null if not used
*
* @return file set root VirtualDirectory contained containing all * @return file set root VirtualDirectory contained containing all
* AbstractFile objects added * AbstractFile objects added
*
* @throws TskCoreException exception thrown if the object creation failed * @throws TskCoreException exception thrown if the object creation failed
* due to a critical system error or of the file manager has already been * due to a critical system error or of the file
* closed. There is no "revert" logic if one of the additions fails. The * manager has already been closed. There is no
* addition stops with the first error encountered. * "revert" logic if one of the additions fails.
* The addition stops with the first error
* encountered.
*/ */
public synchronized VirtualDirectory addLocalFilesDirs(List<String> localAbsPaths, FileAddProgressUpdater addProgressUpdater) throws TskCoreException { public synchronized VirtualDirectory addLocalFilesDirs(List<String> localAbsPaths, FileAddProgressUpdater addProgressUpdater) throws TskCoreException {
final List<java.io.File> rootsToAdd = new ArrayList<>(); final List<java.io.File> rootsToAdd = new ArrayList<>();
@ -244,12 +263,14 @@ public class FileManager implements Closeable {
rootsToAdd.add(localFile); rootsToAdd.add(localFile);
} }
Transaction trans = tskCase.createTransaction();
// make a virtual top-level directory for this set of files/dirs // make a virtual top-level directory for this set of files/dirs
final VirtualDirectory fileSetRootDir = addLocalFileSetRootDir(); final VirtualDirectory fileSetRootDir = addLocalFileSetRootDir(trans);
try {
// recursively add each item in the set // recursively add each item in the set
for (java.io.File localRootToAdd : rootsToAdd) { for (java.io.File localRootToAdd : rootsToAdd) {
AbstractFile localFileAdded = addLocalDirInt(fileSetRootDir, localRootToAdd, addProgressUpdater); AbstractFile localFileAdded = addLocalDirInt(trans, fileSetRootDir, localRootToAdd, addProgressUpdater);
if (localFileAdded == null) { if (localFileAdded == null) {
String msg = "One of the local files/dirs could not be added: " + localRootToAdd.getAbsolutePath(); String msg = "One of the local files/dirs could not be added: " + localRootToAdd.getAbsolutePath();
@ -263,6 +284,12 @@ public class FileManager implements Closeable {
} }
} }
trans.commit();
} catch (TskCoreException ex) {
trans.rollback();
} finally {
trans.close();
}
return fileSetRootDir; return fileSetRootDir;
} }
@ -271,9 +298,10 @@ public class FileManager implements Closeable {
* consecutive sequence number characteristic to every add operation * consecutive sequence number characteristic to every add operation
* *
* @return the virtual dir root container created * @return the virtual dir root container created
*
* @throws TskCoreException * @throws TskCoreException
*/ */
private VirtualDirectory addLocalFileSetRootDir() throws TskCoreException { private VirtualDirectory addLocalFileSetRootDir(Transaction trans) throws TskCoreException {
VirtualDirectory created = null; VirtualDirectory created = null;
@ -281,7 +309,7 @@ public class FileManager implements Closeable {
final String fileSetName = VirtualDirectoryNode.LOGICAL_FILE_SET_PREFIX + newFileSetCount; final String fileSetName = VirtualDirectoryNode.LOGICAL_FILE_SET_PREFIX + newFileSetCount;
try { try {
created = tskCase.addVirtualDirectory(0, fileSetName); created = tskCase.addVirtualDirectory(0, fileSetName, trans);
curNumFileSets = newFileSetCount; curNumFileSets = newFileSetCount;
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
String msg = "Error creating local file set dir: " + fileSetName; String msg = "Error creating local file set dir: " + fileSetName;
@ -293,17 +321,19 @@ public class FileManager implements Closeable {
} }
/** /**
* Helper (internal) method to recursively add contents of a folder. Node passed in can be a file or directory. * Helper (internal) method to recursively add contents of a folder. Node
* Children of directories are added. * passed in can be a file or directory. Children of directories are added.
* *
* @param parentVd Dir that is the parent of localFile * @param parentVd Dir that is the parent of localFile
* @param localFile File/Dir that we are adding * @param localFile File/Dir that we are adding
* @param addProgressUpdater notifier to receive progress notifications on * @param addProgressUpdater notifier to receive progress notifications on
* folders added, or null if not used * folders added, or null if not used
* @returns File object of file added or new virtualdirectory for the directory. *
* @returns File object of file added or new virtualdirectory for the
* directory.
* @throws TskCoreException * @throws TskCoreException
*/ */
private AbstractFile addLocalDirInt(VirtualDirectory parentVd, private AbstractFile addLocalDirInt(Transaction trans, VirtualDirectory parentVd,
java.io.File localFile, FileAddProgressUpdater addProgressUpdater) throws TskCoreException { java.io.File localFile, FileAddProgressUpdater addProgressUpdater) throws TskCoreException {
if (tskCase == null) { if (tskCase == null) {
@ -321,7 +351,7 @@ public class FileManager implements Closeable {
if (localFile.isDirectory()) { if (localFile.isDirectory()) {
//create virtual folder //create virtual folder
final VirtualDirectory childVd = tskCase.addVirtualDirectory(parentVd.getId(), localFile.getName()); final VirtualDirectory childVd = tskCase.addVirtualDirectory(parentVd.getId(), localFile.getName(), trans);
if (childVd != null && addProgressUpdater != null) { if (childVd != null && addProgressUpdater != null) {
addProgressUpdater.fileAdded(childVd); addProgressUpdater.fileAdded(childVd);
} }
@ -329,30 +359,32 @@ public class FileManager implements Closeable {
final java.io.File[] childrenFiles = localFile.listFiles(); final java.io.File[] childrenFiles = localFile.listFiles();
if (childrenFiles != null) { if (childrenFiles != null) {
for (java.io.File childFile : childrenFiles) { for (java.io.File childFile : childrenFiles) {
addLocalDirInt(childVd, childFile, addProgressUpdater); addLocalDirInt(trans, childVd, childFile, addProgressUpdater);
} }
} }
return childVd; return childVd;
} else { } else {
//add leaf file, base case //add leaf file, base case
return this.addLocalFileInt(parentVd, localFile); return this.addLocalFileInt(parentVd, localFile, trans);
} }
} }
/** /**
* Adds a single local/logical file to the case. Adds it to the database. * Adds a single local/logical file to the case. Adds it to the database.
* Does not refresh the views of data. Assumes that the local file exists and * Does not refresh the views of data. Assumes that the local file exists
* can be read. This checking is done by addLocalDirInt(). * and can be read. This checking is done by addLocalDirInt().
* *
* @param parentFile parent file object container (such as virtual * @param parentFile parent file object container (such as virtual
* directory, another local file, or fscontent File), * directory, another local file, or fscontent File),
* @param localFile File that we are adding * @param localFile File that we are adding
*
* @return newly created local file object added to the database * @return newly created local file object added to the database
*
* @throws TskCoreException exception thrown if the object creation failed * @throws TskCoreException exception thrown if the object creation failed
* due to a critical system error or of the file manager has already been * due to a critical system error or of the file
* closed * manager has already been closed
*/ */
private synchronized LocalFile addLocalFileInt(AbstractFile parentFile, java.io.File localFile) throws TskCoreException { private synchronized LocalFile addLocalFileInt(AbstractFile parentFile, java.io.File localFile, Transaction trans) throws TskCoreException {
if (tskCase == null) { if (tskCase == null) {
throw new TskCoreException("Attempted to use FileManager after it was closed."); throw new TskCoreException("Attempted to use FileManager after it was closed.");
@ -370,7 +402,7 @@ public class FileManager implements Closeable {
LocalFile lf = tskCase.addLocalFile(fileName, localFile.getAbsolutePath(), size, LocalFile lf = tskCase.addLocalFile(fileName, localFile.getAbsolutePath(), size,
ctime, crtime, atime, mtime, ctime, crtime, atime, mtime,
isFile, parentFile); isFile, parentFile, trans);
return lf; return lf;
} }

View File

@ -19,42 +19,51 @@
package org.sleuthkit.autopsy.corecomponents; package org.sleuthkit.autopsy.corecomponents;
import java.awt.Component; import java.awt.Component;
import java.awt.Cursor;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException; import java.beans.PropertyVetoException;
import java.io.IOException;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.JPanel; import javax.swing.JPanel;
import org.openide.explorer.ExplorerManager; import org.openide.explorer.ExplorerManager;
import org.openide.explorer.ExplorerManager.Provider; import org.openide.explorer.ExplorerManager.Provider;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContent; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContent;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
/** /**
* Holds commonalities between all DataResultViewers, such as: * This class provides a default implementation of selected methods of the
* - Pushes selection to DataContentViewers * DataResultViewer interface. Derived classes will be Swing JPanel objects.
* Additionally, the ExplorerManager.Provider interface is implemented to
* supply an ExplorerManager to derived classes and their child components.
*/ */
public abstract class AbstractDataResultViewer extends JPanel implements DataResultViewer, Provider { public abstract class AbstractDataResultViewer extends JPanel implements DataResultViewer, Provider {
private static final Logger logger = Logger.getLogger(AbstractDataResultViewer.class.getName()); private static final Logger logger = Logger.getLogger(AbstractDataResultViewer.class.getName());
protected transient ExplorerManager em; protected transient ExplorerManager em;
private PropertyChangeListener nodeSelListener;
/** /**
* Content viewer to respond to selection events Either the main one, or * Content viewer to respond to selection events Either the main one, or
* custom one if set * custom one if set
*/ */
protected DataContent contentViewer; protected DataContent contentViewer;
/**
* This constructor is intended to allow an AbstractDataResultViewer to use
* an ExplorerManager provided by a TopComponent, allowing Node selections
* to be available to Actions via the action global context lookup when
* the TopComponent has focus. The ExplorerManager must be present when the
* object is constructed so that its child components can discover it using
* the ExplorerManager.find() method.
*/
public AbstractDataResultViewer(ExplorerManager explorerManager) { public AbstractDataResultViewer(ExplorerManager explorerManager) {
this.em = explorerManager; this.em = explorerManager;
initialize(); initialize();
} }
/**
* This constructor can be used by AbstractDataResultViewers that do not
* need to make Node selections available to Actions via the action global
* context lookup.
*/
public AbstractDataResultViewer() { public AbstractDataResultViewer() {
em = new ExplorerManager(); em = new ExplorerManager();
initialize(); initialize();
@ -64,72 +73,12 @@ public abstract class AbstractDataResultViewer extends JPanel implements DataRes
//DataContent is designed to return only the default viewer from lookup //DataContent is designed to return only the default viewer from lookup
//use the default one unless set otherwise //use the default one unless set otherwise
contentViewer = Lookup.getDefault().lookup(DataContent.class); contentViewer = Lookup.getDefault().lookup(DataContent.class);
//property listener to send nodes to content viewer
nodeSelListener = new PropertyChangeListener() {
/**
* Propagates changes in the current select node from the
* DataResultViewer to the DataContentTopComponent
*/
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!Case.isCaseOpen()) {
//handle in-between condition when case is being closed
//and legacy selection events are pumped
return;
}
String changed = evt.getPropertyName();
// change that should affect view
if (changed.equals(ExplorerManager.PROP_SELECTED_NODES)) {
//|| changed.equals(ExplorerManager.PROP_NODE_CHANGE)
//|| changed.equals(ExplorerManager.PROP_EXPLORED_CONTEXT)
//|| changed.equals(ExplorerManager.PROP_ROOT_CONTEXT)) {
// change the cursor to "waiting cursor" for this operation
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
Node[] selectedNodes = getExplorerManager().getSelectedNodes();
if (selectedNodes.length == 1) {
nodeSelected(selectedNodes[0]);
// there's a new/changed node to display
// push the node to default "DataContent"
//TODO only the active viewer should be calling setNode
//not all of them, otherwise it results in multiple setNode() invocations
//alternative is to use a single instance of the event listener
//, per top component and not the tab perhaps
contentViewer.setNode(selectedNodes[0]);
} else {
// clear the node viewer
contentViewer.setNode(null);
}
} finally {
setCursor(null);
}
}
/*
else if (changed.equals(ExplorerManager.PROP_NODE_CHANGE) ) {
}
else if (changed.equals(ExplorerManager.PROP_EXPLORED_CONTEXT)) {
}
else if (changed.equals(ExplorerManager.PROP_ROOT_CONTEXT)) {
}
*/
}
};
em.addPropertyChangeListener(nodeSelListener);
} }
@Override @Override
public void clearComponent() { public void clearComponent() {
em.removePropertyChangeListener(nodeSelListener);
} }
@Deprecated
public Node getSelectedNode() { public Node getSelectedNode() {
Node result = null; Node result = null;
Node[] selectedNodes = this.getExplorerManager().getSelectedNodes(); Node[] selectedNodes = this.getExplorerManager().getSelectedNodes();
@ -147,14 +96,6 @@ public abstract class AbstractDataResultViewer extends JPanel implements DataRes
public void resetComponent() { public void resetComponent() {
} }
/**
* Called when a new node has been selected in the result viewer Can update
* the viewer, etc.
*
* @param selectedNode the new node currently selected
*/
public abstract void nodeSelected(Node selectedNode);
@Override @Override
public Component getComponent() { public Component getComponent() {
return this; return this;

View File

@ -18,7 +18,6 @@ import org.openide.nodes.Node;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.NbPreferences; import org.openide.util.NbPreferences;
import org.openide.windows.TopComponent;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContent; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContent;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -31,10 +30,10 @@ import org.sleuthkit.datamodel.TskCoreException;
public class DataContentPanel extends javax.swing.JPanel implements DataContent, ChangeListener { public class DataContentPanel extends javax.swing.JPanel implements DataContent, ChangeListener {
private static Logger logger = Logger.getLogger(DataContentPanel.class.getName()); private static Logger logger = Logger.getLogger(DataContentPanel.class.getName());
private final List<UpdateWrapper> viewers = new ArrayList<>();;
private final List<UpdateWrapper> viewers = new ArrayList<UpdateWrapper>();;
private Node currentNode; private Node currentNode;
private final boolean isMain; private final boolean isMain;
private boolean listeningToTabbedPane = false;
/** /**
* Creates new DataContentPanel panel * Creates new DataContentPanel panel
@ -69,8 +68,6 @@ public class DataContentPanel extends javax.swing.JPanel implements DataContent,
for (int tab = 0; tab < numTabs; ++tab) { for (int tab = 0; tab < numTabs; ++tab) {
jTabbedPane1.setEnabledAt(tab, false); jTabbedPane1.setEnabledAt(tab, false);
} }
jTabbedPane1.addChangeListener(this);
} }
@ -135,7 +132,7 @@ public class DataContentPanel extends javax.swing.JPanel implements DataContent,
try { try {
path = content.getUniquePath(); path = content.getUniquePath();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for " + content); logger.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for {0}", content);
} }
setName(path); setName(path);
} else { } else {
@ -158,6 +155,12 @@ public class DataContentPanel extends javax.swing.JPanel implements DataContent,
* @param selectedNode the selected content Node * @param selectedNode the selected content Node
*/ */
public void setupTabs(Node selectedNode) { public void setupTabs(Node selectedNode) {
// Deferring becoming a listener to the tabbed pane until this point
// eliminates handling a superfluous stateChanged event during construction.
if (listeningToTabbedPane == false) {
jTabbedPane1.addChangeListener(this);
listeningToTabbedPane = true;
}
// get the preference for the preferred viewer // get the preference for the preferred viewer
Preferences pref = NbPreferences.forModule(GeneralPanel.class); Preferences pref = NbPreferences.forModule(GeneralPanel.class);

View File

@ -66,6 +66,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
private final DummyNodeListener dummyNodeListener = new DummyNodeListener(); private final DummyNodeListener dummyNodeListener = new DummyNodeListener();
private static final Logger logger = Logger.getLogger(DataResultPanel.class.getName() ); private static final Logger logger = Logger.getLogger(DataResultPanel.class.getName() );
private boolean listeningToTabbedPane = false;
/** /**
* Creates new DataResultPanel * Creates new DataResultPanel
@ -80,8 +81,6 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
setName(title); setName(title);
this.title = ""; this.title = "";
this.dataResultTabbedPanel.addChangeListener(this);
} }
/** /**
@ -182,8 +181,22 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
* Do not use if used one of the factory methods to create and open the component. * Do not use if used one of the factory methods to create and open the component.
*/ */
public void open() { public void open() {
if (null == this.explorerManager) { if (null == explorerManager) {
this.explorerManager = ExplorerManager.find(this); // Get an ExplorerManager to pass to the child DataResultViewers. If the application
// components are put together as expected, this will be an ExplorerManager owned
// by an ancestor TopComponent. The TopComponent will have put this ExplorerManager
// in a Lookup that is set as the action global context when the TopComponent has
// focus. This makes Node selections available to Actions without coupling the
// actions to a particular Component. Note that getting the ExplorerManager in the
// constructor would be too soon, since the object has no ancestor TopComponent at
// that point.
explorerManager = ExplorerManager.find(this);
// A DataResultPanel listens for Node selections in its DataResultViewers so it
// can push the selections both to its child DataResultViewers and to a DataContent object.
// The default DataContent object is a DataContentTopComponent in the data content mode (area),
// and is the parent of a DataContentPanel that hosts a set of DataContentViewers.
explorerManager.addPropertyChangeListener(new ExplorerManagerNodeSelectionListener());
} }
// Add all the DataContentViewer to the tabbed pannel. // Add all the DataContentViewer to the tabbed pannel.
@ -225,6 +238,47 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
this.setVisible(true); this.setVisible(true);
} }
private class ExplorerManagerNodeSelectionListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!Case.isCaseOpen()) {
// Handle the in-between condition when case is being closed
// and legacy selection events are pumped.
return;
}
if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
// If a custom DataContent object has not been specified, get the default instance.
DataContent contentViewer = customContentViewer;
if (null == contentViewer) {
contentViewer = Lookup.getDefault().lookup(DataContent.class);
}
try {
Node[] selectedNodes = explorerManager.getSelectedNodes();
for (UpdateWrapper drv : viewers) {
drv.setSelectedNodes(selectedNodes);
}
// Passing null signals that either multiple nodes are selected, or no nodes are selected.
// This is important to the DataContent object, since the content mode (area) of the app is designed
// to show only the content underlying a single Node.
if (selectedNodes.length == 1) {
contentViewer.setNode(selectedNodes[0]);
}
else {
contentViewer.setNode(null);
}
}
finally {
setCursor(null);
}
}
}
}
private void addDataResultViewer(DataResultViewer dataResultViewer) { private void addDataResultViewer(DataResultViewer dataResultViewer) {
UpdateWrapper viewerWrapper = new UpdateWrapper(dataResultViewer); UpdateWrapper viewerWrapper = new UpdateWrapper(dataResultViewer);
if (null != this.customContentViewer) { if (null != this.customContentViewer) {
@ -294,6 +348,13 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
if (this.rootNode != null) { if (this.rootNode != null) {
this.rootNode.removeNodeListener(dummyNodeListener); this.rootNode.removeNodeListener(dummyNodeListener);
} }
// Deferring becoming a listener to the tabbed pane until this point
// eliminates handling a superfluous stateChanged event during construction.
if (listeningToTabbedPane == false) {
dataResultTabbedPanel.addChangeListener(this);
listeningToTabbedPane = true;
}
this.rootNode = selectedNode; this.rootNode = selectedNode;
if (this.rootNode != null) { if (this.rootNode != null) {
this.rootNode.addNodeListener(dummyNodeListener); this.rootNode.addNodeListener(dummyNodeListener);

View File

@ -108,10 +108,6 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
} }
} }
@Override
public void nodeSelected(Node selectedNode) {
}
/** /**
* This method is called from within the constructor to initialize the form. * 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

View File

@ -22,6 +22,7 @@ import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Arrays; import java.util.Arrays;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -86,6 +87,7 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
initComponents(); initComponents();
((IconView) thumbnailScrollPanel).setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); ((IconView) thumbnailScrollPanel).setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
em.addPropertyChangeListener(new ExplorerManagerNodeSelectionListener());
curPage = -1; curPage = -1;
totalPages = 0; totalPages = 0;
@ -324,32 +326,6 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
} }
} }
@Override
public void nodeSelected(Node selectedNode) {
if (selectedNode == null) {
filePathLabel.setText("");
}
else {
AbstractFile af = selectedNode.getLookup().lookup(AbstractFile.class);
if (af == null) {
filePathLabel.setText("");
}
else {
try {
String uPath = af.getUniquePath();
filePathLabel.setText(uPath);
filePathLabel.setToolTipText(uPath);
}
catch (TskCoreException e){
logger.log(Level.WARNING, "Could not get unique path for content: " + af.getName());
}
}
}
}
@Override @Override
public String getTitle() { public String getTitle() {
return "Thumbnail"; return "Thumbnail";
@ -556,4 +532,38 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
public void nodeDestroyed(NodeEvent ne) { public void nodeDestroyed(NodeEvent ne) {
} }
} }
private class ExplorerManagerNodeSelectionListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
Node[] selectedNodes = em.getSelectedNodes();
if (selectedNodes.length == 1) {
AbstractFile af = selectedNodes[0].getLookup().lookup(AbstractFile.class);
if (af == null) {
filePathLabel.setText("");
}
else {
try {
String uPath = af.getUniquePath();
filePathLabel.setText(uPath);
filePathLabel.setToolTipText(uPath);
}
catch (TskCoreException e){
logger.log(Level.WARNING, "Could not get unique path for content: {0}", af.getName());
}
}
}
else {
filePathLabel.setText("");
}
}
finally {
setCursor(null);
}
}
}
}
} }

View File

@ -80,7 +80,7 @@ import org.sleuthkit.autopsy.core.Installer;
}) })
public class FXVideoPanel extends MediaViewVideoPanel { public class FXVideoPanel extends MediaViewVideoPanel {
private static final String[] EXTENSIONS = new String[]{".swf", ".mov", ".m4v", ".flv", ".mp4", ".3gp", ".avi", ".mpg", ".mpeg", ".wmv"}; private static final String[] EXTENSIONS = new String[]{".mov", ".m4v", ".flv", ".mp4", ".mpg", ".mpeg"};
private static final Logger logger = Logger.getLogger(MediaViewVideoPanel.class.getName()); private static final Logger logger = Logger.getLogger(MediaViewVideoPanel.class.getName());
private boolean fxInited = false; private boolean fxInited = false;
// FX Components // FX Components
@ -400,8 +400,13 @@ public class FXVideoPanel extends MediaViewVideoPanel {
* @param mediaUri the URI of the media * @param mediaUri the URI of the media
*/ */
public void prepareMedia(String mediaUri) { public void prepareMedia(String mediaUri) {
try {
mediaPlayer = createMediaPlayer(mediaUri); mediaPlayer = createMediaPlayer(mediaUri);
mediaView.setMediaPlayer(mediaPlayer); mediaView.setMediaPlayer(mediaPlayer);
} catch (MediaException ex) {
this.setProgressLabelText("");
this.setInfoLabelText("Unsupported Format.");
}
} }
/** /**
@ -414,6 +419,7 @@ public class FXVideoPanel extends MediaViewVideoPanel {
mediaPlayer.stop(); mediaPlayer.stop();
} }
mediaPlayer = null; mediaPlayer = null;
mediaView.setMediaPlayer(null);
} }
resetProgress(); resetProgress();
} }