19 package org.sleuthkit.autopsy.keywordsearch;
27 @SuppressWarnings(
"PMD.SingularField")
28 class NewKeywordPanel extends javax.swing.JPanel {
33 public NewKeywordPanel() {
40 String getKeywordText() {
41 return keywordTextField.getText();
47 boolean isKeywordRegex() {
48 return regexButton.isSelected();
54 boolean isKeywordExact() {
55 return exactButton.isSelected();
63 @SuppressWarnings(
"unchecked")
65 private
void initComponents() {
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();
74 keywordTextField.setText(
org.openide.util.NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.keywordTextField.text"));
75 keywordTextField.addAncestorListener(
new javax.swing.event.AncestorListener() {
76 public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
78 public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
79 keywordTextFieldAncestorAdded(evt);
81 public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
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"));
89 keywordTypeButtonGroup.add(substringButton);
90 org.openide.awt.Mnemonics.setLocalizedText(substringButton,
org.openide.util.NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.substringButton.text"));
92 keywordTypeButtonGroup.add(regexButton);
93 org.openide.awt.Mnemonics.setLocalizedText(regexButton,
org.openide.util.NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.regexButton.text"));
95 org.openide.awt.Mnemonics.setLocalizedText(newKeywordLabel,
org.openide.util.NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.newKeywordLabel.text"));
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()
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))
114 layout.setVerticalGroup(
115 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116 .addGroup(layout.createSequentialGroup()
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))
130 private void keywordTextFieldAncestorAdded(javax.swing.event.AncestorEvent evt) {
131 evt.getComponent().requestFocusInWindow();
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;