19 package org.sleuthkit.autopsy.keywordsearch;
21 import java.awt.EventQueue;
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
24 import java.beans.PropertyChangeEvent;
25 import java.beans.PropertyChangeListener;
27 import java.util.ArrayList;
28 import java.util.Arrays;
29 import java.util.List;
30 import java.util.logging.Level;
31 import org.openide.util.NbBundle;
33 import java.util.regex.Pattern;
34 import java.util.regex.PatternSyntaxException;
35 import javax.swing.JFileChooser;
36 import javax.swing.JMenuItem;
37 import javax.swing.JTable;
38 import javax.swing.ListSelectionModel;
39 import javax.swing.event.ListSelectionEvent;
40 import javax.swing.event.ListSelectionListener;
41 import javax.swing.filechooser.FileNameExtensionFilter;
42 import javax.swing.table.AbstractTableModel;
43 import javax.swing.table.TableColumn;
50 class GlobalEditListPanel
extends javax.swing.JPanel implements ListSelectionListener, OptionsPanel {
52 private static final Logger logger = Logger.getLogger(GlobalEditListPanel.class.getName());
53 private KeywordTableModel tableModel;
54 private KeywordList currentKeywordList;
59 GlobalEditListPanel() {
60 tableModel =
new KeywordTableModel();
62 customizeComponents();
65 private void customizeComponents() {
66 chRegex.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.kwReToolTip"));
67 addWordButton.setToolTipText((NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.addWordToolTip")));
68 addWordField.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.enterNewWordToolTip"));
69 exportButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.exportToFile"));
70 saveListButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip"));
71 deleteWordButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.removeSelectedMsg"));
73 keywordTable.setShowHorizontalLines(
false);
74 keywordTable.setShowVerticalLines(
false);
75 keywordTable.getParent().setBackground(keywordTable.getBackground());
76 final int width = jScrollPane1.getPreferredSize().width;
77 keywordTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
79 for (
int i = 0; i < keywordTable.getColumnCount(); i++) {
80 column = keywordTable.getColumnModel().getColumn(i);
82 column.setPreferredWidth(((
int) (width * 0.90)));
84 column.setPreferredWidth(((
int) (width * 0.10)));
88 keywordTable.setCellSelectionEnabled(
false);
89 keywordTable.setRowSelectionAllowed(
true);
91 final ListSelectionModel lsm = keywordTable.getSelectionModel();
92 lsm.addListSelectionListener(
new ListSelectionListener() {
94 public void valueChanged(ListSelectionEvent e) {
95 if (lsm.isSelectionEmpty() || currentKeywordList.isLocked() || IngestManager.getInstance().isIngestRunning()) {
96 deleteWordButton.setEnabled(
false);
98 deleteWordButton.setEnabled(
true);
105 addWordField.setComponentPopupMenu(rightClickMenu);
106 ActionListener actList =
new ActionListener() {
108 public void actionPerformed(ActionEvent e) {
109 JMenuItem jmi = (JMenuItem) e.getSource();
110 if (jmi.equals(cutMenuItem)) {
112 }
else if (jmi.equals(copyMenuItem)) {
114 }
else if (jmi.equals(pasteMenuItem)) {
115 addWordField.paste();
116 }
else if (jmi.equals(selectAllMenuItem)) {
117 addWordField.selectAll();
121 cutMenuItem.addActionListener(actList);
122 copyMenuItem.addActionListener(actList);
123 pasteMenuItem.addActionListener(actList);
124 selectAllMenuItem.addActionListener(actList);
128 IngestManager.getInstance().addIngestJobEventListener(
new PropertyChangeListener() {
130 public void propertyChange(PropertyChangeEvent evt) {
131 Object source = evt.getSource();
132 if (source instanceof String && ((String) source).equals(
"LOCAL")) {
133 EventQueue.invokeLater(
new Runnable() {
144 void setButtonStates() {
145 boolean isIngestRunning = IngestManager.getInstance().isIngestRunning();
146 boolean isListSelected = currentKeywordList != null;
149 boolean canEditList = ((isListSelected ==
true) && (isIngestRunning ==
false));
150 ingestMessagesCheckbox.setEnabled(canEditList);
151 ingestMessagesCheckbox.setSelected(currentKeywordList != null && currentKeywordList.getIngestMessages());
152 listOptionsLabel.setEnabled(canEditList);
153 listOptionsSeparator.setEnabled(canEditList);
156 boolean isListLocked = ((isListSelected ==
false) || (currentKeywordList.isLocked()));
157 boolean canAddWord = isListSelected && !isIngestRunning && !isListLocked;
158 addWordButton.setEnabled(canAddWord);
159 addWordField.setEnabled(canAddWord);
160 chRegex.setEnabled(canAddWord);
161 keywordOptionsLabel.setEnabled(canAddWord);
162 keywordOptionsSeparator.setEnabled(canAddWord);
163 deleteListButton.setEnabled(canAddWord);
166 if ((currentKeywordList == null) || (currentKeywordList.getKeywords().isEmpty())) {
167 saveListButton.setEnabled(
false);
168 exportButton.setEnabled(
false);
169 deleteWordButton.setEnabled(
false);
171 saveListButton.setEnabled(
true);
172 exportButton.setEnabled(
true);
182 @SuppressWarnings(
"unchecked")
184 private
void initComponents() {
186 rightClickMenu =
new javax.swing.JPopupMenu();
187 cutMenuItem =
new javax.swing.JMenuItem();
188 copyMenuItem =
new javax.swing.JMenuItem();
189 pasteMenuItem =
new javax.swing.JMenuItem();
190 selectAllMenuItem =
new javax.swing.JMenuItem();
191 listEditorPanel =
new javax.swing.JPanel();
192 jScrollPane1 =
new javax.swing.JScrollPane();
193 keywordTable =
new javax.swing.JTable();
194 addKeywordPanel =
new javax.swing.JPanel();
195 addWordButton =
new javax.swing.JButton();
196 addWordField =
new javax.swing.JTextField();
197 chRegex =
new javax.swing.JCheckBox();
198 deleteWordButton =
new javax.swing.JButton();
199 ingestMessagesCheckbox =
new javax.swing.JCheckBox();
200 keywordsLabel =
new javax.swing.JLabel();
201 keywordOptionsLabel =
new javax.swing.JLabel();
202 listOptionsLabel =
new javax.swing.JLabel();
203 keywordOptionsSeparator =
new javax.swing.JSeparator();
204 listOptionsSeparator =
new javax.swing.JSeparator();
205 deleteListButton =
new javax.swing.JButton();
206 saveListButton =
new javax.swing.JButton();
207 exportButton =
new javax.swing.JButton();
209 cutMenuItem.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.cutMenuItem.text"));
210 rightClickMenu.add(cutMenuItem);
212 copyMenuItem.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.copyMenuItem.text"));
213 rightClickMenu.add(copyMenuItem);
215 pasteMenuItem.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.pasteMenuItem.text"));
216 rightClickMenu.add(pasteMenuItem);
218 selectAllMenuItem.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.selectAllMenuItem.text"));
219 rightClickMenu.add(selectAllMenuItem);
221 jScrollPane1.setPreferredSize(
new java.awt.Dimension(340, 300));
223 keywordTable.setModel(tableModel);
224 keywordTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
225 keywordTable.setShowHorizontalLines(
false);
226 keywordTable.setShowVerticalLines(
false);
227 keywordTable.getTableHeader().setReorderingAllowed(
false);
228 jScrollPane1.setViewportView(keywordTable);
230 addWordButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.addWordButton.text"));
231 addWordButton.addActionListener(
new java.awt.event.ActionListener() {
232 public void actionPerformed(java.awt.event.ActionEvent evt) {
233 addWordButtonActionPerformed(evt);
237 addWordField.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.addWordField.text"));
238 addWordField.addActionListener(
new java.awt.event.ActionListener() {
239 public void actionPerformed(java.awt.event.ActionEvent evt) {
240 addWordFieldActionPerformed(evt);
244 chRegex.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.chRegex.text"));
246 deleteWordButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.deleteWordButton.text"));
247 deleteWordButton.addActionListener(
new java.awt.event.ActionListener() {
248 public void actionPerformed(java.awt.event.ActionEvent evt) {
249 deleteWordButtonActionPerformed(evt);
253 javax.swing.GroupLayout addKeywordPanelLayout =
new javax.swing.GroupLayout(addKeywordPanel);
254 addKeywordPanel.setLayout(addKeywordPanelLayout);
255 addKeywordPanelLayout.setHorizontalGroup(
256 addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
257 .addGroup(addKeywordPanelLayout.createSequentialGroup()
258 .addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
259 .addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
260 .addGroup(addKeywordPanelLayout.createSequentialGroup()
261 .addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)
262 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
263 .addComponent(addWordButton))
264 .addComponent(deleteWordButton))
265 .addComponent(chRegex, javax.swing.GroupLayout.Alignment.LEADING))
266 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
268 addKeywordPanelLayout.setVerticalGroup(
269 addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
270 .addGroup(addKeywordPanelLayout.createSequentialGroup()
272 .addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
273 .addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
274 .addComponent(addWordButton))
276 .addComponent(chRegex)
278 .addComponent(deleteWordButton)
279 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
282 ingestMessagesCheckbox.setSelected(
true);
283 ingestMessagesCheckbox.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.ingestMessagesCheckbox.text"));
284 ingestMessagesCheckbox.setToolTipText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText"));
285 ingestMessagesCheckbox.addActionListener(
new java.awt.event.ActionListener() {
286 public void actionPerformed(java.awt.event.ActionEvent evt) {
287 ingestMessagesCheckboxActionPerformed(evt);
291 keywordsLabel.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.keywordsLabel.text"));
293 keywordOptionsLabel.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.keywordOptionsLabel.text"));
295 listOptionsLabel.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.listOptionsLabel.text"));
297 deleteListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/delete16.png")));
298 deleteListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.deleteListButton.text"));
300 saveListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/save16.png")));
301 saveListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.saveListButton.text"));
303 exportButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/export16.png")));
304 exportButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.exportButton.text"));
305 exportButton.addActionListener(
new java.awt.event.ActionListener() {
306 public void actionPerformed(java.awt.event.ActionEvent evt) {
307 exportButtonActionPerformed(evt);
311 javax.swing.GroupLayout listEditorPanelLayout =
new javax.swing.GroupLayout(listEditorPanel);
312 listEditorPanel.setLayout(listEditorPanelLayout);
313 listEditorPanelLayout.setHorizontalGroup(
314 listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
315 .addGroup(listEditorPanelLayout.createSequentialGroup()
317 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
318 .addGroup(listEditorPanelLayout.createSequentialGroup()
320 .addComponent(addKeywordPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
321 .addGroup(listEditorPanelLayout.createSequentialGroup()
322 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
323 .addGroup(listEditorPanelLayout.createSequentialGroup()
324 .addComponent(listOptionsLabel)
325 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
326 .addComponent(listOptionsSeparator))
327 .addGroup(listEditorPanelLayout.createSequentialGroup()
328 .addComponent(keywordOptionsLabel)
329 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
330 .addComponent(keywordOptionsSeparator))
331 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
332 .addGroup(listEditorPanelLayout.createSequentialGroup()
333 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
334 .addComponent(keywordsLabel)
335 .addGroup(listEditorPanelLayout.createSequentialGroup()
337 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
338 .addComponent(ingestMessagesCheckbox)
339 .addGroup(listEditorPanelLayout.createSequentialGroup()
340 .addComponent(exportButton)
341 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
342 .addComponent(saveListButton)
343 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
344 .addComponent(deleteListButton)))))
345 .addGap(0, 0, Short.MAX_VALUE)))
346 .addContainerGap())))
348 listEditorPanelLayout.setVerticalGroup(
349 listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
350 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, listEditorPanelLayout.createSequentialGroup()
352 .addComponent(keywordsLabel)
353 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
354 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
356 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
357 .addGroup(listEditorPanelLayout.createSequentialGroup()
358 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
359 .addComponent(keywordOptionsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE)
360 .addComponent(keywordOptionsLabel))
362 .addComponent(addKeywordPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
364 .addComponent(listOptionsLabel))
365 .addGroup(listEditorPanelLayout.createSequentialGroup()
366 .addGap(123, 123, 123)
367 .addComponent(listOptionsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)))
368 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
369 .addComponent(ingestMessagesCheckbox)
370 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
371 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
372 .addComponent(exportButton)
373 .addComponent(saveListButton)
374 .addComponent(deleteListButton))
378 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
379 this.setLayout(layout);
380 layout.setHorizontalGroup(
381 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
382 .addComponent(listEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
384 layout.setVerticalGroup(
385 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
386 .addGroup(layout.createSequentialGroup()
387 .addComponent(listEditorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
388 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
392 private void addWordButtonActionPerformed(java.awt.event.ActionEvent evt) {
393 String newWord = addWordField.getText().trim();
394 boolean isLiteral = !chRegex.isSelected();
395 final Keyword keyword =
new Keyword(newWord, isLiteral);
397 if (newWord.equals(
"")) {
399 }
else if (currentKeywordList.hasKeyword(keyword)) {
400 KeywordSearchUtil.displayDialog(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.newKwTitle"),
401 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.addWordButtonAction.kwAlreadyExistsMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
406 boolean valid =
true;
408 Pattern.compile(newWord);
409 }
catch (PatternSyntaxException ex1) {
411 }
catch (IllegalArgumentException ex2) {
415 KeywordSearchUtil.displayDialog(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.newKwTitle"),
416 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.invalidKwMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
421 tableModel.addKeyword(keyword);
422 XmlKeywordSearchList.getCurrent().addList(currentKeywordList);
423 chRegex.setSelected(
false);
424 addWordField.setText(
"");
429 private void deleteWordButtonActionPerformed(java.awt.event.ActionEvent evt) {
430 if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.removeKwMsg"), NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.deleteWordButtonActionPerformed.delConfirmMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) {
432 tableModel.deleteSelected(keywordTable.getSelectedRows());
433 XmlKeywordSearchList.getCurrent().addList(currentKeywordList);
438 private void addWordFieldActionPerformed(java.awt.event.ActionEvent evt) {
439 addWordButtonActionPerformed(evt);
442 private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {
444 final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
445 "KeywordSearchEditListPanel.exportButtonAction.featureName.text");
447 JFileChooser chooser =
new JFileChooser();
448 final String EXTENSION =
"xml";
449 FileNameExtensionFilter filter =
new FileNameExtensionFilter(
450 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION);
451 chooser.setFileFilter(filter);
452 chooser.setSelectedFile(
new File(currentKeywordList.getName()));
453 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
455 int returnVal = chooser.showSaveDialog(
this);
456 if (returnVal == JFileChooser.APPROVE_OPTION) {
457 File selFile = chooser.getSelectedFile();
458 if (selFile == null) {
463 String fileAbs = selFile.getAbsolutePath();
464 if (!fileAbs.endsWith(
"." + EXTENSION)) {
465 fileAbs = fileAbs +
"." + EXTENSION;
466 selFile =
new File(fileAbs);
469 boolean shouldWrite =
true;
470 if (selFile.exists()) {
471 shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME,
472 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt",
473 selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
479 XmlKeywordSearchList reader = XmlKeywordSearchList.getCurrent();
481 List<KeywordList> toWrite =
new ArrayList<>();
482 toWrite.add(reader.getList(currentKeywordList.getName()));
483 final XmlKeywordSearchList exporter =
new XmlKeywordSearchList(fileAbs);
484 boolean written = exporter.saveLists(toWrite);
486 KeywordSearchUtil.displayDialog(FEATURE_NAME,
487 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"),
488 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
493 private void ingestMessagesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {
494 currentKeywordList.setIngestMessages(ingestMessagesCheckbox.isSelected());
495 XmlKeywordSearchList updater = XmlKeywordSearchList.getCurrent();
496 updater.addList(currentKeywordList);
499 private javax.swing.JPanel addKeywordPanel;
500 private javax.swing.JButton addWordButton;
501 private javax.swing.JTextField addWordField;
502 private javax.swing.JCheckBox chRegex;
503 private javax.swing.JMenuItem copyMenuItem;
504 private javax.swing.JMenuItem cutMenuItem;
505 private javax.swing.JButton deleteListButton;
506 private javax.swing.JButton deleteWordButton;
507 private javax.swing.JButton exportButton;
508 private javax.swing.JCheckBox ingestMessagesCheckbox;
509 private javax.swing.JScrollPane jScrollPane1;
510 private javax.swing.JLabel keywordOptionsLabel;
511 private javax.swing.JSeparator keywordOptionsSeparator;
512 private javax.swing.JTable keywordTable;
513 private javax.swing.JLabel keywordsLabel;
514 private javax.swing.JPanel listEditorPanel;
515 private javax.swing.JLabel listOptionsLabel;
516 private javax.swing.JSeparator listOptionsSeparator;
517 private javax.swing.JMenuItem pasteMenuItem;
518 private javax.swing.JPopupMenu rightClickMenu;
519 private javax.swing.JButton saveListButton;
520 private javax.swing.JMenuItem selectAllMenuItem;
524 public void valueChanged(ListSelectionEvent e) {
526 ListSelectionModel listSelectionModel = (ListSelectionModel) e.getSource();
527 if (!listSelectionModel.isSelectionEmpty()) {
528 int index = listSelectionModel.getMinSelectionIndex();
530 listSelectionModel.setSelectionInterval(index, index);
531 XmlKeywordSearchList loader = XmlKeywordSearchList.getCurrent();
533 currentKeywordList = loader.getListsL(
false).get(index);
537 currentKeywordList = null;
544 public void store() {
553 KeywordList getCurrentKeywordList() {
554 return currentKeywordList;
557 void setCurrentKeywordList(KeywordList list) {
558 currentKeywordList = list;
561 void addDeleteButtonActionPerformed(ActionListener l) {
562 deleteListButton.addActionListener(l);
565 void addSaveButtonActionPerformed(ActionListener l) {
566 saveListButton.addActionListener(l);
578 return currentKeywordList == null ? 0 : currentKeywordList.getKeywords().size();
583 String colName = null;
587 colName = NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.kwColName");
590 colName = NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.regExColName");
602 if (currentKeywordList == null) {
605 Keyword word = currentKeywordList.getKeywords().get(rowIndex);
606 switch (columnIndex) {
608 ret = (Object) word.getQuery();
611 ret = (Object) !word.isLiteral();
614 logger.log(Level.SEVERE,
"Invalid table column index: {0}", columnIndex);
626 public void setValueAt(Object aValue,
int rowIndex,
int columnIndex) {
634 void addKeyword(Keyword keyword) {
635 if (!currentKeywordList.hasKeyword(keyword)) {
636 currentKeywordList.getKeywords().add(keyword);
638 fireTableDataChanged();
642 fireTableDataChanged();
646 void deleteSelected(
int[] selected) {
647 List<Keyword> words = currentKeywordList.getKeywords();
648 Arrays.sort(selected);
649 for (
int arrayi = selected.length - 1; arrayi >= 0; arrayi--) {
650 words.remove(selected[arrayi]);
boolean isCellEditable(int rowIndex, int columnIndex)
void setValueAt(Object aValue, int rowIndex, int columnIndex)
String getColumnName(int column)
Class<?> getColumnClass(int c)
Object getValueAt(int rowIndex, int columnIndex)