Autopsy  4.4
Graphical digital forensics platform for The Sleuth Kit and other tools.
AutopsyOptionsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2017 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.corecomponents;
20 
21 import java.io.File;
22 import javax.swing.JFileChooser;
23 import org.netbeans.spi.options.OptionsPanelController;
28 
32 final class AutopsyOptionsPanel extends javax.swing.JPanel {
33 
34  private static final long serialVersionUID = 1L;
35  private final JFileChooser fc;
36 
37  AutopsyOptionsPanel() {
38  initComponents();
39  fc = new JFileChooser();
40  fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
41  fc.setMultiSelectionEnabled(false);
42  fc.setFileFilter(new GeneralFilter(GeneralFilter.GRAPHIC_IMAGE_EXTS, GeneralFilter.GRAPHIC_IMG_DECR));
43  }
44 
45  void load() {
46  boolean keepPreferredViewer = UserPreferences.keepPreferredContentViewer();
47  keepCurrentViewerRB.setSelected(keepPreferredViewer);
48  useBestViewerRB.setSelected(!keepPreferredViewer);
49  dataSourcesHideKnownCB.setSelected(UserPreferences.hideKnownFilesInDataSourcesTree());
50  viewsHideKnownCB.setSelected(UserPreferences.hideKnownFilesInViewsTree());
51  dataSourcesHideSlackCB.setSelected(UserPreferences.hideSlackFilesInDataSourcesTree());
52  viewsHideSlackCB.setSelected(UserPreferences.hideSlackFilesInViewsTree());
53  boolean useLocalTime = UserPreferences.displayTimesInLocalTime();
54  useLocalTimeRB.setSelected(useLocalTime);
55  useGMTTimeRB.setSelected(!useLocalTime);
56  agencyLogoPathField.setText(ModuleSettings.getConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP));
57  }
58 
59  void store() {
60  UserPreferences.setKeepPreferredContentViewer(keepCurrentViewerRB.isSelected());
61  UserPreferences.setHideKnownFilesInDataSourcesTree(dataSourcesHideKnownCB.isSelected());
62  UserPreferences.setHideKnownFilesInViewsTree(viewsHideKnownCB.isSelected());
63  UserPreferences.setHideSlackFilesInDataSourcesTree(dataSourcesHideSlackCB.isSelected());
64  UserPreferences.setHideSlackFilesInViewsTree(viewsHideSlackCB.isSelected());
65  UserPreferences.setDisplayTimesInLocalTime(useLocalTimeRB.isSelected());
66  if (!agencyLogoPathField.getText().isEmpty()) {
67  File image = new File(agencyLogoPathField.getText());
68  if (image.exists()) {
69  ModuleSettings.setConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP, agencyLogoPathField.getText());
70  }
71  }
72  }
73 
74  boolean valid() {
75  return true;
76  }
77 
83  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
84  private void initComponents() {
85 
86  buttonGroup1 = new javax.swing.ButtonGroup();
87  buttonGroup3 = new javax.swing.ButtonGroup();
88  jScrollPane1 = new javax.swing.JScrollPane();
89  jPanel1 = new javax.swing.JPanel();
90  useBestViewerRB = new javax.swing.JRadioButton();
91  keepCurrentViewerRB = new javax.swing.JRadioButton();
92  jLabelSelectFile = new javax.swing.JLabel();
93  jLabelTimeDisplay = new javax.swing.JLabel();
94  useLocalTimeRB = new javax.swing.JRadioButton();
95  useGMTTimeRB = new javax.swing.JRadioButton();
96  jLabelHideKnownFiles = new javax.swing.JLabel();
97  dataSourcesHideKnownCB = new javax.swing.JCheckBox();
98  viewsHideKnownCB = new javax.swing.JCheckBox();
99  dataSourcesHideSlackCB = new javax.swing.JCheckBox();
100  viewsHideSlackCB = new javax.swing.JCheckBox();
101  jLabelHideSlackFiles = new javax.swing.JLabel();
102  agencyLogoImageLabel = new javax.swing.JLabel();
103  agencyLogoPathField = new javax.swing.JTextField();
104  browseLogosButton = new javax.swing.JButton();
105 
106  jScrollPane1.setBorder(null);
107 
108  buttonGroup1.add(useBestViewerRB);
109  org.openide.awt.Mnemonics.setLocalizedText(useBestViewerRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.useBestViewerRB.text")); // NOI18N
110  useBestViewerRB.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.useBestViewerRB.toolTipText")); // NOI18N
111  useBestViewerRB.addActionListener(new java.awt.event.ActionListener() {
112  public void actionPerformed(java.awt.event.ActionEvent evt) {
113  useBestViewerRBActionPerformed(evt);
114  }
115  });
116 
117  buttonGroup1.add(keepCurrentViewerRB);
118  org.openide.awt.Mnemonics.setLocalizedText(keepCurrentViewerRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.keepCurrentViewerRB.text")); // NOI18N
119  keepCurrentViewerRB.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.keepCurrentViewerRB.toolTipText")); // NOI18N
120  keepCurrentViewerRB.addActionListener(new java.awt.event.ActionListener() {
121  public void actionPerformed(java.awt.event.ActionEvent evt) {
122  keepCurrentViewerRBActionPerformed(evt);
123  }
124  });
125 
126  org.openide.awt.Mnemonics.setLocalizedText(jLabelSelectFile, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabelSelectFile.text")); // NOI18N
127 
128  org.openide.awt.Mnemonics.setLocalizedText(jLabelTimeDisplay, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabelTimeDisplay.text")); // NOI18N
129 
130  buttonGroup3.add(useLocalTimeRB);
131  org.openide.awt.Mnemonics.setLocalizedText(useLocalTimeRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.useLocalTimeRB.text")); // NOI18N
132  useLocalTimeRB.addActionListener(new java.awt.event.ActionListener() {
133  public void actionPerformed(java.awt.event.ActionEvent evt) {
134  useLocalTimeRBActionPerformed(evt);
135  }
136  });
137 
138  buttonGroup3.add(useGMTTimeRB);
139  org.openide.awt.Mnemonics.setLocalizedText(useGMTTimeRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.useGMTTimeRB.text")); // NOI18N
140  useGMTTimeRB.addActionListener(new java.awt.event.ActionListener() {
141  public void actionPerformed(java.awt.event.ActionEvent evt) {
142  useGMTTimeRBActionPerformed(evt);
143  }
144  });
145 
146  org.openide.awt.Mnemonics.setLocalizedText(jLabelHideKnownFiles, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabelHideKnownFiles.text")); // NOI18N
147 
148  org.openide.awt.Mnemonics.setLocalizedText(dataSourcesHideKnownCB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.dataSourcesHideKnownCB.text")); // NOI18N
149  dataSourcesHideKnownCB.addActionListener(new java.awt.event.ActionListener() {
150  public void actionPerformed(java.awt.event.ActionEvent evt) {
151  dataSourcesHideKnownCBActionPerformed(evt);
152  }
153  });
154 
155  org.openide.awt.Mnemonics.setLocalizedText(viewsHideKnownCB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.viewsHideKnownCB.text")); // NOI18N
156  viewsHideKnownCB.addActionListener(new java.awt.event.ActionListener() {
157  public void actionPerformed(java.awt.event.ActionEvent evt) {
158  viewsHideKnownCBActionPerformed(evt);
159  }
160  });
161 
162  org.openide.awt.Mnemonics.setLocalizedText(dataSourcesHideSlackCB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.dataSourcesHideSlackCB.text")); // NOI18N
163  dataSourcesHideSlackCB.addActionListener(new java.awt.event.ActionListener() {
164  public void actionPerformed(java.awt.event.ActionEvent evt) {
165  dataSourcesHideSlackCBActionPerformed(evt);
166  }
167  });
168 
169  org.openide.awt.Mnemonics.setLocalizedText(viewsHideSlackCB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.viewsHideSlackCB.text")); // NOI18N
170  viewsHideSlackCB.addActionListener(new java.awt.event.ActionListener() {
171  public void actionPerformed(java.awt.event.ActionEvent evt) {
172  viewsHideSlackCBActionPerformed(evt);
173  }
174  });
175 
176  org.openide.awt.Mnemonics.setLocalizedText(jLabelHideSlackFiles, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabelHideSlackFiles.text")); // NOI18N
177 
178  org.openide.awt.Mnemonics.setLocalizedText(agencyLogoImageLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoImageLabel.text")); // NOI18N
179 
180  agencyLogoPathField.setEditable(false);
181  agencyLogoPathField.setBackground(new java.awt.Color(255, 255, 255));
182  agencyLogoPathField.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoPathField.text")); // NOI18N
183  agencyLogoPathField.setFocusable(false);
184  agencyLogoPathField.setRequestFocusEnabled(false);
185 
186  org.openide.awt.Mnemonics.setLocalizedText(browseLogosButton, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.browseLogosButton.text")); // NOI18N
187  browseLogosButton.addActionListener(new java.awt.event.ActionListener() {
188  public void actionPerformed(java.awt.event.ActionEvent evt) {
189  browseLogosButtonActionPerformed(evt);
190  }
191  });
192 
193  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
194  jPanel1.setLayout(jPanel1Layout);
195  jPanel1Layout.setHorizontalGroup(
196  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
197  .addGroup(jPanel1Layout.createSequentialGroup()
198  .addContainerGap()
199  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
200  .addGroup(jPanel1Layout.createSequentialGroup()
201  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
202  .addComponent(jLabelTimeDisplay)
203  .addComponent(jLabelHideKnownFiles)
204  .addComponent(jLabelSelectFile)
205  .addGroup(jPanel1Layout.createSequentialGroup()
206  .addGap(10, 10, 10)
207  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
208  .addComponent(useLocalTimeRB)
209  .addComponent(useGMTTimeRB)
210  .addComponent(keepCurrentViewerRB)
211  .addComponent(useBestViewerRB)
212  .addComponent(dataSourcesHideKnownCB)
213  .addComponent(viewsHideKnownCB))))
214  .addContainerGap(140, Short.MAX_VALUE))
215  .addGroup(jPanel1Layout.createSequentialGroup()
216  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
217  .addComponent(jLabelHideSlackFiles)
218  .addComponent(agencyLogoImageLabel)
219  .addGroup(jPanel1Layout.createSequentialGroup()
220  .addGap(10, 10, 10)
221  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
222  .addGroup(jPanel1Layout.createSequentialGroup()
223  .addComponent(agencyLogoPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE)
224  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
225  .addComponent(browseLogosButton))
226  .addComponent(dataSourcesHideSlackCB)
227  .addComponent(viewsHideSlackCB))))
228  .addGap(0, 0, Short.MAX_VALUE))))
229  );
230  jPanel1Layout.setVerticalGroup(
231  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
232  .addGroup(jPanel1Layout.createSequentialGroup()
233  .addContainerGap()
234  .addComponent(jLabelSelectFile)
235  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
236  .addComponent(useBestViewerRB)
237  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
238  .addComponent(keepCurrentViewerRB)
239  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
240  .addComponent(jLabelHideKnownFiles)
241  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
242  .addComponent(dataSourcesHideKnownCB)
243  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
244  .addComponent(viewsHideKnownCB)
245  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
246  .addComponent(jLabelHideSlackFiles)
247  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
248  .addComponent(dataSourcesHideSlackCB)
249  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
250  .addComponent(viewsHideSlackCB)
251  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
252  .addComponent(jLabelTimeDisplay)
253  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
254  .addComponent(useLocalTimeRB)
255  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
256  .addComponent(useGMTTimeRB)
257  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
258  .addComponent(agencyLogoImageLabel)
259  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
260  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
261  .addComponent(agencyLogoPathField)
262  .addComponent(browseLogosButton))
263  .addGap(35, 35, 35))
264  );
265 
266  jScrollPane1.setViewportView(jPanel1);
267 
268  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
269  this.setLayout(layout);
270  layout.setHorizontalGroup(
271  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
272  .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
273  );
274  layout.setVerticalGroup(
275  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
276  .addComponent(jScrollPane1)
277  );
278  }// </editor-fold>//GEN-END:initComponents
279 
280  private void useBestViewerRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useBestViewerRBActionPerformed
281  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
282  }//GEN-LAST:event_useBestViewerRBActionPerformed
283 
284  private void keepCurrentViewerRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keepCurrentViewerRBActionPerformed
285  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
286  }//GEN-LAST:event_keepCurrentViewerRBActionPerformed
287 
288  private void dataSourcesHideKnownCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourcesHideKnownCBActionPerformed
289  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
290  }//GEN-LAST:event_dataSourcesHideKnownCBActionPerformed
291 
292  private void viewsHideKnownCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewsHideKnownCBActionPerformed
293  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
294  }//GEN-LAST:event_viewsHideKnownCBActionPerformed
295 
296  private void useLocalTimeRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useLocalTimeRBActionPerformed
297  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
298  }//GEN-LAST:event_useLocalTimeRBActionPerformed
299 
300  private void useGMTTimeRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useGMTTimeRBActionPerformed
301  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
302  }//GEN-LAST:event_useGMTTimeRBActionPerformed
303 
304  private void dataSourcesHideSlackCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourcesHideSlackCBActionPerformed
305  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
306  }//GEN-LAST:event_dataSourcesHideSlackCBActionPerformed
307 
308  private void viewsHideSlackCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewsHideSlackCBActionPerformed
309  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
310  }//GEN-LAST:event_viewsHideSlackCBActionPerformed
311 
312  private void browseLogosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLogosButtonActionPerformed
313  int returnState = fc.showOpenDialog(this);
314  if (returnState == JFileChooser.APPROVE_OPTION) {
315  String path = fc.getSelectedFile().getPath();
316  agencyLogoPathField.setText(path);
317  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
318  }
319  }//GEN-LAST:event_browseLogosButtonActionPerformed
320 
321  // Variables declaration - do not modify//GEN-BEGIN:variables
322  private javax.swing.JLabel agencyLogoImageLabel;
323  private javax.swing.JTextField agencyLogoPathField;
324  private javax.swing.JButton browseLogosButton;
325  private javax.swing.ButtonGroup buttonGroup1;
326  private javax.swing.ButtonGroup buttonGroup3;
327  private javax.swing.JCheckBox dataSourcesHideKnownCB;
328  private javax.swing.JCheckBox dataSourcesHideSlackCB;
329  private javax.swing.JLabel jLabelHideKnownFiles;
330  private javax.swing.JLabel jLabelHideSlackFiles;
331  private javax.swing.JLabel jLabelSelectFile;
332  private javax.swing.JLabel jLabelTimeDisplay;
333  private javax.swing.JPanel jPanel1;
334  private javax.swing.JScrollPane jScrollPane1;
335  private javax.swing.JRadioButton keepCurrentViewerRB;
336  private javax.swing.JRadioButton useBestViewerRB;
337  private javax.swing.JRadioButton useGMTTimeRB;
338  private javax.swing.JRadioButton useLocalTimeRB;
339  private javax.swing.JCheckBox viewsHideKnownCB;
340  private javax.swing.JCheckBox viewsHideSlackCB;
341  // End of variables declaration//GEN-END:variables
342 }

Copyright © 2012-2016 Basis Technology. Generated on: Tue Jun 13 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.