Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CommandLineIngestSettingsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019-2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.commandlineingest;
20 
21 import java.awt.BorderLayout;
22 import java.awt.Cursor;
23 import java.util.List;
24 import javax.swing.JOptionPane;
27 import org.openide.windows.WindowManager;
30 
34 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
35 public class CommandLineIngestSettingsPanel extends javax.swing.JPanel {
36 
37  private static final long serialVersionUID = 1L;
38  private static final Logger logger = Logger.getLogger(CommandLineIngestSettingsPanel.class.getName());
39 
40  private static final String REPORTING_CONFIGURATION_NAME = "CommandLineIngest";
41  private static final boolean DISPLAY_CASE_SPECIFIC_DATA = false; // do not try to display case specific data
42  private static final boolean RUN_REPORTS = false; // do not generate reports as part of running the report wizard
43 
50  initComponents();
51  }
52 
56  public static String getReportingConfigName() {
57  return REPORTING_CONFIGURATION_NAME;
58  }
59 
61  this.getParent().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
62 
64  showWarnings(ingestJobSettings);
65  IngestJobSettingsPanel ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings);
66 
67  add(ingestJobSettingsPanel, BorderLayout.PAGE_START);
68 
69  if (JOptionPane.showConfirmDialog(this, ingestJobSettingsPanel, "Ingest Module Configuration", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) {
70  // store the updated settings
71  ingestJobSettings = ingestJobSettingsPanel.getSettings();
72  ingestJobSettings.save();
73  showWarnings(ingestJobSettings);
74  }
75 
76  this.getParent().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
77  }
78 
79  private static void showWarnings(IngestJobSettings ingestJobSettings) {
80  List<String> warnings = ingestJobSettings.getWarnings();
81  if (warnings.isEmpty() == false) {
82  StringBuilder warningMessage = new StringBuilder();
83  for (String warning : warnings) {
84  warningMessage.append(warning).append("\n");
85  }
86  JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), warningMessage.toString());
87  }
88  }
89 
95  @SuppressWarnings("unchecked")
96  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
97  private void initComponents() {
98 
99  nodeScrollPane = new javax.swing.JScrollPane();
100  nodePanel = new javax.swing.JPanel();
101  bnEditIngestSettings = new javax.swing.JButton();
102  jLabelDescription = new javax.swing.JLabel();
103  bnEditReportSettings = new javax.swing.JButton();
104 
105  setPreferredSize(new java.awt.Dimension(810, 422));
106 
107  nodeScrollPane.setMinimumSize(new java.awt.Dimension(0, 0));
108  nodeScrollPane.setPreferredSize(new java.awt.Dimension(803, 553));
109 
110  nodePanel.setMinimumSize(new java.awt.Dimension(100, 100));
111  nodePanel.setPreferredSize(new java.awt.Dimension(801, 551));
112 
113  org.openide.awt.Mnemonics.setLocalizedText(bnEditIngestSettings, org.openide.util.NbBundle.getMessage(CommandLineIngestSettingsPanel.class, "CommandLineIngestSettingsPanel.bnEditIngestSettings.text")); // NOI18N
114  bnEditIngestSettings.setToolTipText(org.openide.util.NbBundle.getMessage(CommandLineIngestSettingsPanel.class, "CommandLineIngestSettingsPanel.bnEditIngestSettings.toolTipText")); // NOI18N
115  bnEditIngestSettings.setActionCommand(org.openide.util.NbBundle.getMessage(CommandLineIngestSettingsPanel.class, "CommandLineIngestSettingsPanel.bnEditIngestSettings.text")); // NOI18N
116  bnEditIngestSettings.addActionListener(new java.awt.event.ActionListener() {
117  public void actionPerformed(java.awt.event.ActionEvent evt) {
118  bnEditIngestSettingsActionPerformed(evt);
119  }
120  });
121 
122  org.openide.awt.Mnemonics.setLocalizedText(jLabelDescription, org.openide.util.NbBundle.getMessage(CommandLineIngestSettingsPanel.class, "CommandLineIngestSettingsPanel.jLabelDescription.text")); // NOI18N
123 
124  org.openide.awt.Mnemonics.setLocalizedText(bnEditReportSettings, org.openide.util.NbBundle.getMessage(CommandLineIngestSettingsPanel.class, "CommandLineIngestSettingsPanel.bnEditReportSettings.text")); // NOI18N
125  bnEditReportSettings.setToolTipText(org.openide.util.NbBundle.getMessage(CommandLineIngestSettingsPanel.class, "CommandLineIngestSettingsPanel.bnEditReportSettings.toolTipText")); // NOI18N
126  bnEditReportSettings.setActionCommand(org.openide.util.NbBundle.getMessage(CommandLineIngestSettingsPanel.class, "CommandLineIngestSettingsPanel.bnEditReportSettings.actionCommand")); // NOI18N
127  bnEditReportSettings.addActionListener(new java.awt.event.ActionListener() {
128  public void actionPerformed(java.awt.event.ActionEvent evt) {
129  bnEditReportSettingsActionPerformed(evt);
130  }
131  });
132 
133  javax.swing.GroupLayout nodePanelLayout = new javax.swing.GroupLayout(nodePanel);
134  nodePanel.setLayout(nodePanelLayout);
135  nodePanelLayout.setHorizontalGroup(
136  nodePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
137  .addGroup(nodePanelLayout.createSequentialGroup()
138  .addContainerGap()
139  .addGroup(nodePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
140  .addComponent(bnEditIngestSettings, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
141  .addComponent(jLabelDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
142  .addComponent(bnEditReportSettings, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE))
143  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
144  );
145  nodePanelLayout.setVerticalGroup(
146  nodePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
147  .addGroup(nodePanelLayout.createSequentialGroup()
148  .addGap(27, 27, 27)
149  .addComponent(jLabelDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
150  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
151  .addComponent(bnEditIngestSettings)
152  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
153  .addComponent(bnEditReportSettings)
154  .addContainerGap(381, Short.MAX_VALUE))
155  );
156 
157  nodeScrollPane.setViewportView(nodePanel);
158 
159  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
160  this.setLayout(layout);
161  layout.setHorizontalGroup(
162  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
163  .addComponent(nodeScrollPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
164  );
165  layout.setVerticalGroup(
166  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
167  .addComponent(nodeScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
168  );
169  }// </editor-fold>//GEN-END:initComponents
170 
171  private void bnEditReportSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnEditReportSettingsActionPerformed
172  this.getParent().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
173  doReportWizard(getReportingConfigName(), DISPLAY_CASE_SPECIFIC_DATA, RUN_REPORTS);
174  this.getParent().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
175  }//GEN-LAST:event_bnEditReportSettingsActionPerformed
176 
177  private void bnEditIngestSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnEditIngestSettingsActionPerformed
178  displayIngestJobSettingsPanel();
179  }//GEN-LAST:event_bnEditIngestSettingsActionPerformed
180 
181  // Variables declaration - do not modify//GEN-BEGIN:variables
182  private javax.swing.JButton bnEditIngestSettings;
183  private javax.swing.JButton bnEditReportSettings;
184  private javax.swing.JLabel jLabelDescription;
185  private javax.swing.JPanel nodePanel;
186  private javax.swing.JScrollPane nodeScrollPane;
187  // End of variables declaration//GEN-END:variables
188 }
static void doReportWizard(String configName, boolean displayCaseSpecificData, boolean runReports)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124
CommandLineIngestSettingsPanel(CommandLineIngestSettingsPanelController theController)

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.