From 7a23eedfaaf033205d09bbbe5d4769d4e81cd530 Mon Sep 17 00:00:00 2001 From: Alex Ebadirad Date: Tue, 15 May 2012 03:38:46 -0700 Subject: [PATCH] Changed how progress bar works. --- .../autopsy/report/ReportAction.java | 2 +- .../sleuthkit/autopsy/report/ReportHTML.java | 7 ++----- .../autopsy/report/ReportModule.java | 2 +- .../autopsy/report/ReportPanelAction.java | 19 ++++++++++--------- .../sleuthkit/autopsy/report/ReportXLS.java | 6 +----- .../sleuthkit/autopsy/report/ReportXML.java | 5 ++--- 6 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportAction.java b/Report/src/org/sleuthkit/autopsy/report/ReportAction.java index e8142cc9c1..6e148c83eb 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportAction.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportAction.java @@ -104,7 +104,7 @@ public final class ReportAction extends CallableSystemAction implements Presente @Override public void actionPerformed(ActionEvent e) { - ReportPanel.this.actionPerformed(e); + ReportAction.this.actionPerformed(e); } }); diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportHTML.java b/Report/src/org/sleuthkit/autopsy/report/ReportHTML.java index 0a456945cc..8d7b606ca1 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportHTML.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportHTML.java @@ -67,7 +67,7 @@ public class ReportHTML implements ReportModule{ } @Override - public String generateReport(ReportConfiguration reportconfig, ReportFilter rr) throws ReportModuleException { + public String generateReport(ReportConfiguration reportconfig) throws ReportModuleException { config = reportconfig; ReportGen reportobj = new ReportGen(); reportobj.populateReport(reportconfig); @@ -239,7 +239,6 @@ public class ReportHTML implements ReportModule{ if (ReportFilter.cancel == true) { break; } - int cc = 0; if (alt > 0) { altRow = " class=\"alt\""; @@ -286,7 +285,7 @@ public class ReportHTML implements ReportModule{ } value = ReportUtils.insertPeriodically(value, "
", 30); attributes.put(type, value); - cc++; + } @@ -370,8 +369,6 @@ public class ReportHTML implements ReportModule{ artifact.append(""); nodeDevice.append(artifact); } - cc++; - rr.progBarSet(cc); } //Add them back in order //formatted_Report.append(nodeGen); diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportModule.java b/Report/src/org/sleuthkit/autopsy/report/ReportModule.java index a20a7dd810..7178888ee0 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportModule.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportModule.java @@ -32,7 +32,7 @@ public interface ReportModule { * @return absolute file path to the report generated * @throws ReportModuleException if report generation failed */ - public String generateReport(ReportConfiguration config, ReportFilter rr) throws ReportModuleException; + public String generateReport(ReportConfiguration config) throws ReportModuleException; /** * This saves a copy of the report (current one) to another place specified diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportPanelAction.java b/Report/src/org/sleuthkit/autopsy/report/ReportPanelAction.java index 7feedfd07d..2ac1aa5844 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportPanelAction.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportPanelAction.java @@ -41,7 +41,7 @@ public class ReportPanelAction { private static final String ACTION_NAME = "Report Preview"; private StringBuilder viewReport = new StringBuilder(); - + private int cc = 0; public ReportPanelAction() { } @@ -62,12 +62,11 @@ public class ReportPanelAction { rr.progBarStartText(); } }); - report.populateReport(reportconfig); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - rr.progBarCount(2 * report.Results.size()); + rr.progBarCount(classList.size()); } }); //Turn our results into the appropriate xml/html reports @@ -78,13 +77,13 @@ public class ReportPanelAction { public void run() { for (String s : classList) { - + cc++; try { Class reportclass = Class.forName(s); Object reportObject = reportclass.newInstance(); - Class[] argTypes = new Class[] { ReportConfiguration.class, ReportFilter.class}; + Class[] argTypes = new Class[] { ReportConfiguration.class}; Method generatereport = reportclass.getDeclaredMethod("generateReport",argTypes); - Object invoke = generatereport.invoke(reportObject,reportconfig,rr); + Object invoke = generatereport.invoke(reportObject,reportconfig); String path = invoke.toString(); Class[] argTypes2 = new Class[] { String.class}; Method getpreview = reportclass.getMethod("getPreview",argTypes2); @@ -94,10 +93,11 @@ public class ReportPanelAction { { getpreview.invoke(reportObject,path); } - + } catch (Exception e) { } + rr.progBarSet(cc); } // StopWatch a = new StopWatch(); @@ -151,7 +151,7 @@ public class ReportPanelAction { // initialize panel with loaded settings //Set the temporary label to let the user know its done and is waiting on the report - rr.progBarText(); + final ReportPanel panel = new ReportPanel(); @@ -173,7 +173,8 @@ public class ReportPanelAction { double h = popUpWindow.getSize().getHeight(); popUpWindow.setLocation((int) ((screenDimension.getWidth() - w) / 2), (int) ((screenDimension.getHeight() - h) / 2)); - reportThread.join(); + reportThread.join(); + rr.progBarText(); rr.progBarDone(); panel.setFinishedReportText(); popUpWindow.setVisible(true); diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportXLS.java b/Report/src/org/sleuthkit/autopsy/report/ReportXLS.java index 894a17d68c..94a72b0454 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportXLS.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportXLS.java @@ -62,7 +62,7 @@ public class ReportXLS implements ReportModule { } @Override - public String generateReport(ReportConfiguration reportconfig, ReportFilter rr) throws ReportModuleException { + public String generateReport(ReportConfiguration reportconfig) throws ReportModuleException { config = reportconfig; ReportGen reportobj = new ReportGen(); reportobj.populateReport(reportconfig); @@ -386,10 +386,6 @@ public class ReportXLS implements ReportModule { temp.createCell(1).setCellValue(attributes.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_ID.getTypeID())); temp.createCell(2).setCellValue(attributes.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID())); } - - - cc++; - rr.progBarSet(cc); } diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportXML.java b/Report/src/org/sleuthkit/autopsy/report/ReportXML.java index 7858100fde..8f50db617b 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportXML.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportXML.java @@ -59,7 +59,7 @@ public class ReportXML implements ReportModule { } @Override - public String generateReport(ReportConfiguration reportconfig, ReportFilter rr) throws ReportModuleException { + public String generateReport(ReportConfiguration reportconfig) throws ReportModuleException { ReportGen reportobj = new ReportGen(); reportobj.populateReport(reportconfig); HashMap> report = reportobj.Results; @@ -177,8 +177,7 @@ public class ReportXML implements ReportModule { if (entry.getKey().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()) { nodeDevice.addContent(artifact); } - cc++; - rr.progBarSet(cc); + //end of master loop }