Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
GlobalEditListPanel.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 */
19package org.sleuthkit.autopsy.keywordsearch;
20
21import java.awt.EventQueue;
22import java.beans.PropertyChangeEvent;
23import java.beans.PropertyChangeListener;
24import java.util.Arrays;
25import java.util.List;
26import java.util.logging.Level;
27import java.util.regex.Pattern;
28import java.util.regex.PatternSyntaxException;
29import javax.swing.JTable;
30import javax.swing.ListSelectionModel;
31import javax.swing.event.ListSelectionEvent;
32import javax.swing.event.ListSelectionListener;
33import javax.swing.table.AbstractTableModel;
34import javax.swing.table.TableColumn;
35import org.netbeans.spi.options.OptionsPanelController;
36import org.openide.util.NbBundle;
37import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
38import org.sleuthkit.autopsy.coreutils.Logger;
39import org.sleuthkit.autopsy.guiutils.SimpleTableCellRenderer;
40import org.sleuthkit.autopsy.ingest.IngestManager;
41
45@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
46class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionListener, OptionsPanel {
47
48 private static final Logger logger = Logger.getLogger(GlobalEditListPanel.class.getName());
49 private static final long serialVersionUID = 1L;
50 private final KeywordTableModel tableModel;
51 private KeywordList currentKeywordList;
52
56 GlobalEditListPanel() {
57 tableModel = new KeywordTableModel();
58 initComponents();
59 customizeComponents();
60 }
61
62 private void customizeComponents() {
63 newKeywordsButton.setToolTipText((NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.addWordToolTip")));
64 deleteWordButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.removeSelectedMsg"));
65
66 keywordTable.getParent().setBackground(keywordTable.getBackground());
67 final int width = jScrollPane1.getPreferredSize().width;
68 keywordTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
69 TableColumn column;
70 for (int i = 0; i < keywordTable.getColumnCount(); i++) {
71 column = keywordTable.getColumnModel().getColumn(i);
72 if (i == 0) {
73 column.setPreferredWidth(((int) (width * 0.90)));
74 } else {
75 column.setPreferredWidth(((int) (width * 0.10)));
76 }
77 }
78 keywordTable.setCellSelectionEnabled(false);
79 keywordTable.setRowSelectionAllowed(true);
80 keywordTable.setDefaultRenderer(String.class, new SimpleTableCellRenderer());
81
82 final ListSelectionModel lsm = keywordTable.getSelectionModel();
83 lsm.addListSelectionListener(new ListSelectionListener() {
84 @Override
85 public void valueChanged(ListSelectionEvent e) {
86 boolean canDelete = !(lsm.isSelectionEmpty() || currentKeywordList.isEditable() || IngestManager.getInstance().isIngestRunning());
87 boolean canEdit = canDelete && (lsm.getMaxSelectionIndex() == lsm.getMinSelectionIndex()); //edit only enabled with single selection
88 deleteWordButton.setEnabled(canDelete);
89 editWordButton.setEnabled(canEdit);
90 }
91 });
92
93 setButtonStates();
94
95 IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
96 @Override
97 public void propertyChange(PropertyChangeEvent evt) {
98 Object source = evt.getSource();
99 if (source instanceof String && ((String) source).equals("LOCAL")) { //NON-NLS
100 EventQueue.invokeLater(() -> {
101 setButtonStates();
102 });
103 }
104 }
105 });
106 }
107
111 void setButtonStates() {
112 boolean isIngestRunning = IngestManager.getInstance().isIngestRunning();
113 boolean isListSelected = currentKeywordList != null;
114
115 ingestWarningLabel.setVisible(isIngestRunning);
116 // items that only need a selected list
117 boolean canEditList = isListSelected && !isIngestRunning;
118 ingestMessagesCheckbox.setEnabled(canEditList);
119 ingestMessagesCheckbox.setSelected(currentKeywordList != null && currentKeywordList.getIngestMessages());
120
121 // items that need an unlocked list w/out ingest running
122 boolean canAddWord = canEditList && !currentKeywordList.isEditable();
123 newKeywordsButton.setEnabled(canAddWord);
124
125 // items that need a non-empty list
126 if ((currentKeywordList == null) || (currentKeywordList.getKeywords().isEmpty())) {
127 deleteWordButton.setEnabled(false);
128 editWordButton.setEnabled(false);
129 }
130 }
131
132 @NbBundle.Messages({"GlobalEditListPanel.editKeyword.title=Edit Keyword",
133 "GlobalEditListPanel.warning.title=Warning",
134 "GlobalEditListPanel.warning.text=Boundary characters ^ and $ do not match word boundaries. Consider\nreplacing with an explicit list of boundary characters, such as [ \\.,]"})
135
142 private boolean addKeywordsAction(String existingKeywords, boolean isLiteral, boolean isWholeWord) {
143 String keywordsToRedisplay = existingKeywords;
144 AddKeywordsDialog dialog = new AddKeywordsDialog();
145
146 int goodCount = 0;
147 int dupeCount = 0;
148 int badCount = 1; // Default to 1 so we enter the loop the first time
149
150 if (!existingKeywords.isEmpty()) { //if there is an existing keyword then this action was called by the edit button
151 dialog.setTitle(NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.editKeyword.title"));
152 }
153 while (badCount > 0) {
154 dialog.setInitialKeywordList(keywordsToRedisplay, isLiteral, isWholeWord);
155 dialog.display();
156
157 goodCount = 0;
158 dupeCount = 0;
159 badCount = 0;
160 keywordsToRedisplay = "";
161 boolean displayedBoundaryWarning = false;
162
163 if (!dialog.getKeywords().isEmpty()) {
164
165 for (String newWord : dialog.getKeywords()) {
166 if (newWord.isEmpty()) {
167 continue;
168 }
169
170 final Keyword keyword = new Keyword(newWord, !dialog.isKeywordRegex(), dialog.isKeywordExact(), currentKeywordList.getName(), newWord);
171 if (currentKeywordList.hasKeyword(keyword)) {
172 dupeCount++;
173 continue;
174 }
175
176 // Check if it is a regex and starts or ends with a boundary character
177 if (( ! displayedBoundaryWarning) && dialog.isKeywordRegex()) {
178 if(newWord.startsWith("^") ||
179 (newWord.endsWith("$") && ! newWord.endsWith("\\$"))) {
180
181 KeywordSearchUtil.displayDialog(NbBundle.getMessage(this.getClass(), "GlobalEditListPanel.warning.title"),
182 NbBundle.getMessage(this.getClass(), "GlobalEditListPanel.warning.text"),
183 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
184 // Only display the warning once
185 displayedBoundaryWarning = true;
186 }
187 }
188
189 //check if valid
190 boolean valid = true;
191 try {
192 Pattern.compile(newWord);
193 } catch (PatternSyntaxException ex1) {
194 valid = false;
195 } catch (IllegalArgumentException ex2) {
196 valid = false;
197 }
198 if (!valid) {
199
200 // Invalid keywords will reappear in the UI
201 keywordsToRedisplay += newWord + "\n";
202 badCount++;
203 continue;
204 }
205
206 // Add the new keyword
207 tableModel.addKeyword(keyword);
208 goodCount++;
209 }
210 XmlKeywordSearchList.getCurrent().addList(currentKeywordList);
211 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
212
213 if ((badCount > 0) || (dupeCount > 0)) {
214 // Display the error counts to the user
215 // The add keywords dialog will pop up again if any were invalid with any
216 // invalid entries (valid entries and dupes will disappear)
217
218 String summary = "";
219 KeywordSearchUtil.DIALOG_MESSAGE_TYPE level = KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO;
220 if (goodCount > 0) {
221 if (goodCount > 1) {
222 summary += NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.keywordsAddedPlural.text", goodCount) + "\n";
223 } else {
224 summary += NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.keywordsAdded.text", goodCount) + "\n";
225 }
226 }
227 if (dupeCount > 0) {
228 if (dupeCount > 1) {
229 summary += NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.keywordDupesSkippedPlural.text", dupeCount) + "\n";
230 } else {
231 summary += NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.keywordDupesSkipped.text", dupeCount) + "\n";
232 }
233 level = KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN;
234 }
235 if (badCount > 0) {
236 if (badCount > 1) {
237 summary += NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.keywordErrorsPlural.text", badCount) + "\n";
238 } else {
239 summary += NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.keywordErrors.text", badCount) + "\n";
240 }
241 level = KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR;
242 }
243 KeywordSearchUtil.displayDialog(NbBundle.getMessage(this.getClass(), "GlobalEditListPanel.addKeywordResults.text"),
244 summary, level);
245 }
246 }
247 }
248 setFocusOnKeywordTextBox();
249 setButtonStates();
250 return (goodCount >= 1 && dupeCount == 0);
251 }
252
259 private void deleteKeywordAction(int[] selectedKeywords) {
260 tableModel.deleteSelected(selectedKeywords);
261 XmlKeywordSearchList.getCurrent().addList(currentKeywordList);
262 setButtonStates();
263 }
264
270 @SuppressWarnings("unchecked")
271 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
272 private void initComponents() {
273
274 listEditorPanel = new javax.swing.JPanel();
275 jScrollPane1 = new javax.swing.JScrollPane();
276 keywordTable = new javax.swing.JTable();
277 ingestMessagesCheckbox = new javax.swing.JCheckBox();
278 keywordsLabel = new javax.swing.JLabel();
279 newKeywordsButton = new javax.swing.JButton();
280 deleteWordButton = new javax.swing.JButton();
281 editWordButton = new javax.swing.JButton();
282 ingestWarningLabel = new javax.swing.JLabel();
283
284 setMinimumSize(new java.awt.Dimension(0, 0));
285
286 listEditorPanel.setMinimumSize(new java.awt.Dimension(0, 0));
287
288 jScrollPane1.setPreferredSize(new java.awt.Dimension(340, 300));
289
290 keywordTable.setModel(tableModel);
291 keywordTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
292 keywordTable.setGridColor(new java.awt.Color(153, 153, 153));
293 keywordTable.setMaximumSize(new java.awt.Dimension(30000, 30000));
294 keywordTable.getTableHeader().setReorderingAllowed(false);
295 jScrollPane1.setViewportView(keywordTable);
296
297 ingestMessagesCheckbox.setSelected(true);
298 ingestMessagesCheckbox.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.ingestMessagesCheckbox.text")); // NOI18N
299 ingestMessagesCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText")); // NOI18N
300 ingestMessagesCheckbox.addActionListener(new java.awt.event.ActionListener() {
301 public void actionPerformed(java.awt.event.ActionEvent evt) {
302 ingestMessagesCheckboxActionPerformed(evt);
303 }
304 });
305
306 keywordsLabel.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.keywordsLabel.text")); // NOI18N
307
308 newKeywordsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/add16.png"))); // NOI18N
309 newKeywordsButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.newKeywordsButton.text")); // NOI18N
310 newKeywordsButton.addActionListener(new java.awt.event.ActionListener() {
311 public void actionPerformed(java.awt.event.ActionEvent evt) {
312 newKeywordsButtonActionPerformed(evt);
313 }
314 });
315
316 deleteWordButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); // NOI18N
317 deleteWordButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.deleteWordButton.text")); // NOI18N
318 deleteWordButton.addActionListener(new java.awt.event.ActionListener() {
319 public void actionPerformed(java.awt.event.ActionEvent evt) {
320 deleteWordButtonActionPerformed(evt);
321 }
322 });
323
324 editWordButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/edit16.png"))); // NOI18N
325 editWordButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.editWordButton.text")); // NOI18N
326 editWordButton.addActionListener(new java.awt.event.ActionListener() {
327 public void actionPerformed(java.awt.event.ActionEvent evt) {
328 editWordButtonActionPerformed(evt);
329 }
330 });
331
332 ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
333 ingestWarningLabel.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.ingestWarningLabel.text")); // NOI18N
334
335 javax.swing.GroupLayout listEditorPanelLayout = new javax.swing.GroupLayout(listEditorPanel);
336 listEditorPanel.setLayout(listEditorPanelLayout);
337 listEditorPanelLayout.setHorizontalGroup(
338 listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
339 .addGroup(listEditorPanelLayout.createSequentialGroup()
340 .addContainerGap()
341 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
342 .addGroup(listEditorPanelLayout.createSequentialGroup()
343 .addComponent(keywordsLabel)
344 .addGap(0, 0, Short.MAX_VALUE))
345 .addGroup(listEditorPanelLayout.createSequentialGroup()
346 .addGap(10, 10, 10)
347 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
348 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE)
349 .addGroup(listEditorPanelLayout.createSequentialGroup()
350 .addComponent(newKeywordsButton)
351 .addGap(14, 14, 14)
352 .addComponent(editWordButton)
353 .addGap(14, 14, 14)
354 .addComponent(deleteWordButton)
355 .addGap(0, 0, Short.MAX_VALUE))
356 .addGroup(listEditorPanelLayout.createSequentialGroup()
357 .addComponent(ingestMessagesCheckbox)
358 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
359 .addComponent(ingestWarningLabel)))))
360 .addContainerGap())
361 );
362
363 listEditorPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteWordButton, editWordButton, newKeywordsButton});
364
365 listEditorPanelLayout.setVerticalGroup(
366 listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
367 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, listEditorPanelLayout.createSequentialGroup()
368 .addContainerGap()
369 .addComponent(keywordsLabel)
370 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
371 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
372 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
373 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
374 .addComponent(deleteWordButton)
375 .addComponent(newKeywordsButton)
376 .addComponent(editWordButton))
377 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
378 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
379 .addComponent(ingestMessagesCheckbox)
380 .addComponent(ingestWarningLabel))
381 .addGap(9, 9, 9))
382 );
383
384 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
385 this.setLayout(layout);
386 layout.setHorizontalGroup(
387 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
388 .addComponent(listEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
389 );
390 layout.setVerticalGroup(
391 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
392 .addGroup(layout.createSequentialGroup()
393 .addComponent(listEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
394 .addGap(5, 5, 5))
395 );
396 }// </editor-fold>//GEN-END:initComponents
397
398 private void deleteWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteWordButtonActionPerformed
399 if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.removeKwMsg"),
400 NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.deleteWordButtonActionPerformed.delConfirmMsg"),
401 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) {
402 deleteKeywordAction(keywordTable.getSelectedRows());
403 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
404 }
405 }//GEN-LAST:event_deleteWordButtonActionPerformed
406
407 private void ingestMessagesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ingestMessagesCheckboxActionPerformed
408 currentKeywordList.setIngestMessages(ingestMessagesCheckbox.isSelected());
409 XmlKeywordSearchList updater = XmlKeywordSearchList.getCurrent();
410 updater.addList(currentKeywordList);
411 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
412 }//GEN-LAST:event_ingestMessagesCheckboxActionPerformed
413
414 private void newKeywordsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newKeywordsButtonActionPerformed
415 addKeywordsAction("", true, true);
416 }//GEN-LAST:event_newKeywordsButtonActionPerformed
417
418 private void editWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editWordButtonActionPerformed
419 int[] selectedKeywords = keywordTable.getSelectedRows();
420 if (selectedKeywords.length == 1) {
421 Keyword currentKeyword = currentKeywordList.getKeywords().get(selectedKeywords[0]);
422 if (addKeywordsAction(currentKeyword.getSearchTerm(), currentKeyword.searchTermIsLiteral(), currentKeyword.searchTermIsWholeWord())) {
423 deleteKeywordAction(selectedKeywords);
424 }
425 }
426 }//GEN-LAST:event_editWordButtonActionPerformed
427
428 // Variables declaration - do not modify//GEN-BEGIN:variables
429 private javax.swing.JButton deleteWordButton;
430 private javax.swing.JButton editWordButton;
431 private javax.swing.JCheckBox ingestMessagesCheckbox;
432 private javax.swing.JLabel ingestWarningLabel;
433 private javax.swing.JScrollPane jScrollPane1;
434 private javax.swing.JTable keywordTable;
435 private javax.swing.JLabel keywordsLabel;
436 private javax.swing.JPanel listEditorPanel;
437 private javax.swing.JButton newKeywordsButton;
438 // End of variables declaration//GEN-END:variables
439
440 @Override
441 public void valueChanged(ListSelectionEvent e) {
442 //respond to list selection changes in KeywordSearchListManagementPanel
443 ListSelectionModel listSelectionModel = (ListSelectionModel) e.getSource();
444 currentKeywordList = null;
445 if (!listSelectionModel.isSelectionEmpty()) {
446 XmlKeywordSearchList loader = XmlKeywordSearchList.getCurrent();
447 if (listSelectionModel.getMinSelectionIndex() == listSelectionModel.getMaxSelectionIndex()) {
448 currentKeywordList = loader.getListsL(false).get(listSelectionModel.getMinSelectionIndex());
449 }
450 }
451 tableModel.resync();
452 setButtonStates();
453 }
454
455 @Override
456 public void store() {
457 // Implemented by parent panel
458 }
459
460 @Override
461 public void load() {
462 // Implemented by parent panel
463 }
464
465 KeywordList getCurrentKeywordList() {
466 return currentKeywordList;
467 }
468
469 void setCurrentKeywordList(KeywordList list) {
470 currentKeywordList = list;
471 }
472
473 private class KeywordTableModel extends AbstractTableModel {
474
475 @Override
476 public int getColumnCount() {
477 return 2;
478 }
479
480 @Override
481 public int getRowCount() {
482 return currentKeywordList == null ? 0 : currentKeywordList.getKeywords().size();
483 }
484
485 @Override
486 public String getColumnName(int column) {
487 String colName = null;
488
489 switch (column) {
490 case 0:
491 colName = NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.kwColName");
492 break;
493 case 1:
494 colName = NbBundle.getMessage(this.getClass(), "KeywordSearch.typeColLbl");
495 break;
496 default:
497 ;
498 }
499 return colName;
500 }
501
502 @Override
503 public Object getValueAt(int rowIndex, int columnIndex) {
504 Object ret = null;
505 if (currentKeywordList == null) {
506 return "";
507 }
508 Keyword word = currentKeywordList.getKeywords().get(rowIndex);
509 switch (columnIndex) {
510 case 0:
511 ret = word.getSearchTerm();
512 break;
513 case 1:
514 ret = word.getSearchTermType();
515 break;
516 default:
517 logger.log(Level.SEVERE, "Invalid table column index: {0}", columnIndex); //NON-NLS
518 break;
519 }
520 return ret;
521 }
522
523 @Override
524 public boolean isCellEditable(int rowIndex, int columnIndex) {
525 return false;
526 }
527
528 @Override
529 public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
530 }
531
532 @Override
533 public Class<?> getColumnClass(int c) {
534 return getValueAt(0, c).getClass();
535 }
536
537 void addKeyword(Keyword keyword) {
538 if (!currentKeywordList.hasKeyword(keyword)) {
539 currentKeywordList.getKeywords().add(keyword);
540 }
541 fireTableDataChanged();
542 }
543
544 void resync() {
545 fireTableDataChanged();
546 }
547
548 //delete selected from handle, events are fired from the handle
549 void deleteSelected(int[] selected) {
550 List<Keyword> words = currentKeywordList.getKeywords();
551 Arrays.sort(selected);
552 for (int arrayi = selected.length - 1; arrayi >= 0; arrayi--) {
553 words.remove(selected[arrayi]);
554 }
555 resync();
556 }
557 }
558
562 void setFocusOnKeywordTextBox() {
563 newKeywordsButton.requestFocus();
564 }
565}
synchronized static Logger getLogger(String name)
Definition Logger.java:124
static synchronized IngestManager getInstance()
void addIngestJobEventListener(final PropertyChangeListener listener)

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.