mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
Got rid of reporting Open After Creation check boxes
Added Open Folder button to ReportPanel
This commit is contained in:
@@ -17,3 +17,4 @@ ReportPanel.exportButton.text=Save As...
|
||||
ReportPanel.closeButton.text_1=Close
|
||||
ReportPanel.reportScrollPane.border.title=Report Summary
|
||||
ReportPanel.LABEL_LOC.text=Location
|
||||
ReportPanel.ButtonOpenFolder.text_1=Open Folder
|
||||
|
||||
@@ -199,7 +199,6 @@ public final class ReportAction extends CallableSystemAction implements Presente
|
||||
});
|
||||
final reportListener listener = new reportListener();
|
||||
final configListener clistener = new configListener();
|
||||
final previewListener plistener = new previewListener();
|
||||
preview = new ArrayList<String>();
|
||||
reportList.clear();
|
||||
config = new ReportConfiguration();
|
||||
@@ -217,10 +216,6 @@ public final class ReportAction extends CallableSystemAction implements Presente
|
||||
filterpanel.setAlignmentY(Component.TOP_ALIGNMENT);
|
||||
filterpanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
filterpanel.setSize(300, 200);
|
||||
//filterpanel.add(new JLabel("Report Format"), 0);
|
||||
//filterpanel.add(new JLabel("Open After Creation"), 1);
|
||||
//filterpanel.add(new JLabel("hello"));
|
||||
int currentPos = 0;
|
||||
|
||||
for (ReportModule m : Lookup.getDefault().lookupAll(ReportModule.class)) {
|
||||
String name = m.getName();
|
||||
@@ -231,14 +226,9 @@ public final class ReportAction extends CallableSystemAction implements Presente
|
||||
ch.setName(m.getClass().getName());
|
||||
ch.setToolTipText(desc);
|
||||
ch.setSelected(true);
|
||||
|
||||
JCheckBox cb = new JCheckBox("Open After Creation");
|
||||
cb.setName(m.getClass().getName() + "oac");
|
||||
cb.addItemListener(plistener);
|
||||
filterpanel.add(cb, currentPos);
|
||||
ch.addItemListener(listener);
|
||||
reportList.add(ch);
|
||||
filterpanel.add(ch, currentPos);
|
||||
filterpanel.add(ch, 0);
|
||||
}
|
||||
Border artborder = BorderFactory.createTitledBorder("Report Data");
|
||||
artpanel.setBorder(artborder);
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="exportButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="ButtonOpenFolder" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="closeButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="statusLabel" alignment="1" max="32767" attributes="0"/>
|
||||
@@ -37,18 +39,17 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="reportScrollPane" max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="reportScrollPane" pref="237" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="statusLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="closeButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="exportButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="LABEL_LOC" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="LABEL_LOC" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="closeButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="exportButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="ButtonOpenFolder" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -115,5 +116,15 @@
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="ButtonOpenFolder">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportPanel.ButtonOpenFolder.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ButtonOpenFolderActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.report;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
@@ -34,6 +35,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
@@ -72,6 +74,7 @@ public class ReportPanel extends javax.swing.JPanel {
|
||||
exportButton = new javax.swing.JButton();
|
||||
statusLabel = new javax.swing.JLabel();
|
||||
LABEL_LOC = new javax.swing.JLabel();
|
||||
ButtonOpenFolder = new javax.swing.JButton();
|
||||
|
||||
reportScrollPane.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.reportScrollPane.border.title"))); // NOI18N
|
||||
|
||||
@@ -101,6 +104,13 @@ public class ReportPanel extends javax.swing.JPanel {
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(LABEL_LOC, org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.LABEL_LOC.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(ButtonOpenFolder, org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.ButtonOpenFolder.text_1")); // NOI18N
|
||||
ButtonOpenFolder.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
ButtonOpenFolderActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -114,6 +124,8 @@ public class ReportPanel extends javax.swing.JPanel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(exportButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(ButtonOpenFolder)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(closeButton))
|
||||
.addComponent(statusLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
@@ -122,16 +134,16 @@ public class ReportPanel extends javax.swing.JPanel {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(reportScrollPane)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(reportScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(statusLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(closeButton)
|
||||
.addComponent(exportButton))
|
||||
.addComponent(LABEL_LOC))
|
||||
.addContainerGap())
|
||||
.addGap(11, 11, 11)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(LABEL_LOC)
|
||||
.addComponent(closeButton)
|
||||
.addComponent(exportButton)
|
||||
.addComponent(ButtonOpenFolder))
|
||||
.addGap(8, 8, 8))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
@@ -140,10 +152,22 @@ public class ReportPanel extends javax.swing.JPanel {
|
||||
exportReportAction(reports);
|
||||
}//GEN-LAST:event_exportButtonActionPerformed
|
||||
|
||||
private void ButtonOpenFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonOpenFolderActionPerformed
|
||||
String path = Case.getCurrentCase().getCaseDirectory() + File.separator + "Reports";
|
||||
File dir = new File(path);
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
try {
|
||||
Desktop.getDesktop().open(dir);
|
||||
} catch (IOException ioe) {
|
||||
logger.log(Level.WARNING, "Could not open folder [" + path + "]", ioe);
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_ButtonOpenFolderActionPerformed
|
||||
|
||||
public void setCloseButtonActionListener(ActionListener e) {
|
||||
closeButton.addActionListener(e);
|
||||
}
|
||||
|
||||
|
||||
public void setFinishedReportText() {
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||
String reportText = "These reports were generated on " + dateFormat.format(new Date()) + ".";
|
||||
@@ -196,9 +220,6 @@ public class ReportPanel extends javax.swing.JPanel {
|
||||
c.gridx = 0;
|
||||
c.gridy = ++cc;
|
||||
c.insets = new Insets(0, 0, 15, 0); // row padding
|
||||
JLabel pathLabel = new JLabel(path);
|
||||
//tempPanel.add(pathLabel, c);
|
||||
|
||||
tempPanel.revalidate();
|
||||
tempPanel.repaint();
|
||||
cc++;
|
||||
@@ -240,6 +261,7 @@ public class ReportPanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton ButtonOpenFolder;
|
||||
private javax.swing.JLabel LABEL_LOC;
|
||||
private javax.swing.JButton closeButton;
|
||||
private javax.swing.JButton exportButton;
|
||||
|
||||
@@ -93,14 +93,7 @@ public class ReportPanelAction {
|
||||
Object invoke = generatereport.invoke(reportObject, reportconfig);
|
||||
rr.progBarSet(cc);
|
||||
String path = invoke.toString();
|
||||
Class[] argTypes2 = new Class[]{String.class};
|
||||
Method getpreview = reportclass.getMethod("getPreview", argTypes2);
|
||||
reports.put((ReportModule) reportObject, path);
|
||||
for (String prev : preview) {
|
||||
if (s == null ? preview == null : s.equals(prev)) {
|
||||
getpreview.invoke(reportObject, path);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(ReportFilterAction.class.getName()).log(Level.WARNING, "Error generating " + s + "! Reason: ", e);
|
||||
|
||||
Reference in New Issue
Block a user