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.nio.file.Paths;
28 import java.util.ArrayList;
29 import java.util.List;
30 import javax.swing.JFileChooser;
31 import javax.swing.JOptionPane;
32 import javax.swing.event.ListSelectionEvent;
33 import javax.swing.event.ListSelectionListener;
34 import javax.swing.filechooser.FileNameExtensionFilter;
35 import javax.swing.table.AbstractTableModel;
36 import org.netbeans.spi.options.OptionsPanelController;
37 import org.openide.util.NbBundle;
46 @SuppressWarnings(
"PMD.SingularField")
47 class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPanel {
49 private static final long serialVersionUID = 1L;
50 private final KeywordListTableModel tableModel;
52 private final static String LAST_KEYWORD_LIST_PATH_KEY =
"KeyWordImport_List";
55 this.globalListSettingsPanel = gsp;
56 tableModel =
new KeywordListTableModel();
58 customizeComponents();
61 private void customizeComponents() {
62 listsTable.setAutoscrolls(
true);
63 listsTable.setTableHeader(null);
64 listsTable.setShowHorizontalLines(
false);
65 listsTable.setShowVerticalLines(
false);
66 exportButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.exportToFile"));
67 copyListButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip"));
68 listsTable.getParent().setBackground(listsTable.getBackground());
70 listsTable.setCellSelectionEnabled(
false);
71 listsTable.setRowSelectionAllowed(
true);
75 listsTable.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
77 public void valueChanged(ListSelectionEvent e) {
78 globalListSettingsPanel.setFocusOnKeywordTextBox();
83 IngestManager.getInstance().addIngestJobEventListener(
new PropertyChangeListener() {
85 public void propertyChange(PropertyChangeEvent evt) {
86 Object source = evt.getSource();
87 if (source instanceof String && ((String) source).equals(
"LOCAL")) {
88 EventQueue.invokeLater(() -> {
89 globalListSettingsPanel.setFocusOnKeywordTextBox();
97 void addDeleteButtonActionPerformed(ActionListener l) {
98 deleteListButton.addActionListener(l);
101 void addRenameButtonActionPerformed(ActionListener l) {
102 renameListButton.addActionListener(l);
105 void addCopyButtonActionPerformed(ActionListener l) {
106 copyListButton.addActionListener(l);
113 private void newKeywordListAction() {
114 XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
115 String listName =
"";
117 listName = (String) JOptionPane.showInputDialog(
this, NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKwListTitle"),
118 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKeywordListMsg"), JOptionPane.PLAIN_MESSAGE, null, null, listName);
120 if (listName == null || listName.trim().isEmpty()) {
123 boolean shouldAdd =
false;
124 if (writer.listExists(listName)) {
125 if (writer.getList(listName).isEditable()) {
126 boolean replace = KeywordSearchUtil.displayConfirmDialog(
127 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKeywordListMsg"),
128 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.newKeywordListDescription", listName),
129 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
134 boolean replace = KeywordSearchUtil.displayConfirmDialog(
135 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKeywordListMsg"),
136 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.newKeywordListDescription2", listName),
137 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
146 writer.addList(listName,
new ArrayList<>());
152 for (
int i = 0; i < listsTable.getRowCount(); i++) {
153 if (listsTable.getValueAt(i, 0).equals(listName)) {
154 listsTable.getSelectionModel().addSelectionInterval(i, i);
162 void setButtonStates() {
163 boolean isIngestRunning = IngestManager.getInstance().isIngestRunning();
164 boolean isListSelected = !listsTable.getSelectionModel().isSelectionEmpty();
165 boolean canEditList = isListSelected && !isIngestRunning;
166 boolean multiSelection =
false;
167 if (isListSelected) {
168 multiSelection = (listsTable.getSelectionModel().getMaxSelectionIndex() != listsTable.getSelectionModel().getMinSelectionIndex());
171 importButton.setEnabled(!isIngestRunning);
173 deleteListButton.setEnabled(canEditList);
174 renameListButton.setEnabled(canEditList);
175 renameListButton.setEnabled(canEditList && !multiSelection);
177 copyListButton.setEnabled(isListSelected);
178 copyListButton.setEnabled(isListSelected && !multiSelection);
179 exportButton.setEnabled(isListSelected);
187 @SuppressWarnings(
"unchecked")
189 private
void initComponents() {
191 jScrollPane1 =
new javax.swing.JScrollPane();
192 listsTable =
new javax.swing.JTable();
193 newListButton =
new javax.swing.JButton();
194 importButton =
new javax.swing.JButton();
195 keywordListsLabel =
new javax.swing.JLabel();
196 exportButton =
new javax.swing.JButton();
197 copyListButton =
new javax.swing.JButton();
198 deleteListButton =
new javax.swing.JButton();
199 renameListButton =
new javax.swing.JButton();
201 setMinimumSize(
new java.awt.Dimension(250, 0));
203 listsTable.setModel(tableModel);
204 listsTable.setMaximumSize(
new java.awt.Dimension(30000, 30000));
205 listsTable.setShowHorizontalLines(
false);
206 listsTable.setShowVerticalLines(
false);
207 listsTable.getTableHeader().setReorderingAllowed(
false);
208 listsTable.addKeyListener(
new java.awt.event.KeyAdapter() {
209 public void keyPressed(java.awt.event.KeyEvent evt) {
210 listsTableKeyPressed(evt);
213 jScrollPane1.setViewportView(listsTable);
215 newListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/add16.png")));
216 newListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.newListButton.text"));
217 newListButton.setIconTextGap(2);
218 newListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
219 newListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
220 newListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
221 newListButton.addActionListener(
new java.awt.event.ActionListener() {
222 public void actionPerformed(java.awt.event.ActionEvent evt) {
223 newListButtonActionPerformed(evt);
227 importButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/import16.png")));
228 importButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.importButton.text"));
229 importButton.setIconTextGap(2);
230 importButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
231 importButton.setMaximumSize(
new java.awt.Dimension(111, 25));
232 importButton.setMinimumSize(
new java.awt.Dimension(111, 25));
233 importButton.addActionListener(
new java.awt.event.ActionListener() {
234 public void actionPerformed(java.awt.event.ActionEvent evt) {
235 importButtonActionPerformed(evt);
239 keywordListsLabel.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.keywordListsLabel.text"));
241 exportButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/export16.png")));
242 exportButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.exportButton.text"));
243 exportButton.setIconTextGap(2);
244 exportButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
245 exportButton.setMaximumSize(
new java.awt.Dimension(111, 25));
246 exportButton.setMinimumSize(
new java.awt.Dimension(111, 25));
247 exportButton.addActionListener(
new java.awt.event.ActionListener() {
248 public void actionPerformed(java.awt.event.ActionEvent evt) {
249 exportButtonActionPerformed(evt);
253 copyListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/new16.png")));
254 copyListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.copyListButton.text"));
255 copyListButton.setIconTextGap(2);
256 copyListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
257 copyListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
258 copyListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
259 copyListButton.addActionListener(
new java.awt.event.ActionListener() {
260 public void actionPerformed(java.awt.event.ActionEvent evt) {
261 copyListButtonActionPerformed(evt);
265 deleteListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/delete16.png")));
266 deleteListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.deleteListButton.text"));
267 deleteListButton.setIconTextGap(2);
268 deleteListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
269 deleteListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
270 deleteListButton.setMinimumSize(
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.addActionListener(
new java.awt.event.ActionListener() {
284 public void actionPerformed(java.awt.event.ActionEvent evt) {
285 renameListButtonActionPerformed(evt);
289 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
290 this.setLayout(layout);
291 layout.setHorizontalGroup(
292 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
293 .addGroup(layout.createSequentialGroup()
295 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
296 .addGroup(layout.createSequentialGroup()
297 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
298 .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
299 .addComponent(copyListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
301 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
302 .addComponent(importButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
303 .addComponent(renameListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
305 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
306 .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
307 .addComponent(deleteListButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
308 .addComponent(keywordListsLabel)
309 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
310 .addGap(12, 12, Short.MAX_VALUE))
313 layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {copyListButton, deleteListButton, exportButton, importButton, newListButton, renameListButton});
315 layout.setVerticalGroup(
316 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
317 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
319 .addComponent(keywordListsLabel)
320 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
321 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE)
322 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
323 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
324 .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
325 .addComponent(renameListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
326 .addComponent(deleteListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
328 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
329 .addComponent(importButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
330 .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
331 .addComponent(copyListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
335 layout.linkSize(javax.swing.SwingConstants.VERTICAL,
new java.awt.Component[] {copyListButton, deleteListButton, exportButton, importButton, newListButton, renameListButton});
339 private void newListButtonActionPerformed(java.awt.event.ActionEvent evt) {
340 newKeywordListAction();
341 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
342 globalListSettingsPanel.setFocusOnKeywordTextBox();
345 private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {
346 String lastBaseDirectory = Paths.get(PlatformUtil.getUserConfigDirectory(),
"KeywordList").toString();
347 if (ModuleSettings.settingExists(ModuleSettings.MAIN_SETTINGS, LAST_KEYWORD_LIST_PATH_KEY)) {
348 lastBaseDirectory = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_KEYWORD_LIST_PATH_KEY);
350 File importFolder =
new File(lastBaseDirectory);
351 JFileChooser chooser =
new JFileChooser();
352 chooser.setCurrentDirectory(importFolder);
353 final String[] AUTOPSY_EXTENSIONS =
new String[]{
"xml"};
354 final String[] ENCASE_EXTENSIONS =
new String[]{
"txt"};
355 FileNameExtensionFilter autopsyFilter =
new FileNameExtensionFilter(
356 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.fileExtensionFilterLbl"), AUTOPSY_EXTENSIONS);
357 FileNameExtensionFilter encaseFilter =
new FileNameExtensionFilter(
358 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.fileExtensionFilterLb2"), ENCASE_EXTENSIONS);
359 chooser.addChoosableFileFilter(autopsyFilter);
360 chooser.addChoosableFileFilter(encaseFilter);
361 chooser.setAcceptAllFileFilterUsed(
false);
362 chooser.setMultiSelectionEnabled(
true);
363 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
365 String listName = null;
366 int returnVal = chooser.showOpenDialog(
this);
367 if (returnVal == JFileChooser.APPROVE_OPTION) {
368 File[] selFiles = chooser.getSelectedFiles();
370 for (File file : selFiles) {
376 String fileAbs = file.getAbsolutePath();
377 final KeywordSearchList reader;
379 if (KeywordSearchUtil.isXMLList(fileAbs)) {
380 reader =
new XmlKeywordSearchList(fileAbs);
382 reader =
new EnCaseKeywordSearchList(fileAbs);
385 if (!reader.load()) {
386 KeywordSearchUtil.displayDialog(
387 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(
this.getClass(),
"KeywordSearch.importListFileDialogMsg", fileAbs), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
391 List<KeywordList> toImport = reader.getListsL();
392 List<KeywordList> toImportConfirmed =
new ArrayList<>();
394 final XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
396 for (KeywordList list : toImport) {
398 listName = list.getName();
399 if (writer.listExists(listName)) {
401 if (toImport.size() == 1) {
402 options =
new String[]{NbBundle.getMessage(this.getClass(),
"KeywordSearch.yesOwMsg"),
403 NbBundle.getMessage(this.getClass(),
"KeywordSearch.cancelImportMsg")};
405 options =
new String[]{NbBundle.getMessage(this.getClass(),
"KeywordSearch.yesOwMsg"),
406 NbBundle.getMessage(this.getClass(),
"KeywordSearch.noSkipMsg"),
407 NbBundle.getMessage(this.getClass(),
"KeywordSearch.cancelImportMsg")};
409 int choice = JOptionPane.showOptionDialog(
this,
410 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.overwriteListPrompt", listName),
411 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.importOwConflict"),
412 JOptionPane.YES_NO_CANCEL_OPTION,
413 JOptionPane.QUESTION_MESSAGE,
417 if (choice == JOptionPane.OK_OPTION) {
418 toImportConfirmed.add(list);
419 }
else if (choice == JOptionPane.CANCEL_OPTION) {
425 toImportConfirmed.add(list);
430 if (toImportConfirmed.isEmpty()) {
434 if (!writer.writeLists(toImportConfirmed)) {
435 KeywordSearchUtil.displayDialog(
436 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(
this.getClass(),
"KeywordSearch.kwListFailImportMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
438 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_KEYWORD_LIST_PATH_KEY, file.getParent());
444 if (listName != null) {
445 for (
int i = 0; i < listsTable.getRowCount(); i++) {
446 if (listsTable.getValueAt(i, 0).equals(listName)) {
447 listsTable.getSelectionModel().addSelectionInterval(i, i);
451 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
453 private void listsTableKeyPressed(java.awt.event.KeyEvent evt) {
454 if (evt.getKeyCode() == KeyEvent.VK_DELETE && !IngestManager.getInstance().isIngestRunning() && !listsTable.getSelectionModel().isSelectionEmpty()) {
455 if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(
this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.title"), NbBundle.getMessage(
this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.body"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) {
457 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
465 private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {
467 final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
468 "KeywordSearchEditListPanel.exportButtonAction.featureName.text");
470 JFileChooser chooser =
new JFileChooser();
471 final String EXTENSION =
"xml";
472 FileNameExtensionFilter filter =
new FileNameExtensionFilter(
473 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION);
474 chooser.setFileFilter(filter);
475 String listName = listsTable.getValueAt(listsTable.getSelectedRow(), 0).toString();
477 chooser.setSelectedFile(
new File(listName));
478 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
480 int returnVal = chooser.showSaveDialog(
this);
481 if (returnVal == JFileChooser.APPROVE_OPTION) {
482 File selFile = chooser.getSelectedFile();
483 if (selFile == null) {
488 String fileAbs = selFile.getAbsolutePath();
489 if (!fileAbs.endsWith(
"." + EXTENSION)) {
490 fileAbs = fileAbs +
"." + EXTENSION;
491 selFile =
new File(fileAbs);
494 boolean shouldWrite =
true;
495 if (selFile.exists()) {
496 shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME,
497 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt",
498 selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
504 XmlKeywordSearchList reader = XmlKeywordSearchList.getCurrent();
506 List<KeywordList> toWrite =
new ArrayList<>();
508 for (
int index : listsTable.getSelectedRows()) {
509 toWrite.add(reader.getList(listsTable.getValueAt(index, 0).toString()));
512 final XmlKeywordSearchList exporter =
new XmlKeywordSearchList(fileAbs);
513 boolean written = exporter.saveLists(toWrite);
515 KeywordSearchUtil.displayDialog(FEATURE_NAME,
516 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"),
517 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
522 private void copyListButtonActionPerformed(java.awt.event.ActionEvent evt) {
523 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
526 private void deleteListButtonActionPerformed(java.awt.event.ActionEvent evt) {
527 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
530 private void renameListButtonActionPerformed(java.awt.event.ActionEvent evt) {
531 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
535 private javax.swing.JButton copyListButton;
536 private javax.swing.JButton deleteListButton;
537 private javax.swing.JButton exportButton;
538 private javax.swing.JButton importButton;
539 private javax.swing.JScrollPane jScrollPane1;
540 private javax.swing.JLabel keywordListsLabel;
541 private javax.swing.JTable listsTable;
542 private javax.swing.JButton newListButton;
543 private javax.swing.JButton renameListButton;
547 public void store() {
553 listsTable.clearSelection();
560 void deleteSelected() {
561 int[] selected = listsTable.getSelectedRows();
562 if (selected.length == 0) {
565 tableModel.deleteSelected(selected);
570 private static final long serialVersionUID = 1L;
572 private final XmlKeywordSearchList listsHandle = XmlKeywordSearchList.getCurrent();
581 return listsHandle.getNumberLists(
false);
586 return NbBundle.getMessage(this.getClass(),
"KeywordSearchListsManagementPanel.getColName.text");
591 return listsHandle.getListNames(
false).get(rowIndex);
600 public void setValueAt(Object aValue,
int rowIndex,
int columnIndex) {
601 throw new UnsupportedOperationException(
602 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.setValueAt.exception.msg"));
607 return getValueAt(0, c).getClass();
611 void deleteSelected(
int[] selected) {
612 List<String> toDel =
new ArrayList<>();
613 for (
int i : selected) {
614 toDel.add(getValueAt(i, 0).toString());
616 for (String del : toDel) {
617 listsHandle.deleteList(del);
623 fireTableDataChanged();
627 void addListSelectionListener(ListSelectionListener l) {
628 listsTable.getSelectionModel().addListSelectionListener(l);
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)