Autopsy  4.17.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
STIXReportModuleConfigPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-2018 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.report.modules.stix;
20 
21 import java.io.File;
22 import javax.swing.JFileChooser;
23 
27 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
28 public class STIXReportModuleConfigPanel extends javax.swing.JPanel {
29 
30  String stixFile = null;
31  boolean showAllResults;
32 
37  initComponents();
38  showAllResults = false;
39  jCheckBox1.setSelected(false);
40  }
41 
42  void setConfiguration(STIXReportModuleSettings settings) {
43  jStixFileTextField.setText(settings.getStixFile());
44  showAllResults = settings.isShowAllResults();
45  jCheckBox1.setSelected(settings.isShowAllResults());
46  }
47 
48  STIXReportModuleSettings getConfiguration() {
49  return new STIXReportModuleSettings(jStixFileTextField.getText(), jCheckBox1.isSelected());
50  }
51 
52  String getStixFile() {
53  return stixFile;
54  }
55 
56  boolean getShowAllResults() {
57  return showAllResults;
58  }
59 
65  @SuppressWarnings("unchecked")
66  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
67  private void initComponents() {
68 
69  jLabel2 = new javax.swing.JLabel();
70  jStixFileTextField = new javax.swing.JTextField();
71  jButton1 = new javax.swing.JButton();
72  jCheckBox1 = new javax.swing.JCheckBox();
73 
74  jLabel2.setText(org.openide.util.NbBundle.getMessage(STIXReportModuleConfigPanel.class, "STIXReportModuleConfigPanel.jLabel2.text")); // NOI18N
75 
76  jStixFileTextField.setText(org.openide.util.NbBundle.getMessage(STIXReportModuleConfigPanel.class, "STIXReportModuleConfigPanel.jStixFileTextField.text")); // NOI18N
77  jStixFileTextField.addActionListener(new java.awt.event.ActionListener() {
78  public void actionPerformed(java.awt.event.ActionEvent evt) {
79  jStixFileTextFieldActionPerformed(evt);
80  }
81  });
82  jStixFileTextField.addKeyListener(new java.awt.event.KeyAdapter() {
83  public void keyReleased(java.awt.event.KeyEvent evt) {
84  jStixFileTextFieldKeyReleased(evt);
85  }
86  public void keyTyped(java.awt.event.KeyEvent evt) {
87  jStixFileTextFieldKeyTyped(evt);
88  }
89  });
90 
91  jButton1.setText(org.openide.util.NbBundle.getMessage(STIXReportModuleConfigPanel.class, "STIXReportModuleConfigPanel.jButton1.text")); // NOI18N
92  jButton1.addActionListener(new java.awt.event.ActionListener() {
93  public void actionPerformed(java.awt.event.ActionEvent evt) {
94  jButton1ActionPerformed(evt);
95  }
96  });
97 
98  jCheckBox1.setText(org.openide.util.NbBundle.getMessage(STIXReportModuleConfigPanel.class, "STIXReportModuleConfigPanel.jCheckBox1.text")); // NOI18N
99  jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
100  public void actionPerformed(java.awt.event.ActionEvent evt) {
101  jCheckBox1ActionPerformed(evt);
102  }
103  });
104 
105  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
106  this.setLayout(layout);
107  layout.setHorizontalGroup(
108  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
109  .addGroup(layout.createSequentialGroup()
110  .addContainerGap()
111  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
112  .addComponent(jLabel2)
113  .addGroup(layout.createSequentialGroup()
114  .addComponent(jStixFileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
115  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
116  .addComponent(jButton1))
117  .addComponent(jCheckBox1))
118  .addContainerGap(73, Short.MAX_VALUE))
119  );
120  layout.setVerticalGroup(
121  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
122  .addGroup(layout.createSequentialGroup()
123  .addContainerGap()
124  .addComponent(jLabel2)
125  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
126  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
127  .addComponent(jStixFileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
128  .addComponent(jButton1))
129  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
130  .addComponent(jCheckBox1)
131  .addContainerGap(225, Short.MAX_VALUE))
132  );
133  }// </editor-fold>//GEN-END:initComponents
134 
135  private void jStixFileTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jStixFileTextFieldActionPerformed
136 
137  }//GEN-LAST:event_jStixFileTextFieldActionPerformed
138 
139  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
140 
141  JFileChooser fileChooser = new JFileChooser();
142  fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
143 
144  File currentSelection = new File(jStixFileTextField.getText());
145  if (currentSelection.exists()) {
146  fileChooser.setCurrentDirectory(currentSelection);
147  }
148 
149  int result = fileChooser.showOpenDialog(this);
150 
151  if (result == JFileChooser.APPROVE_OPTION) {
152  stixFile = fileChooser.getSelectedFile().getAbsolutePath();
153  jStixFileTextField.setText(stixFile);
154  }
155 
156  }//GEN-LAST:event_jButton1ActionPerformed
157 
158  private void jStixFileTextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jStixFileTextFieldKeyTyped
159 
160  }//GEN-LAST:event_jStixFileTextFieldKeyTyped
161 
162  private void jStixFileTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jStixFileTextFieldKeyReleased
163  stixFile = jStixFileTextField.getText();
164  }//GEN-LAST:event_jStixFileTextFieldKeyReleased
165 
166  private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
167  showAllResults = jCheckBox1.isSelected();
168  }//GEN-LAST:event_jCheckBox1ActionPerformed
169 
170  // Variables declaration - do not modify//GEN-BEGIN:variables
171  private javax.swing.JButton jButton1;
172  private javax.swing.JCheckBox jCheckBox1;
173  private javax.swing.JLabel jLabel2;
174  private javax.swing.JTextField jStixFileTextField;
175  // End of variables declaration//GEN-END:variables
176 }

Copyright © 2012-2021 Basis Technology. Generated on: Tue Jan 19 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.