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 @SuppressWarnings(
"unchecked")
69 ReportGenerator generator =
new ReportGenerator();
70 TableReportModule tableReport = (TableReportModule) wiz.getProperty(
"tableModule");
72 FileReportModule fileReport = (FileReportModule) wiz.getProperty(
"fileModule");
73 if (tableReport != null) {
74 generator.generateTableReport(tableReport, (Map<BlackboardArtifact.Type, Boolean>) wiz.getProperty(
"artifactStates"), (Map<String, Boolean>) wiz.getProperty(
"tagStates"));
75 }
else if (generalReport != null) {
76 generator.generateGeneralReport(generalReport);
77 }
else if (fileReport != null) {
78 generator.generateFileListReport(fileReport, (Map<FileReportDataTypes, Boolean>) wiz.getProperty(
"fileReportOptions"));
87 Case newCase = (
Case) evt.getNewValue();
97 @SuppressWarnings(
"unchecked")
98 public
void actionPerformed(ActionEvent e) {
113 return HelpCtx.DEFAULT_HELP;
123 ImageIcon icon =
new ImageIcon(getClass().getResource(
"images/btn_icon_generate_report.png"));
124 toolbarButton.setIcon(icon);
125 toolbarButton.setText(NbBundle.getMessage(
this.getClass(),
"ReportWizardAction.toolBarButton.text"));
126 return toolbarButton;
136 super.setEnabled(value);
137 toolbarButton.setEnabled(value);
void setEnabled(boolean value)
static boolean coreComponentsAreActive()
static void addPropertyChangeListener(PropertyChangeListener listener)
Component getToolbarPresenter()