Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
KnownStatusSearchPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-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.filesearch;
20 
21 import javax.swing.JCheckBox;
22 
26 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
27 class KnownStatusSearchPanel extends javax.swing.JPanel {
28 
32  KnownStatusSearchPanel() {
33  initComponents();
34  setComponentsEnabled();
35  }
36 
37  JCheckBox getKnownCheckBox() {
38  return knownCheckBox;
39  }
40 
41  JCheckBox getKnownBadOptionCheckBox() {
42  return knownBadOptionCheckBox;
43  }
44 
45  JCheckBox getKnownOptionCheckBox() {
46  return knownOptionCheckBox;
47  }
48 
49  JCheckBox getUnknownOptionCheckBox() {
50  return unknownOptionCheckBox;
51  }
52 
53  private void setComponentsEnabled() {
54  boolean enabled = this.knownCheckBox.isSelected();
55  this.unknownOptionCheckBox.setEnabled(enabled);
56  this.knownOptionCheckBox.setEnabled(enabled);
57  this.knownBadOptionCheckBox.setEnabled(enabled);
58  }
59 
60  boolean isValidSearch() {
61  return this.unknownOptionCheckBox.isSelected() || this.knownBadOptionCheckBox.isSelected() || this.knownOptionCheckBox.isSelected();
62  }
63 
69  @SuppressWarnings("unchecked")
70  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
71  private void initComponents() {
72 
73  knownCheckBox = new javax.swing.JCheckBox();
74  unknownOptionCheckBox = new javax.swing.JCheckBox();
75  knownOptionCheckBox = new javax.swing.JCheckBox();
76  knownBadOptionCheckBox = new javax.swing.JCheckBox();
77 
78  knownCheckBox.setText(org.openide.util.NbBundle.getMessage(KnownStatusSearchPanel.class, "KnownStatusSearchPanel.knownCheckBox.text")); // NOI18N
79  knownCheckBox.addActionListener(new java.awt.event.ActionListener() {
80  public void actionPerformed(java.awt.event.ActionEvent evt) {
81  knownCheckBoxActionPerformed(evt);
82  }
83  });
84 
85  unknownOptionCheckBox.setSelected(true);
86  unknownOptionCheckBox.setText(org.openide.util.NbBundle.getMessage(KnownStatusSearchPanel.class, "KnownStatusSearchPanel.unknownOptionCheckBox.text")); // NOI18N
87  unknownOptionCheckBox.addActionListener(new java.awt.event.ActionListener() {
88  public void actionPerformed(java.awt.event.ActionEvent evt) {
89  unknownOptionCheckBoxActionPerformed(evt);
90  }
91  });
92 
93  knownOptionCheckBox.setSelected(true);
94  knownOptionCheckBox.setText(org.openide.util.NbBundle.getMessage(KnownStatusSearchPanel.class, "KnownStatusSearchPanel.knownOptionCheckBox.text")); // NOI18N
95  knownOptionCheckBox.addActionListener(new java.awt.event.ActionListener() {
96  public void actionPerformed(java.awt.event.ActionEvent evt) {
97  knownOptionCheckBoxActionPerformed(evt);
98  }
99  });
100 
101  knownBadOptionCheckBox.setSelected(true);
102  knownBadOptionCheckBox.setText(org.openide.util.NbBundle.getMessage(KnownStatusSearchPanel.class, "KnownStatusSearchPanel.knownBadOptionCheckBox.text")); // NOI18N
103  knownBadOptionCheckBox.addActionListener(new java.awt.event.ActionListener() {
104  public void actionPerformed(java.awt.event.ActionEvent evt) {
105  knownBadOptionCheckBoxActionPerformed(evt);
106  }
107  });
108 
109  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
110  this.setLayout(layout);
111  layout.setHorizontalGroup(
112  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
113  .addGroup(layout.createSequentialGroup()
114  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
115  .addComponent(knownCheckBox)
116  .addGroup(layout.createSequentialGroup()
117  .addGap(21, 21, 21)
118  .addComponent(unknownOptionCheckBox)
119  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
120  .addComponent(knownOptionCheckBox)
121  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
122  .addComponent(knownBadOptionCheckBox)))
123  .addContainerGap(28, Short.MAX_VALUE))
124  );
125  layout.setVerticalGroup(
126  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
127  .addGroup(layout.createSequentialGroup()
128  .addComponent(knownCheckBox)
129  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
130  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
131  .addComponent(unknownOptionCheckBox)
132  .addComponent(knownOptionCheckBox)
133  .addComponent(knownBadOptionCheckBox)))
134  );
135  }// </editor-fold>//GEN-END:initComponents
136 
137  private void knownOptionCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownOptionCheckBoxActionPerformed
138  firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
139  }//GEN-LAST:event_knownOptionCheckBoxActionPerformed
140 
141  private void knownCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownCheckBoxActionPerformed
142  setComponentsEnabled();
143  firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
144  }//GEN-LAST:event_knownCheckBoxActionPerformed
145 
146  private void unknownOptionCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unknownOptionCheckBoxActionPerformed
147  firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
148  }//GEN-LAST:event_unknownOptionCheckBoxActionPerformed
149 
150  private void knownBadOptionCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownBadOptionCheckBoxActionPerformed
151  firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
152  }//GEN-LAST:event_knownBadOptionCheckBoxActionPerformed
153 
154  // Variables declaration - do not modify//GEN-BEGIN:variables
155  private javax.swing.JCheckBox knownBadOptionCheckBox;
156  private javax.swing.JCheckBox knownCheckBox;
157  private javax.swing.JCheckBox knownOptionCheckBox;
158  private javax.swing.JCheckBox unknownOptionCheckBox;
159  // End of variables declaration//GEN-END:variables
160 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Feb 6 2024
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.