Autopsy  4.6.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.modules.stix;
20 
21 import java.io.File;
22 import javax.swing.JFileChooser;
24 
28 public class STIXReportModuleConfigPanel extends javax.swing.JPanel {
29 
30  String stixFile = null;
31  boolean showAllResults;
32 
38 
39  // Set the default path to the last one used
40  if ((ModuleSettings.getConfigSetting("STIX", "defaultPath") != null) //NON-NLS
41  && (!ModuleSettings.getConfigSetting("STIX", "defaultPath").isEmpty())) { //NON-NLS
42  jTextField1.setText(ModuleSettings.getConfigSetting("STIX", "defaultPath")); //NON-NLS
43  stixFile = ModuleSettings.getConfigSetting("STIX", "defaultPath"); //NON-NLS
44  }
45 
46  // Set the results checkbox to the last one used
47  if ((ModuleSettings.getConfigSetting("STIX", "showAllResults") != null) //NON-NLS
48  && (!ModuleSettings.getConfigSetting("STIX", "showAllResults").isEmpty())) { //NON-NLS
49 
50  if (ModuleSettings.getConfigSetting("STIX", "showAllResults").equals("true")) { //NON-NLS
51  jCheckBox1.setSelected(true);
52  showAllResults = true;
53  } else {
54  jCheckBox1.setSelected(false);
55  showAllResults = false;
56  }
57  } else {
58  showAllResults = false;
59  }
60  }
61 
62  public String getStixFile() {
63  return stixFile;
64  }
65 
66  public boolean getShowAllResults() {
67  return showAllResults;
68  }
69 
75  @SuppressWarnings("unchecked")
76  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
77  private void initComponents() {
78 
79  jLabel2 = new javax.swing.JLabel();
80  jTextField1 = new javax.swing.JTextField();
81  jButton1 = new javax.swing.JButton();
82  jCheckBox1 = new javax.swing.JCheckBox();
83 
84  jLabel2.setText(org.openide.util.NbBundle.getMessage(STIXReportModuleConfigPanel.class, "STIXReportModuleConfigPanel.jLabel2.text")); // NOI18N
85 
86  jTextField1.setText(org.openide.util.NbBundle.getMessage(STIXReportModuleConfigPanel.class, "STIXReportModuleConfigPanel.jTextField1.text")); // NOI18N
87  jTextField1.addActionListener(new java.awt.event.ActionListener() {
88  public void actionPerformed(java.awt.event.ActionEvent evt) {
90  }
91  });
92  jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
93  public void keyReleased(java.awt.event.KeyEvent evt) {
95  }
96  public void keyTyped(java.awt.event.KeyEvent evt) {
98  }
99  });
100 
101  jButton1.setText(org.openide.util.NbBundle.getMessage(STIXReportModuleConfigPanel.class, "STIXReportModuleConfigPanel.jButton1.text")); // NOI18N
102  jButton1.addActionListener(new java.awt.event.ActionListener() {
103  public void actionPerformed(java.awt.event.ActionEvent evt) {
105  }
106  });
107 
108  jCheckBox1.setText(org.openide.util.NbBundle.getMessage(STIXReportModuleConfigPanel.class, "STIXReportModuleConfigPanel.jCheckBox1.text")); // NOI18N
109  jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
110  public void actionPerformed(java.awt.event.ActionEvent evt) {
112  }
113  });
114 
115  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
116  this.setLayout(layout);
117  layout.setHorizontalGroup(
118  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
119  .addGroup(layout.createSequentialGroup()
120  .addContainerGap()
121  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
122  .addComponent(jLabel2)
123  .addGroup(layout.createSequentialGroup()
124  .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
125  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
126  .addComponent(jButton1))
127  .addComponent(jCheckBox1))
128  .addContainerGap(73, Short.MAX_VALUE))
129  );
130  layout.setVerticalGroup(
131  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
132  .addGroup(layout.createSequentialGroup()
133  .addContainerGap()
134  .addComponent(jLabel2)
135  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
136  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
137  .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
138  .addComponent(jButton1))
139  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
140  .addComponent(jCheckBox1)
141  .addContainerGap(225, Short.MAX_VALUE))
142  );
143  }// </editor-fold>//GEN-END:initComponents
144 
145  private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
146 
147  }//GEN-LAST:event_jTextField1ActionPerformed
148 
149  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
150 
151  JFileChooser fileChooser = new JFileChooser();
152  fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
153 
154  File currentSelection = new File(jTextField1.getText());
155  if (currentSelection.exists()) {
156  fileChooser.setCurrentDirectory(currentSelection);
157  }
158 
159  int result = fileChooser.showOpenDialog(this);
160 
161  if (result == JFileChooser.APPROVE_OPTION) {
162  stixFile = fileChooser.getSelectedFile().getAbsolutePath();
163  jTextField1.setText(stixFile);
164  }
165 
166  }//GEN-LAST:event_jButton1ActionPerformed
167 
168  private void jTextField1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyTyped
169 
170  }//GEN-LAST:event_jTextField1KeyTyped
171 
172  private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyReleased
173  stixFile = jTextField1.getText();
174  }//GEN-LAST:event_jTextField1KeyReleased
175 
176  private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
177  // TODO add your handling code here:
178  showAllResults = jCheckBox1.isSelected();
179  if (showAllResults) {
180  ModuleSettings.setConfigSetting("STIX", "showAllResults", "true"); //NON-NLS
181  } else {
182  ModuleSettings.setConfigSetting("STIX", "showAllResults", "false"); //NON-NLS
183  }
184  }//GEN-LAST:event_jCheckBox1ActionPerformed
185 
186  // Variables declaration - do not modify//GEN-BEGIN:variables
187  private javax.swing.JButton jButton1;
188  private javax.swing.JCheckBox jCheckBox1;
189  private javax.swing.JLabel jLabel2;
190  private javax.swing.JTextField jTextField1;
191  // End of variables declaration//GEN-END:variables
192 }
static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal)
static String getConfigSetting(String moduleName, String settingName)

Copyright © 2012-2016 Basis Technology. Generated on: Mon May 7 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.