23 package org.sleuthkit.autopsy.report;
 
   25 import java.awt.Component;
 
   26 import java.awt.event.ActionEvent;
 
   27 import java.awt.event.ActionListener;
 
   28 import java.beans.PropertyChangeEvent;
 
   29 import java.text.MessageFormat;
 
   31 import javax.swing.ImageIcon;
 
   32 import javax.swing.JButton;
 
   33 import org.openide.DialogDisplayer;
 
   34 import org.openide.WizardDescriptor;
 
   35 import org.openide.awt.ActionID;
 
   36 import org.openide.awt.ActionReference;
 
   37 import org.openide.awt.ActionReferences;
 
   38 import org.openide.awt.ActionRegistration;
 
   39 import org.openide.util.HelpCtx;
 
   40 import org.openide.util.NbBundle;
 
   41 import org.openide.util.actions.CallableSystemAction;
 
   42 import org.openide.util.actions.Presenter;
 
   47 @ActionID(category = 
"Tools", 
id = 
"org.sleuthkit.autopsy.report.ReportWizardAction")
 
   48 @ActionRegistration(displayName = 
"#CTL_ReportWizardAction", lazy = 
false)
 
   49 @ActionReferences(value = {
 
   50     @ActionReference(path = 
"Menu/Tools", position = 103),
 
   51     @ActionReference(path = 
"Toolbars/Case", position = 103)})
 
   52 public final class ReportWizardAction extends CallableSystemAction implements Presenter.Toolbar, ActionListener {
 
   54     private final JButton toolbarButton = 
new JButton();
 
   55     private static final String ACTION_NAME = NbBundle.getMessage(
ReportWizardAction.class, 
"ReportWizardAction.actionName.text");
 
   62     @SuppressWarnings(
"unchecked")
 
   63     public static 
void doReportWizard() {
 
   64         WizardDescriptor wiz = 
new WizardDescriptor(
new ReportWizardIterator());
 
   65         wiz.setTitleFormat(
new MessageFormat(
"{0} {1}"));
 
   66         wiz.setTitle(NbBundle.getMessage(
ReportWizardAction.class, 
"ReportWizardAction.reportWiz.title"));
 
   67         if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
 
   68             ReportGenerator generator = 
new ReportGenerator(); 
 
   69             TableReportModule tableReport = (TableReportModule) wiz.getProperty(
"tableModule");
 
   71             FileReportModule fileReport = (FileReportModule) wiz.getProperty(
"fileModule");
 
   72             if (tableReport != null) {
 
   73                 generator.generateTableReport(tableReport, (Map<BlackboardArtifact.Type, Boolean>) wiz.getProperty(
"artifactStates"), (Map<String, Boolean>) wiz.getProperty(
"tagStates")); 
 
   74             } 
else if (generalReport != null) {
 
   75                 generator.generateGeneralReport(generalReport);
 
   76             } 
else if (fileReport != null) {
 
   77                 generator.generateFileListReport(fileReport, (Map<FileReportDataTypes, Boolean>) wiz.getProperty(
"fileReportOptions")); 
 
   86                 Case newCase = (
Case) evt.getNewValue();
 
   96     @SuppressWarnings(
"unchecked")
 
   97     public 
void actionPerformed(ActionEvent e) {
 
  112         return HelpCtx.DEFAULT_HELP;
 
  122         ImageIcon icon = 
new ImageIcon(getClass().getResource(
"images/btn_icon_generate_report.png")); 
 
  123         toolbarButton.setIcon(icon);
 
  124         toolbarButton.setText(NbBundle.getMessage(
this.getClass(), 
"ReportWizardAction.toolBarButton.text"));
 
  125         return toolbarButton;
 
  135         super.setEnabled(value);
 
  136         toolbarButton.setEnabled(value);
 
static boolean runningWithGUI
 
void setEnabled(boolean value)
 
static void addPropertyChangeListener(PropertyChangeListener listener)
 
Component getToolbarPresenter()