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 = 80)})
51 public final class ReportWizardAction extends CallableSystemAction implements Presenter.Toolbar, ActionListener {
53 private final JButton toolbarButton =
new JButton();
54 private static final String ACTION_NAME = NbBundle.getMessage(
ReportWizardAction.class,
"ReportWizardAction.actionName.text");
61 @SuppressWarnings(
"unchecked")
62 public static
void doReportWizard() {
63 WizardDescriptor wiz =
new WizardDescriptor(
new ReportWizardIterator());
64 wiz.setTitleFormat(
new MessageFormat(
"{0} {1}"));
65 wiz.setTitle(NbBundle.getMessage(
ReportWizardAction.class,
"ReportWizardAction.reportWiz.title"));
66 if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
67 @SuppressWarnings(
"unchecked")
68 ReportGenerator generator =
new ReportGenerator((Map<TableReportModule, Boolean>) wiz.getProperty(
"tableModuleStates"),
69 (Map<GeneralReportModule, Boolean>) wiz.getProperty(
"generalModuleStates"),
70 (Map<FileReportModule, Boolean>) wiz.getProperty(
"fileModuleStates"));
71 generator.generateTableReports((Map<BlackboardArtifact.Type, Boolean>) wiz.getProperty(
"artifactStates"), (Map<String, Boolean>) wiz.getProperty(
"tagStates"));
72 generator.generateFileListReports((Map<FileReportDataTypes, Boolean>) wiz.getProperty(
"fileReportOptions"));
73 generator.generateGeneralReports();
74 generator.displayProgressPanels();
82 Case newCase = (
Case) evt.getNewValue();
92 @SuppressWarnings(
"unchecked")
93 public
void actionPerformed(ActionEvent e) {
108 return HelpCtx.DEFAULT_HELP;
118 ImageIcon icon =
new ImageIcon(getClass().getResource(
"images/btn_icon_generate_report.png"));
119 toolbarButton.setIcon(icon);
120 toolbarButton.setText(NbBundle.getMessage(
this.getClass(),
"ReportWizardAction.toolBarButton.text"));
121 return toolbarButton;
131 super.setEnabled(value);
132 toolbarButton.setEnabled(value);
void setEnabled(boolean value)
static boolean coreComponentsAreActive()
static synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Component getToolbarPresenter()