19 package org.sleuthkit.autopsy.keywordsearch;
21 import java.awt.EventQueue;
22 import java.awt.event.ActionListener;
23 import java.awt.event.KeyEvent;
24 import java.beans.PropertyChangeEvent;
25 import java.beans.PropertyChangeListener;
27 import java.util.ArrayList;
28 import java.util.List;
29 import javax.swing.JFileChooser;
30 import javax.swing.JOptionPane;
31 import javax.swing.event.ListSelectionEvent;
32 import javax.swing.event.ListSelectionListener;
33 import javax.swing.filechooser.FileNameExtensionFilter;
34 import javax.swing.table.AbstractTableModel;
35 import org.netbeans.spi.options.OptionsPanelController;
36 import org.openide.util.NbBundle;
43 class GlobalListsManagementPanel
extends javax.swing.JPanel implements OptionsPanel {
45 private static final long serialVersionUID = 1L;
46 private final KeywordListTableModel tableModel;
50 this.globalListSettingsPanel = gsp;
51 tableModel =
new KeywordListTableModel();
53 customizeComponents();
56 private void customizeComponents() {
57 listsTable.setAutoscrolls(
true);
58 listsTable.setTableHeader(null);
59 listsTable.setShowHorizontalLines(
false);
60 listsTable.setShowVerticalLines(
false);
61 exportButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.exportToFile"));
62 copyListButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip"));
63 listsTable.getParent().setBackground(listsTable.getBackground());
65 listsTable.setCellSelectionEnabled(
false);
66 listsTable.setRowSelectionAllowed(
true);
70 listsTable.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
72 public void valueChanged(ListSelectionEvent e) {
73 globalListSettingsPanel.setFocusOnKeywordTextBox();
78 IngestManager.getInstance().addIngestJobEventListener(
new PropertyChangeListener() {
80 public void propertyChange(PropertyChangeEvent evt) {
81 Object source = evt.getSource();
82 if (source instanceof String && ((String) source).equals(
"LOCAL")) {
83 EventQueue.invokeLater(() -> {
84 globalListSettingsPanel.setFocusOnKeywordTextBox();
92 void addDeleteButtonActionPerformed(ActionListener l) {
93 deleteListButton.addActionListener(l);
96 void addRenameButtonActionPerformed(ActionListener l) {
97 renameListButton.addActionListener(l);
100 void addCopyButtonActionPerformed(ActionListener l) {
101 copyListButton.addActionListener(l);
108 private void newKeywordListAction() {
109 XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
110 String listName =
"";
112 listName = (String) JOptionPane.showInputDialog(null, NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKwListTitle"),
113 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKeywordListMsg"), JOptionPane.PLAIN_MESSAGE, null, null, listName);
115 if (listName == null || listName.trim().isEmpty()) {
118 boolean shouldAdd =
false;
119 if (writer.listExists(listName)) {
120 if (writer.getList(listName).isEditable()) {
121 boolean replace = KeywordSearchUtil.displayConfirmDialog(
122 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKeywordListMsg"),
123 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.newKeywordListDescription", listName),
124 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
129 boolean replace = KeywordSearchUtil.displayConfirmDialog(
130 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKeywordListMsg"),
131 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.newKeywordListDescription2", listName),
132 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
141 writer.addList(listName,
new ArrayList<>());
147 for (
int i = 0; i < listsTable.getRowCount(); i++) {
148 if (listsTable.getValueAt(i, 0).equals(listName)) {
149 listsTable.getSelectionModel().addSelectionInterval(i, i);
157 void setButtonStates() {
158 boolean isIngestRunning = IngestManager.getInstance().isIngestRunning();
159 boolean isListSelected = !listsTable.getSelectionModel().isSelectionEmpty();
160 boolean canEditList = isListSelected && !isIngestRunning;
161 boolean multiSelection =
false;
162 if (isListSelected) {
163 multiSelection = (listsTable.getSelectionModel().getMaxSelectionIndex() != listsTable.getSelectionModel().getMinSelectionIndex());
166 importButton.setEnabled(!isIngestRunning);
168 deleteListButton.setEnabled(canEditList);
169 renameListButton.setEnabled(canEditList);
170 renameListButton.setEnabled(canEditList && !multiSelection);
172 copyListButton.setEnabled(isListSelected);
173 copyListButton.setEnabled(isListSelected && !multiSelection);
174 exportButton.setEnabled(isListSelected);
182 @SuppressWarnings(
"unchecked")
184 private
void initComponents() {
186 jScrollPane1 =
new javax.swing.JScrollPane();
187 listsTable =
new javax.swing.JTable();
188 newListButton =
new javax.swing.JButton();
189 importButton =
new javax.swing.JButton();
190 keywordListsLabel =
new javax.swing.JLabel();
191 exportButton =
new javax.swing.JButton();
192 copyListButton =
new javax.swing.JButton();
193 deleteListButton =
new javax.swing.JButton();
194 renameListButton =
new javax.swing.JButton();
196 setMinimumSize(
new java.awt.Dimension(250, 0));
198 listsTable.setModel(tableModel);
199 listsTable.setMaximumSize(
new java.awt.Dimension(30000, 30000));
200 listsTable.setShowHorizontalLines(
false);
201 listsTable.setShowVerticalLines(
false);
202 listsTable.getTableHeader().setReorderingAllowed(
false);
203 listsTable.addKeyListener(
new java.awt.event.KeyAdapter() {
204 public void keyPressed(java.awt.event.KeyEvent evt) {
205 listsTableKeyPressed(evt);
208 jScrollPane1.setViewportView(listsTable);
210 newListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/add16.png")));
211 newListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.newListButton.text"));
212 newListButton.setIconTextGap(2);
213 newListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
214 newListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
215 newListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
216 newListButton.setPreferredSize(
new java.awt.Dimension(111, 25));
217 newListButton.addActionListener(
new java.awt.event.ActionListener() {
218 public void actionPerformed(java.awt.event.ActionEvent evt) {
219 newListButtonActionPerformed(evt);
223 importButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/import16.png")));
224 importButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.importButton.text"));
225 importButton.setIconTextGap(2);
226 importButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
227 importButton.setMaximumSize(
new java.awt.Dimension(111, 25));
228 importButton.setMinimumSize(
new java.awt.Dimension(111, 25));
229 importButton.setPreferredSize(
new java.awt.Dimension(111, 25));
230 importButton.addActionListener(
new java.awt.event.ActionListener() {
231 public void actionPerformed(java.awt.event.ActionEvent evt) {
232 importButtonActionPerformed(evt);
236 keywordListsLabel.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.keywordListsLabel.text"));
238 exportButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/export16.png")));
239 exportButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.exportButton.text"));
240 exportButton.setIconTextGap(2);
241 exportButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
242 exportButton.setMaximumSize(
new java.awt.Dimension(111, 25));
243 exportButton.setMinimumSize(
new java.awt.Dimension(111, 25));
244 exportButton.setPreferredSize(
new java.awt.Dimension(111, 25));
245 exportButton.addActionListener(
new java.awt.event.ActionListener() {
246 public void actionPerformed(java.awt.event.ActionEvent evt) {
247 exportButtonActionPerformed(evt);
251 copyListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/new16.png")));
252 copyListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.copyListButton.text"));
253 copyListButton.setIconTextGap(2);
254 copyListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
255 copyListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
256 copyListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
257 copyListButton.setPreferredSize(
new java.awt.Dimension(111, 25));
258 copyListButton.addActionListener(
new java.awt.event.ActionListener() {
259 public void actionPerformed(java.awt.event.ActionEvent evt) {
260 copyListButtonActionPerformed(evt);
264 deleteListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/delete16.png")));
265 deleteListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.deleteListButton.text"));
266 deleteListButton.setIconTextGap(2);
267 deleteListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
268 deleteListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
269 deleteListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
270 deleteListButton.setPreferredSize(
new java.awt.Dimension(111, 25));
271 deleteListButton.addActionListener(
new java.awt.event.ActionListener() {
272 public void actionPerformed(java.awt.event.ActionEvent evt) {
273 deleteListButtonActionPerformed(evt);
277 renameListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/edit16.png")));
278 renameListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.renameListButton.text"));
279 renameListButton.setIconTextGap(2);
280 renameListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
281 renameListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
282 renameListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
283 renameListButton.setPreferredSize(
new java.awt.Dimension(111, 25));
284 renameListButton.addActionListener(
new java.awt.event.ActionListener() {
285 public void actionPerformed(java.awt.event.ActionEvent evt) {
286 renameListButtonActionPerformed(evt);
290 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
291 this.setLayout(layout);
292 layout.setHorizontalGroup(
293 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
294 .addGroup(layout.createSequentialGroup()
296 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
297 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE)
298 .addGroup(layout.createSequentialGroup()
299 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
300 .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
301 .addComponent(copyListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
303 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
304 .addComponent(importButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
305 .addComponent(renameListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
307 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
308 .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
309 .addComponent(deleteListButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
310 .addGap(0, 0, Short.MAX_VALUE))
311 .addComponent(keywordListsLabel))
315 layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {copyListButton, deleteListButton, exportButton, importButton, newListButton, renameListButton});
317 layout.setVerticalGroup(
318 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
319 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
321 .addComponent(keywordListsLabel)
322 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
323 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
324 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
325 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
326 .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
327 .addComponent(renameListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
328 .addComponent(deleteListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
330 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
331 .addComponent(importButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
332 .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
333 .addComponent(copyListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
337 layout.linkSize(javax.swing.SwingConstants.VERTICAL,
new java.awt.Component[] {copyListButton, deleteListButton, exportButton, importButton, newListButton, renameListButton});
341 private void newListButtonActionPerformed(java.awt.event.ActionEvent evt) {
342 newKeywordListAction();
343 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
344 globalListSettingsPanel.setFocusOnKeywordTextBox();
347 private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {
349 JFileChooser chooser =
new JFileChooser();
350 final String[] AUTOPSY_EXTENSIONS =
new String[]{
"xml"};
351 final String[] ENCASE_EXTENSIONS =
new String[]{
"txt"};
352 FileNameExtensionFilter autopsyFilter =
new FileNameExtensionFilter(
353 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.fileExtensionFilterLbl"), AUTOPSY_EXTENSIONS);
354 FileNameExtensionFilter encaseFilter =
new FileNameExtensionFilter(
355 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.fileExtensionFilterLb2"), ENCASE_EXTENSIONS);
356 chooser.addChoosableFileFilter(autopsyFilter);
357 chooser.addChoosableFileFilter(encaseFilter);
358 chooser.setAcceptAllFileFilterUsed(
false);
359 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
361 String listName = null;
362 int returnVal = chooser.showOpenDialog(
this);
363 if (returnVal == JFileChooser.APPROVE_OPTION) {
364 File selFile = chooser.getSelectedFile();
365 if (selFile == null) {
370 String fileAbs = selFile.getAbsolutePath();
372 final KeywordSearchList reader;
374 if (KeywordSearchUtil.isXMLList(fileAbs)) {
375 reader =
new XmlKeywordSearchList(fileAbs);
377 reader =
new EnCaseKeywordSearchList(fileAbs);
380 if (!reader.load()) {
381 KeywordSearchUtil.displayDialog(
382 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(
this.getClass(),
"KeywordSearch.importListFileDialogMsg", fileAbs), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
386 List<KeywordList> toImport = reader.getListsL();
387 List<KeywordList> toImportConfirmed =
new ArrayList<>();
389 final XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
391 for (KeywordList list : toImport) {
393 listName = list.getName();
394 if (writer.listExists(listName)) {
396 if (toImport.size() == 1) {
397 options =
new String[]{NbBundle.getMessage(this.getClass(),
"KeywordSearch.yesOwMsg"),
398 NbBundle.getMessage(this.getClass(),
"KeywordSearch.cancelImportMsg")};
400 options =
new String[]{NbBundle.getMessage(this.getClass(),
"KeywordSearch.yesOwMsg"),
401 NbBundle.getMessage(this.getClass(),
"KeywordSearch.noSkipMsg"),
402 NbBundle.getMessage(this.getClass(),
"KeywordSearch.cancelImportMsg")};
404 int choice = JOptionPane.showOptionDialog(
this,
405 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.overwriteListPrompt", listName),
406 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.importOwConflict"),
407 JOptionPane.YES_NO_CANCEL_OPTION,
408 JOptionPane.QUESTION_MESSAGE,
412 if (choice == JOptionPane.OK_OPTION) {
413 toImportConfirmed.add(list);
414 }
else if (choice == JOptionPane.CANCEL_OPTION) {
420 toImportConfirmed.add(list);
425 if (toImportConfirmed.isEmpty()) {
429 if (!writer.writeLists(toImportConfirmed)) {
430 KeywordSearchUtil.displayDialog(
431 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(
this.getClass(),
"KeywordSearch.kwListFailImportMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
438 if (listName != null) {
439 for (
int i = 0; i < listsTable.getRowCount(); i++) {
440 if (listsTable.getValueAt(i, 0).equals(listName)) {
441 listsTable.getSelectionModel().addSelectionInterval(i, i);
445 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
447 private void listsTableKeyPressed(java.awt.event.KeyEvent evt) {
448 if (evt.getKeyCode() == KeyEvent.VK_DELETE && !IngestManager.getInstance().isIngestRunning() && !listsTable.getSelectionModel().isSelectionEmpty()) {
449 if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(
this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.title"), NbBundle.getMessage(
this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.body"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) {
451 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
459 private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {
461 final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
462 "KeywordSearchEditListPanel.exportButtonAction.featureName.text");
464 JFileChooser chooser =
new JFileChooser();
465 final String EXTENSION =
"xml";
466 FileNameExtensionFilter filter =
new FileNameExtensionFilter(
467 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION);
468 chooser.setFileFilter(filter);
469 String listName = listsTable.getValueAt(listsTable.getSelectedRow(), 0).toString();
471 chooser.setSelectedFile(
new File(listName));
472 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
474 int returnVal = chooser.showSaveDialog(
this);
475 if (returnVal == JFileChooser.APPROVE_OPTION) {
476 File selFile = chooser.getSelectedFile();
477 if (selFile == null) {
482 String fileAbs = selFile.getAbsolutePath();
483 if (!fileAbs.endsWith(
"." + EXTENSION)) {
484 fileAbs = fileAbs +
"." + EXTENSION;
485 selFile =
new File(fileAbs);
488 boolean shouldWrite =
true;
489 if (selFile.exists()) {
490 shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME,
491 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt",
492 selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
498 XmlKeywordSearchList reader = XmlKeywordSearchList.getCurrent();
500 List<KeywordList> toWrite =
new ArrayList<>();
502 for (
int index : listsTable.getSelectedRows()) {
503 toWrite.add(reader.getList(listsTable.getValueAt(index, 0).toString()));
506 final XmlKeywordSearchList exporter =
new XmlKeywordSearchList(fileAbs);
507 boolean written = exporter.saveLists(toWrite);
509 KeywordSearchUtil.displayDialog(FEATURE_NAME,
510 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"),
511 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
516 private void copyListButtonActionPerformed(java.awt.event.ActionEvent evt) {
517 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
520 private void deleteListButtonActionPerformed(java.awt.event.ActionEvent evt) {
521 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
524 private void renameListButtonActionPerformed(java.awt.event.ActionEvent evt) {
525 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
529 private javax.swing.JButton copyListButton;
530 private javax.swing.JButton deleteListButton;
531 private javax.swing.JButton exportButton;
532 private javax.swing.JButton importButton;
533 private javax.swing.JScrollPane jScrollPane1;
534 private javax.swing.JLabel keywordListsLabel;
535 private javax.swing.JTable listsTable;
536 private javax.swing.JButton newListButton;
537 private javax.swing.JButton renameListButton;
541 public void store() {
547 listsTable.clearSelection();
554 void deleteSelected() {
555 int[] selected = listsTable.getSelectedRows();
556 if (selected.length == 0) {
559 tableModel.deleteSelected(selected);
564 private static final long serialVersionUID = 1L;
566 private final XmlKeywordSearchList
listsHandle = XmlKeywordSearchList.getCurrent();
575 return listsHandle.getNumberLists(
false);
580 return NbBundle.getMessage(this.getClass(),
"KeywordSearchListsManagementPanel.getColName.text");
585 return listsHandle.getListNames(
false).get(rowIndex);
594 public void setValueAt(Object aValue,
int rowIndex,
int columnIndex) {
595 throw new UnsupportedOperationException(
596 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.setValueAt.exception.msg"));
605 void deleteSelected(
int[] selected) {
606 List<String> toDel =
new ArrayList<>();
607 for (
int i : selected) {
610 for (String del : toDel) {
611 listsHandle.deleteList(del);
617 fireTableDataChanged();
621 void addListSelectionListener(ListSelectionListener l) {
622 listsTable.getSelectionModel().addListSelectionListener(l);
final XmlKeywordSearchList listsHandle
Object getValueAt(int rowIndex, int columnIndex)
void setValueAt(Object aValue, int rowIndex, int columnIndex)
Class<?> getColumnClass(int c)
String getColumnName(int column)
boolean isCellEditable(int rowIndex, int columnIndex)