Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
NewKeywordPanel.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.keywordsearch;
20 
27 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
28 class NewKeywordPanel extends javax.swing.JPanel {
29 
33  public NewKeywordPanel() {
34  initComponents();
35  }
36 
40  String getKeywordText() {
41  return keywordTextField.getText();
42  }
43 
47  boolean isKeywordRegex() {
48  return regexButton.isSelected();
49  }
50 
54  boolean isKeywordExact() {
55  return exactButton.isSelected();
56  }
57 
63  @SuppressWarnings("unchecked")
64  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
65  private void initComponents() {
66 
67  keywordTypeButtonGroup = new javax.swing.ButtonGroup();
68  keywordTextField = new javax.swing.JTextField();
69  exactButton = new javax.swing.JRadioButton();
70  substringButton = new javax.swing.JRadioButton();
71  regexButton = new javax.swing.JRadioButton();
72  newKeywordLabel = new javax.swing.JLabel();
73 
74  keywordTextField.setText(org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.keywordTextField.text")); // NOI18N
75  keywordTextField.addAncestorListener(new javax.swing.event.AncestorListener() {
76  public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
77  }
78  public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
79  keywordTextFieldAncestorAdded(evt);
80  }
81  public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
82  }
83  });
84 
85  keywordTypeButtonGroup.add(exactButton);
86  exactButton.setSelected(true);
87  org.openide.awt.Mnemonics.setLocalizedText(exactButton, org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.exactButton.text")); // NOI18N
88 
89  keywordTypeButtonGroup.add(substringButton);
90  org.openide.awt.Mnemonics.setLocalizedText(substringButton, org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.substringButton.text")); // NOI18N
91 
92  keywordTypeButtonGroup.add(regexButton);
93  org.openide.awt.Mnemonics.setLocalizedText(regexButton, org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.regexButton.text")); // NOI18N
94 
95  org.openide.awt.Mnemonics.setLocalizedText(newKeywordLabel, org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.newKeywordLabel.text")); // NOI18N
96 
97  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
98  this.setLayout(layout);
99  layout.setHorizontalGroup(
100  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
101  .addGroup(layout.createSequentialGroup()
102  .addContainerGap()
103  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
104  .addGroup(layout.createSequentialGroup()
105  .addComponent(exactButton)
106  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
107  .addComponent(substringButton)
108  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
109  .addComponent(regexButton))
110  .addComponent(newKeywordLabel)
111  .addComponent(keywordTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE))
112  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
113  );
114  layout.setVerticalGroup(
115  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116  .addGroup(layout.createSequentialGroup()
117  .addContainerGap()
118  .addComponent(newKeywordLabel)
119  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
120  .addComponent(keywordTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
121  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
122  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
123  .addComponent(exactButton)
124  .addComponent(substringButton)
125  .addComponent(regexButton))
126  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
127  );
128  }// </editor-fold>//GEN-END:initComponents
129 
130  private void keywordTextFieldAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_keywordTextFieldAncestorAdded
131  evt.getComponent().requestFocusInWindow();
132  }//GEN-LAST:event_keywordTextFieldAncestorAdded
133 
134 
135  // Variables declaration - do not modify//GEN-BEGIN:variables
136  private javax.swing.JRadioButton exactButton;
137  private javax.swing.JTextField keywordTextField;
138  private javax.swing.ButtonGroup keywordTypeButtonGroup;
139  private javax.swing.JLabel newKeywordLabel;
140  private javax.swing.JRadioButton regexButton;
141  private javax.swing.JRadioButton substringButton;
142  // End of variables declaration//GEN-END:variables
143 }

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