From 1cbf3b7a686164ba3db84ce41413e748300e7b80 Mon Sep 17 00:00:00 2001
From: adam-m <amalinowski@basistech.com>
Date: Mon, 30 Jan 2012 10:04:38 -0500
Subject: [PATCH] - move out gui code from ingest manager - when cancelled,
 don't display report and reset the explorer progress bar

---
 .../autopsy/ingest/IngestManager.java         | 15 ++++---
 .../autopsy/ingest/IngestMessage.java         |  1 -
 .../autopsy/ingest/IngestTopComponent.form    | 41 ++++++++-----------
 .../autopsy/ingest/IngestTopComponent.java    |  8 +++-
 4 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestManager.java b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestManager.java
index bcec5bc150..2f3417721d 100644
--- a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestManager.java
+++ b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestManager.java
@@ -33,7 +33,6 @@
 import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import javax.swing.JOptionPane;
 import javax.swing.SwingUtilities;
 import javax.swing.SwingWorker;
 import org.netbeans.api.progress.ProgressHandle;
@@ -692,13 +691,10 @@ protected void done() {
                 stats.end();
                 progress.finish();
 
-                logger.log(Level.INFO, "Summary Report: " + stats.toString());
-                //postMessage(IngestMessage.createManagerMessage(stats.toHtmlString()));
-                JOptionPane.showMessageDialog(
-                        null,
-                        stats.toHtmlString(),
-                        "Ingest Summary",
-                        JOptionPane.INFORMATION_MESSAGE);
+                if (! this.isCancelled()) {
+                    logger.log(Level.INFO, "Summary Report: " + stats.toString());
+                    tc.displayReport(stats.toHtmlString());
+                }
             }
 
         }
@@ -719,6 +715,9 @@ private void handleInterruption() {
             //empty queues
             emptyFsContents();
             emptyImages();
+            
+            //reset main progress bar
+            initMainProgress(0);
         }
     }
 
diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessage.java b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessage.java
index de70542432..abce9b0fbf 100644
--- a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessage.java
+++ b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessage.java
@@ -20,7 +20,6 @@
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import javax.swing.text.DateFormatter;
 import org.sleuthkit.autopsy.datamodel.KeyValueThing;
 
 /**
diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.form b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.form
index 37b22b9920..f09fc077f3 100644
--- a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.form
+++ b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.form
@@ -119,38 +119,29 @@
                 <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="0" attributes="0">
-                                  <Component id="topLable" min="-2" max="-2" attributes="1"/>
-                                  <EmptySpace pref="198" max="32767" attributes="0"/>
-                              </Group>
-                              <Group type="102" alignment="0" attributes="0">
-                                  <Component id="servicesPanel" min="-2" max="-2" attributes="1"/>
-                                  <EmptySpace min="-2" pref="115" max="-2" attributes="0"/>
+                              <Group type="102" attributes="0">
+                                  <EmptySpace max="-2" attributes="0"/>
+                                  <Group type="103" groupAlignment="0" attributes="0">
+                                      <Component id="topLable" alignment="0" min="-2" max="-2" attributes="1"/>
+                                      <Component id="servicesPanel" alignment="0" min="-2" max="-2" attributes="1"/>
+                                      <Component id="startButton" alignment="0" min="-2" max="-2" attributes="0"/>
+                                      <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
+                                          <Component id="mainProgressBar" alignment="0" max="32767" attributes="1"/>
+                                          <Component id="freqSlider" alignment="0" max="32767" attributes="1"/>
+                                      </Group>
+                                  </Group>
                               </Group>
                               <Group type="102" alignment="0" attributes="0">
-                                  <Component id="startButton" min="-2" max="-2" attributes="0"/>
-                                  <EmptySpace pref="258" max="32767" attributes="0"/>
+                                  <EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
+                                  <Component id="refreshFrequencyLabel" min="-2" max="-2" attributes="0"/>
                               </Group>
                               <Group type="102" alignment="0" attributes="0">
-                                  <Group type="103" groupAlignment="1" max="-2" attributes="0">
-                                      <Component id="mainProgressBar" alignment="0" max="32767" attributes="1"/>
-                                      <Component id="freqSlider" alignment="0" max="32767" attributes="1"/>
-                                  </Group>
-                                  <EmptySpace pref="115" max="32767" attributes="0"/>
+                                  <EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
+                                  <Component id="ingestProgressLabel" min="-2" max="-2" attributes="0"/>
                               </Group>
                           </Group>
-                      </Group>
-                      <Group type="102" alignment="0" attributes="0">
-                          <EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
-                          <Component id="refreshFrequencyLabel" min="-2" max="-2" attributes="0"/>
-                          <EmptySpace pref="174" max="32767" attributes="0"/>
-                      </Group>
-                      <Group type="102" alignment="0" attributes="0">
-                          <EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
-                          <Component id="ingestProgressLabel" min="-2" max="-2" attributes="0"/>
-                          <EmptySpace pref="171" max="32767" attributes="0"/>
+                          <EmptySpace pref="115" max="32767" attributes="0"/>
                       </Group>
                       <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
                           <Group type="102" alignment="0" attributes="0">
diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.java b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.java
index 31706dd9ca..0711b33bca 100644
--- a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.java
+++ b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.java
@@ -34,6 +34,7 @@
 import java.util.logging.Logger;
 import javax.swing.BoxLayout;
 import javax.swing.JCheckBox;
+import javax.swing.JOptionPane;
 import javax.swing.JScrollPane;
 import javax.swing.JSlider;
 import org.openide.util.NbBundle;
@@ -435,8 +436,11 @@ void readProperties(java.util.Properties p) {
      * Display ingest summary report in some dialog
      */
     void displayReport(String ingestReport) {
-        //TODO widget
-        logger.log(Level.INFO, "INGEST REPORT: " + ingestReport);
+        JOptionPane.showMessageDialog(
+                        null,
+                        ingestReport,
+                        "Ingest Summary",
+                        JOptionPane.INFORMATION_MESSAGE);
     }
 
     /**
-- 
GitLab