19 package org.sleuthkit.autopsy.keywordsearch;
21 import java.awt.EventQueue;
22 import java.awt.event.ActionListener;
23 import java.beans.PropertyChangeEvent;
24 import java.beans.PropertyChangeListener;
26 import java.util.ArrayList;
27 import java.util.Arrays;
28 import java.util.List;
29 import java.util.logging.Level;
30 import java.util.regex.Pattern;
31 import java.util.regex.PatternSyntaxException;
32 import javax.swing.JFileChooser;
33 import javax.swing.JTable;
34 import javax.swing.ListSelectionModel;
35 import javax.swing.event.ListSelectionEvent;
36 import javax.swing.event.ListSelectionListener;
37 import javax.swing.filechooser.FileNameExtensionFilter;
38 import javax.swing.table.AbstractTableModel;
39 import javax.swing.table.TableColumn;
40 import org.netbeans.spi.options.OptionsPanelController;
41 import org.openide.util.NbBundle;
49 class GlobalEditListPanel
extends javax.swing.JPanel implements ListSelectionListener, OptionsPanel {
51 private static final Logger logger = Logger.getLogger(GlobalEditListPanel.class.getName());
52 private static final long serialVersionUID = 1L;
53 private final KeywordTableModel tableModel;
54 private KeywordList currentKeywordList;
59 GlobalEditListPanel() {
60 tableModel =
new KeywordTableModel();
62 customizeComponents();
65 private void customizeComponents() {
66 newKeywordsButton.setToolTipText((NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.addWordToolTip")));
67 exportButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.exportToFile"));
68 saveListButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip"));
69 deleteWordButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.removeSelectedMsg"));
71 keywordTable.getParent().setBackground(keywordTable.getBackground());
72 final int width = jScrollPane1.getPreferredSize().width;
73 keywordTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
75 for (
int i = 0; i < keywordTable.getColumnCount(); i++) {
76 column = keywordTable.getColumnModel().getColumn(i);
78 column.setPreferredWidth(((
int) (width * 0.90)));
80 column.setPreferredWidth(((
int) (width * 0.10)));
83 keywordTable.setCellSelectionEnabled(
false);
84 keywordTable.setRowSelectionAllowed(
true);
86 final ListSelectionModel lsm = keywordTable.getSelectionModel();
87 lsm.addListSelectionListener(
new ListSelectionListener() {
89 public void valueChanged(ListSelectionEvent e) {
90 if (lsm.isSelectionEmpty() || currentKeywordList.isEditable() || IngestManager.getInstance().isIngestRunning()) {
91 deleteWordButton.setEnabled(
false);
93 deleteWordButton.setEnabled(
true);
100 IngestManager.getInstance().addIngestJobEventListener(
new PropertyChangeListener() {
102 public void propertyChange(PropertyChangeEvent evt) {
103 Object source = evt.getSource();
104 if (source instanceof String && ((String) source).equals(
"LOCAL")) {
105 EventQueue.invokeLater(() -> {
113 void setButtonStates() {
114 boolean isIngestRunning = IngestManager.getInstance().isIngestRunning();
115 boolean isListSelected = currentKeywordList != null;
118 boolean canEditList = ((isListSelected ==
true) && (isIngestRunning ==
false));
119 ingestMessagesCheckbox.setEnabled(canEditList);
120 ingestMessagesCheckbox.setSelected(currentKeywordList != null && currentKeywordList.getIngestMessages());
121 listOptionsLabel.setEnabled(canEditList);
122 listOptionsSeparator.setEnabled(canEditList);
125 boolean isListLocked = ((isListSelected ==
false) || (currentKeywordList.isEditable()));
126 boolean canAddWord = isListSelected && !isIngestRunning && !isListLocked;
127 newKeywordsButton.setEnabled(canAddWord);
128 keywordOptionsLabel.setEnabled(canAddWord);
129 keywordOptionsSeparator.setEnabled(canAddWord);
130 deleteListButton.setEnabled(canAddWord);
133 if ((currentKeywordList == null) || (currentKeywordList.getKeywords().isEmpty())) {
134 saveListButton.setEnabled(
false);
135 exportButton.setEnabled(
false);
136 deleteWordButton.setEnabled(
false);
138 saveListButton.setEnabled(
true);
139 exportButton.setEnabled(
true);
149 @SuppressWarnings(
"unchecked")
151 private
void initComponents() {
153 listEditorPanel =
new javax.swing.JPanel();
154 jScrollPane1 =
new javax.swing.JScrollPane();
155 keywordTable =
new javax.swing.JTable();
156 addKeywordPanel =
new javax.swing.JPanel();
157 deleteWordButton =
new javax.swing.JButton();
158 newKeywordsButton =
new javax.swing.JButton();
159 ingestMessagesCheckbox =
new javax.swing.JCheckBox();
160 keywordsLabel =
new javax.swing.JLabel();
161 keywordOptionsLabel =
new javax.swing.JLabel();
162 listOptionsLabel =
new javax.swing.JLabel();
163 keywordOptionsSeparator =
new javax.swing.JSeparator();
164 listOptionsSeparator =
new javax.swing.JSeparator();
165 deleteListButton =
new javax.swing.JButton();
166 saveListButton =
new javax.swing.JButton();
167 exportButton =
new javax.swing.JButton();
169 setMinimumSize(
new java.awt.Dimension(0, 0));
171 listEditorPanel.setMinimumSize(
new java.awt.Dimension(0, 0));
173 jScrollPane1.setPreferredSize(
new java.awt.Dimension(340, 300));
175 keywordTable.setModel(tableModel);
176 keywordTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
177 keywordTable.setGridColor(
new java.awt.Color(153, 153, 153));
178 keywordTable.setMaximumSize(
new java.awt.Dimension(30000, 30000));
179 keywordTable.getTableHeader().setReorderingAllowed(
false);
180 jScrollPane1.setViewportView(keywordTable);
182 deleteWordButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/delete16.png")));
183 deleteWordButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.deleteWordButton.text"));
184 deleteWordButton.addActionListener(
new java.awt.event.ActionListener() {
185 public void actionPerformed(java.awt.event.ActionEvent evt) {
186 deleteWordButtonActionPerformed(evt);
190 newKeywordsButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/new16.png")));
191 newKeywordsButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"GlobalEditListPanel.newKeywordsButton.text"));
192 newKeywordsButton.addActionListener(
new java.awt.event.ActionListener() {
193 public void actionPerformed(java.awt.event.ActionEvent evt) {
194 newKeywordsButtonActionPerformed(evt);
198 javax.swing.GroupLayout addKeywordPanelLayout =
new javax.swing.GroupLayout(addKeywordPanel);
199 addKeywordPanel.setLayout(addKeywordPanelLayout);
200 addKeywordPanelLayout.setHorizontalGroup(
201 addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
202 .addGroup(addKeywordPanelLayout.createSequentialGroup()
203 .addComponent(newKeywordsButton)
204 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
205 .addComponent(deleteWordButton)
206 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
208 addKeywordPanelLayout.setVerticalGroup(
209 addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
210 .addGroup(addKeywordPanelLayout.createSequentialGroup()
212 .addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
213 .addComponent(deleteWordButton)
214 .addComponent(newKeywordsButton))
218 ingestMessagesCheckbox.setSelected(
true);
219 ingestMessagesCheckbox.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.ingestMessagesCheckbox.text"));
220 ingestMessagesCheckbox.setToolTipText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText"));
221 ingestMessagesCheckbox.addActionListener(
new java.awt.event.ActionListener() {
222 public void actionPerformed(java.awt.event.ActionEvent evt) {
223 ingestMessagesCheckboxActionPerformed(evt);
227 keywordsLabel.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.keywordsLabel.text"));
229 keywordOptionsLabel.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.keywordOptionsLabel.text"));
231 listOptionsLabel.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.listOptionsLabel.text"));
233 deleteListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/delete16.png")));
234 deleteListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.deleteListButton.text"));
235 deleteListButton.addActionListener(
new java.awt.event.ActionListener() {
236 public void actionPerformed(java.awt.event.ActionEvent evt) {
237 deleteListButtonActionPerformed(evt);
241 saveListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/save16.png")));
242 saveListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.saveListButton.text"));
244 exportButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/export16.png")));
245 exportButton.setText(
org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class,
"KeywordSearchEditListPanel.exportButton.text"));
246 exportButton.addActionListener(
new java.awt.event.ActionListener() {
247 public void actionPerformed(java.awt.event.ActionEvent evt) {
248 exportButtonActionPerformed(evt);
252 javax.swing.GroupLayout listEditorPanelLayout =
new javax.swing.GroupLayout(listEditorPanel);
253 listEditorPanel.setLayout(listEditorPanelLayout);
254 listEditorPanelLayout.setHorizontalGroup(
255 listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
256 .addGroup(listEditorPanelLayout.createSequentialGroup()
258 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
259 .addGroup(listEditorPanelLayout.createSequentialGroup()
261 .addComponent(addKeywordPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
262 .addGroup(listEditorPanelLayout.createSequentialGroup()
263 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
264 .addGroup(listEditorPanelLayout.createSequentialGroup()
265 .addComponent(listOptionsLabel)
266 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
267 .addComponent(listOptionsSeparator))
268 .addGroup(listEditorPanelLayout.createSequentialGroup()
269 .addComponent(keywordOptionsLabel)
270 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
271 .addComponent(keywordOptionsSeparator))
272 .addGroup(listEditorPanelLayout.createSequentialGroup()
274 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE))
275 .addGroup(listEditorPanelLayout.createSequentialGroup()
276 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
277 .addComponent(keywordsLabel)
278 .addGroup(listEditorPanelLayout.createSequentialGroup()
280 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
281 .addComponent(ingestMessagesCheckbox)
282 .addGroup(listEditorPanelLayout.createSequentialGroup()
283 .addComponent(exportButton)
284 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
285 .addComponent(saveListButton)
286 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
287 .addComponent(deleteListButton)))))
288 .addGap(0, 0, Short.MAX_VALUE)))
289 .addContainerGap())))
291 listEditorPanelLayout.setVerticalGroup(
292 listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
293 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, listEditorPanelLayout.createSequentialGroup()
295 .addComponent(keywordsLabel)
296 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
297 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
299 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
300 .addGroup(listEditorPanelLayout.createSequentialGroup()
301 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
302 .addComponent(keywordOptionsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE)
303 .addComponent(keywordOptionsLabel))
305 .addComponent(addKeywordPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
307 .addComponent(listOptionsLabel))
308 .addGroup(listEditorPanelLayout.createSequentialGroup()
309 .addGap(123, 123, 123)
310 .addComponent(listOptionsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)))
311 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
312 .addComponent(ingestMessagesCheckbox)
313 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
314 .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
315 .addComponent(exportButton)
316 .addComponent(saveListButton)
317 .addComponent(deleteListButton))
321 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
322 this.setLayout(layout);
323 layout.setHorizontalGroup(
324 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
325 .addComponent(listEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
327 layout.setVerticalGroup(
328 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
329 .addGroup(layout.createSequentialGroup()
330 .addComponent(listEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
335 private void deleteWordButtonActionPerformed(java.awt.event.ActionEvent evt) {
336 if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.removeKwMsg"), NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.deleteWordButtonActionPerformed.delConfirmMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) {
338 tableModel.deleteSelected(keywordTable.getSelectedRows());
339 XmlKeywordSearchList.getCurrent().addList(currentKeywordList);
341 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
345 private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {
347 final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
348 "KeywordSearchEditListPanel.exportButtonAction.featureName.text");
350 JFileChooser chooser =
new JFileChooser();
351 final String EXTENSION =
"xml";
352 FileNameExtensionFilter filter =
new FileNameExtensionFilter(
353 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION);
354 chooser.setFileFilter(filter);
355 chooser.setSelectedFile(
new File(currentKeywordList.getName()));
356 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
358 int returnVal = chooser.showSaveDialog(
this);
359 if (returnVal == JFileChooser.APPROVE_OPTION) {
360 File selFile = chooser.getSelectedFile();
361 if (selFile == null) {
366 String fileAbs = selFile.getAbsolutePath();
367 if (!fileAbs.endsWith(
"." + EXTENSION)) {
368 fileAbs = fileAbs +
"." + EXTENSION;
369 selFile =
new File(fileAbs);
372 boolean shouldWrite =
true;
373 if (selFile.exists()) {
374 shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME,
375 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt",
376 selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
382 XmlKeywordSearchList reader = XmlKeywordSearchList.getCurrent();
384 List<KeywordList> toWrite =
new ArrayList<>();
385 toWrite.add(reader.getList(currentKeywordList.getName()));
386 final XmlKeywordSearchList exporter =
new XmlKeywordSearchList(fileAbs);
387 boolean written = exporter.saveLists(toWrite);
389 KeywordSearchUtil.displayDialog(FEATURE_NAME,
390 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"),
391 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
396 private void ingestMessagesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {
397 currentKeywordList.setIngestMessages(ingestMessagesCheckbox.isSelected());
398 XmlKeywordSearchList updater = XmlKeywordSearchList.getCurrent();
399 updater.addList(currentKeywordList);
400 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
403 private void deleteListButtonActionPerformed(java.awt.event.ActionEvent evt) {
404 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
407 private void newKeywordsButtonActionPerformed(java.awt.event.ActionEvent evt) {
408 String keywordsToRedisplay =
"";
409 AddKeywordsDialog dialog =
new AddKeywordsDialog();
416 dialog.setInitialKeywordList(keywordsToRedisplay);
422 keywordsToRedisplay =
"";
424 if(!dialog.getKeywords().isEmpty()){
427 for(String newWord:dialog.getKeywords()){
428 if (newWord.isEmpty()) {
432 final Keyword keyword =
new Keyword(newWord, !dialog.isKeywordRegex(), dialog.isKeywordExact());
433 if (currentKeywordList.hasKeyword(keyword)) {
439 boolean valid =
true;
441 Pattern.compile(newWord);
442 }
catch (PatternSyntaxException ex1) {
444 }
catch (IllegalArgumentException ex2) {
450 keywordsToRedisplay += newWord +
"\n";
456 tableModel.addKeyword(keyword);
459 XmlKeywordSearchList.getCurrent().addList(currentKeywordList);
460 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
462 if((badCount > 0) || (dupeCount > 0)){
468 KeywordSearchUtil.DIALOG_MESSAGE_TYPE level = KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO;
471 summary += NbBundle.getMessage(GlobalEditListPanel.class,
"GlobalEditListPanel.keywordsAddedPlural.text", goodCount) +
"\n";
473 summary += NbBundle.getMessage(GlobalEditListPanel.class,
"GlobalEditListPanel.keywordsAdded.text", goodCount) +
"\n";
478 summary += NbBundle.getMessage(GlobalEditListPanel.class,
"GlobalEditListPanel.keywordDupesSkippedPlural.text", dupeCount) +
"\n";
480 summary += NbBundle.getMessage(GlobalEditListPanel.class,
"GlobalEditListPanel.keywordDupesSkipped.text", dupeCount) +
"\n";
482 level = KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN;
486 summary += NbBundle.getMessage(GlobalEditListPanel.class,
"GlobalEditListPanel.keywordErrorsPlural.text", badCount) +
"\n";
488 summary += NbBundle.getMessage(GlobalEditListPanel.class,
"GlobalEditListPanel.keywordErrors.text", badCount) +
"\n";
490 level = KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR;
492 KeywordSearchUtil.displayDialog(NbBundle.getMessage(
this.getClass(),
"GlobalEditListPanel.addKeywordResults.text"),
497 setFocusOnKeywordTextBox();
502 private javax.swing.JPanel addKeywordPanel;
503 private javax.swing.JButton deleteListButton;
504 private javax.swing.JButton deleteWordButton;
505 private javax.swing.JButton exportButton;
506 private javax.swing.JCheckBox ingestMessagesCheckbox;
507 private javax.swing.JScrollPane jScrollPane1;
508 private javax.swing.JLabel keywordOptionsLabel;
509 private javax.swing.JSeparator keywordOptionsSeparator;
510 private javax.swing.JTable keywordTable;
511 private javax.swing.JLabel keywordsLabel;
512 private javax.swing.JPanel listEditorPanel;
513 private javax.swing.JLabel listOptionsLabel;
514 private javax.swing.JSeparator listOptionsSeparator;
515 private javax.swing.JButton newKeywordsButton;
516 private javax.swing.JButton saveListButton;
520 public void valueChanged(ListSelectionEvent e) {
522 ListSelectionModel listSelectionModel = (ListSelectionModel) e.getSource();
523 if (!listSelectionModel.isSelectionEmpty()) {
524 int index = listSelectionModel.getMinSelectionIndex();
526 listSelectionModel.setSelectionInterval(index, index);
527 XmlKeywordSearchList loader = XmlKeywordSearchList.getCurrent();
529 currentKeywordList = loader.getListsL(
false).get(index);
533 currentKeywordList = null;
540 public void store() {
549 KeywordList getCurrentKeywordList() {
550 return currentKeywordList;
553 void setCurrentKeywordList(KeywordList list) {
554 currentKeywordList = list;
557 void addDeleteButtonActionPerformed(ActionListener l) {
558 deleteListButton.addActionListener(l);
561 void addSaveButtonActionPerformed(ActionListener l) {
562 saveListButton.addActionListener(l);
574 return currentKeywordList == null ? 0 : currentKeywordList.getKeywords().size();
579 String colName = null;
583 colName = NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.kwColName");
586 colName = NbBundle.getMessage(this.getClass(),
"KeywordSearch.typeColLbl");
597 if (currentKeywordList == null) {
600 Keyword word = currentKeywordList.getKeywords().get(rowIndex);
601 switch (columnIndex) {
603 ret = word.getSearchTerm();
606 ret = word.getSearchTermType();
609 logger.log(Level.SEVERE,
"Invalid table column index: {0}", columnIndex);
621 public void setValueAt(Object aValue,
int rowIndex,
int columnIndex) {
629 void addKeyword(Keyword keyword) {
630 if (!currentKeywordList.hasKeyword(keyword)) {
631 currentKeywordList.getKeywords().add(keyword);
633 fireTableDataChanged();
637 fireTableDataChanged();
641 void deleteSelected(
int[] selected) {
642 List<Keyword> words = currentKeywordList.getKeywords();
643 Arrays.sort(selected);
644 for (
int arrayi = selected.length - 1; arrayi >= 0; arrayi--) {
645 words.remove(selected[arrayi]);
654 void setFocusOnKeywordTextBox() {
655 newKeywordsButton.requestFocus();
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)