19package org.sleuthkit.autopsy.keywordsearch;
21import java.awt.EventQueue;
22import java.awt.event.ActionListener;
23import java.awt.event.KeyEvent;
24import java.beans.PropertyChangeEvent;
25import java.beans.PropertyChangeListener;
27import java.nio.file.Paths;
28import java.util.ArrayList;
30import javax.swing.JFileChooser;
31import javax.swing.JOptionPane;
32import javax.swing.event.ListSelectionEvent;
33import javax.swing.event.ListSelectionListener;
34import javax.swing.filechooser.FileNameExtensionFilter;
35import javax.swing.table.AbstractTableModel;
36import org.netbeans.spi.options.OptionsPanelController;
37import org.openide.util.NbBundle;
38import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
39import org.sleuthkit.autopsy.coreutils.ModuleSettings;
40import org.sleuthkit.autopsy.coreutils.PlatformUtil;
41import org.sleuthkit.autopsy.guiutils.SimpleTableCellRenderer;
42import org.sleuthkit.autopsy.ingest.IngestManager;
47@SuppressWarnings(
"PMD.SingularField")
48class GlobalListsManagementPanel extends javax.swing.JPanel implements
OptionsPanel {
50 private static final long serialVersionUID = 1L;
51 private final KeywordListTableModel tableModel;
52 private final org.sleuthkit.autopsy.keywordsearch.GlobalListSettingsPanel globalListSettingsPanel;
53 private final static String LAST_KEYWORD_LIST_PATH_KEY =
"KeyWordImport_List";
55 GlobalListsManagementPanel(org.sleuthkit.autopsy.keywordsearch.GlobalListSettingsPanel gsp) {
56 this.globalListSettingsPanel = gsp;
57 tableModel =
new KeywordListTableModel();
59 customizeComponents();
62 private void customizeComponents() {
63 listsTable.setAutoscrolls(
true);
64 listsTable.setTableHeader(
null);
65 listsTable.setShowHorizontalLines(
false);
66 listsTable.setShowVerticalLines(
false);
68 exportButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.exportToFile"));
69 copyListButton.setToolTipText(NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip"));
70 listsTable.getParent().setBackground(listsTable.getBackground());
72 listsTable.setCellSelectionEnabled(
false);
73 listsTable.setRowSelectionAllowed(
true);
77 listsTable.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
79 public void valueChanged(ListSelectionEvent e) {
80 globalListSettingsPanel.setFocusOnKeywordTextBox();
87 public void propertyChange(PropertyChangeEvent evt) {
88 Object source = evt.getSource();
89 if (source instanceof String && ((String) source).equals(
"LOCAL")) {
90 EventQueue.invokeLater(() -> {
91 globalListSettingsPanel.setFocusOnKeywordTextBox();
99 void addDeleteButtonActionPerformed(ActionListener l) {
100 deleteListButton.addActionListener(l);
103 void addRenameButtonActionPerformed(ActionListener l) {
104 renameListButton.addActionListener(l);
107 void addCopyButtonActionPerformed(ActionListener l) {
108 copyListButton.addActionListener(l);
115 private void newKeywordListAction() {
116 XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
117 String listName =
"";
119 listName = (String) JOptionPane.showInputDialog(
this, NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKwListTitle"),
120 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKeywordListMsg"), JOptionPane.PLAIN_MESSAGE,
null,
null, listName);
122 if (listName ==
null || listName.trim().isEmpty()) {
125 boolean shouldAdd =
false;
126 if (writer.listExists(listName)) {
127 if (writer.getList(listName).isEditable()) {
128 boolean replace = KeywordSearchUtil.displayConfirmDialog(
129 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKeywordListMsg"),
130 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.newKeywordListDescription", listName),
131 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
136 boolean replace = KeywordSearchUtil.displayConfirmDialog(
137 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.newKeywordListMsg"),
138 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.newKeywordListDescription2", listName),
139 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
148 writer.addList(listName,
new ArrayList<>());
154 for (
int i = 0; i < listsTable.getRowCount(); i++) {
155 if (listsTable.getValueAt(i, 0).equals(listName)) {
156 listsTable.getSelectionModel().addSelectionInterval(i, i);
164 void setButtonStates() {
166 boolean isListSelected = !listsTable.getSelectionModel().isSelectionEmpty();
167 boolean canEditList = isListSelected && !isIngestRunning;
168 boolean multiSelection =
false;
169 if (isListSelected) {
170 multiSelection = (listsTable.getSelectionModel().getMaxSelectionIndex() != listsTable.getSelectionModel().getMinSelectionIndex());
173 importButton.setEnabled(!isIngestRunning);
175 deleteListButton.setEnabled(canEditList);
176 renameListButton.setEnabled(canEditList);
177 renameListButton.setEnabled(canEditList && !multiSelection);
179 copyListButton.setEnabled(isListSelected);
180 copyListButton.setEnabled(isListSelected && !multiSelection);
181 exportButton.setEnabled(isListSelected);
189 @SuppressWarnings(
"unchecked")
191 private
void initComponents() {
193 jScrollPane1 =
new javax.swing.JScrollPane();
194 listsTable =
new javax.swing.JTable();
195 newListButton =
new javax.swing.JButton();
196 importButton =
new javax.swing.JButton();
197 keywordListsLabel =
new javax.swing.JLabel();
198 exportButton =
new javax.swing.JButton();
199 copyListButton =
new javax.swing.JButton();
200 deleteListButton =
new javax.swing.JButton();
201 renameListButton =
new javax.swing.JButton();
203 setMinimumSize(
new java.awt.Dimension(250, 0));
205 listsTable.setModel(tableModel);
206 listsTable.setMaximumSize(
new java.awt.Dimension(30000, 30000));
207 listsTable.setShowHorizontalLines(
false);
208 listsTable.setShowVerticalLines(
false);
209 listsTable.getTableHeader().setReorderingAllowed(
false);
210 listsTable.addKeyListener(
new java.awt.event.KeyAdapter() {
211 public void keyPressed(java.awt.event.KeyEvent evt) {
212 listsTableKeyPressed(evt);
215 jScrollPane1.setViewportView(listsTable);
217 newListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/add16.png")));
218 newListButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.newListButton.text"));
219 newListButton.setIconTextGap(2);
220 newListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
221 newListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
222 newListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
223 newListButton.addActionListener(
new java.awt.event.ActionListener() {
224 public void actionPerformed(java.awt.event.ActionEvent evt) {
225 newListButtonActionPerformed(evt);
229 importButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/import16.png")));
230 importButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.importButton.text"));
231 importButton.setIconTextGap(2);
232 importButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
233 importButton.setMaximumSize(
new java.awt.Dimension(111, 25));
234 importButton.setMinimumSize(
new java.awt.Dimension(111, 25));
235 importButton.addActionListener(
new java.awt.event.ActionListener() {
236 public void actionPerformed(java.awt.event.ActionEvent evt) {
237 importButtonActionPerformed(evt);
241 keywordListsLabel.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.keywordListsLabel.text"));
243 exportButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/export16.png")));
244 exportButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.exportButton.text"));
245 exportButton.setIconTextGap(2);
246 exportButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
247 exportButton.setMaximumSize(
new java.awt.Dimension(111, 25));
248 exportButton.setMinimumSize(
new java.awt.Dimension(111, 25));
249 exportButton.addActionListener(
new java.awt.event.ActionListener() {
250 public void actionPerformed(java.awt.event.ActionEvent evt) {
251 exportButtonActionPerformed(evt);
255 copyListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/new16.png")));
256 copyListButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.copyListButton.text"));
257 copyListButton.setIconTextGap(2);
258 copyListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
259 copyListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
260 copyListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
261 copyListButton.addActionListener(
new java.awt.event.ActionListener() {
262 public void actionPerformed(java.awt.event.ActionEvent evt) {
263 copyListButtonActionPerformed(evt);
267 deleteListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/delete16.png")));
268 deleteListButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.deleteListButton.text"));
269 deleteListButton.setIconTextGap(2);
270 deleteListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
271 deleteListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
272 deleteListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
273 deleteListButton.addActionListener(
new java.awt.event.ActionListener() {
274 public void actionPerformed(java.awt.event.ActionEvent evt) {
275 deleteListButtonActionPerformed(evt);
279 renameListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/edit16.png")));
280 renameListButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class,
"GlobalListsManagementPanel.renameListButton.text"));
281 renameListButton.setIconTextGap(2);
282 renameListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
283 renameListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
284 renameListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
285 renameListButton.addActionListener(
new java.awt.event.ActionListener() {
286 public void actionPerformed(java.awt.event.ActionEvent evt) {
287 renameListButtonActionPerformed(evt);
291 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
292 this.setLayout(layout);
293 layout.setHorizontalGroup(
294 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
295 .addGroup(layout.createSequentialGroup()
297 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
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 .addComponent(keywordListsLabel)
311 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
312 .addGap(12, 12, Short.MAX_VALUE))
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, 354, 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) {
348 String lastBaseDirectory = Paths.get(PlatformUtil.getUserConfigDirectory(),
"KeywordList").toString();
349 if (ModuleSettings.settingExists(ModuleSettings.MAIN_SETTINGS, LAST_KEYWORD_LIST_PATH_KEY)) {
350 lastBaseDirectory = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_KEYWORD_LIST_PATH_KEY);
352 File importFolder =
new File(lastBaseDirectory);
353 JFileChooser chooser =
new JFileChooser();
354 chooser.setCurrentDirectory(importFolder);
355 final String[] AUTOPSY_EXTENSIONS =
new String[]{
"xml"};
356 final String[] ENCASE_EXTENSIONS =
new String[]{
"txt"};
357 FileNameExtensionFilter autopsyFilter =
new FileNameExtensionFilter(
358 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.fileExtensionFilterLbl"), AUTOPSY_EXTENSIONS);
359 FileNameExtensionFilter encaseFilter =
new FileNameExtensionFilter(
360 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.fileExtensionFilterLb2"), ENCASE_EXTENSIONS);
361 chooser.addChoosableFileFilter(autopsyFilter);
362 chooser.addChoosableFileFilter(encaseFilter);
363 chooser.setAcceptAllFileFilterUsed(
false);
364 chooser.setMultiSelectionEnabled(
true);
365 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
367 String listName =
null;
368 int returnVal = chooser.showOpenDialog(
this);
369 if (returnVal == JFileChooser.APPROVE_OPTION) {
370 File[] selFiles = chooser.getSelectedFiles();
372 for (File file : selFiles) {
378 String fileAbs = file.getAbsolutePath();
379 final KeywordSearchList reader;
381 if (KeywordSearchUtil.isXMLList(fileAbs)) {
382 reader =
new XmlKeywordSearchList(fileAbs);
384 reader =
new EnCaseKeywordSearchList(fileAbs);
387 if (!reader.load()) {
388 KeywordSearchUtil.displayDialog(
389 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(
this.getClass(),
"KeywordSearch.importListFileDialogMsg", fileAbs), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
393 List<KeywordList> toImport = reader.getListsL();
394 List<KeywordList> toImportConfirmed =
new ArrayList<>();
396 final XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
398 for (KeywordList list : toImport) {
400 listName = list.getName();
401 if (writer.listExists(listName)) {
403 if (toImport.size() == 1) {
404 options =
new String[]{NbBundle.getMessage(this.getClass(),
"KeywordSearch.yesOwMsg"),
405 NbBundle.getMessage(this.getClass(),
"KeywordSearch.cancelImportMsg")};
407 options =
new String[]{NbBundle.getMessage(this.getClass(),
"KeywordSearch.yesOwMsg"),
408 NbBundle.getMessage(this.getClass(),
"KeywordSearch.noSkipMsg"),
409 NbBundle.getMessage(this.getClass(),
"KeywordSearch.cancelImportMsg")};
411 int choice = JOptionPane.showOptionDialog(
this,
412 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.overwriteListPrompt", listName),
413 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.importOwConflict"),
414 JOptionPane.YES_NO_CANCEL_OPTION,
415 JOptionPane.QUESTION_MESSAGE,
419 if (choice == JOptionPane.OK_OPTION) {
420 toImportConfirmed.add(list);
421 }
else if (choice == JOptionPane.CANCEL_OPTION) {
427 toImportConfirmed.add(list);
432 if (toImportConfirmed.isEmpty()) {
436 if (!writer.writeLists(toImportConfirmed)) {
437 KeywordSearchUtil.displayDialog(
438 NbBundle.getMessage(
this.getClass(),
"KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(
this.getClass(),
"KeywordSearch.kwListFailImportMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
440 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_KEYWORD_LIST_PATH_KEY, file.getParent());
446 if (listName !=
null) {
447 for (
int i = 0; i < listsTable.getRowCount(); i++) {
448 if (listsTable.getValueAt(i, 0).equals(listName)) {
449 listsTable.getSelectionModel().addSelectionInterval(i, i);
453 firePropertyChange(OptionsPanelController.PROP_CHANGED,
null,
null);
455 private void listsTableKeyPressed(java.awt.event.KeyEvent evt) {
456 if (evt.getKeyCode() == KeyEvent.VK_DELETE && !IngestManager.getInstance().isIngestRunning() && !listsTable.getSelectionModel().isSelectionEmpty()) {
457 if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(
this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.title"), NbBundle.getMessage(
this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.body"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) {
459 firePropertyChange(OptionsPanelController.PROP_CHANGED,
null,
null);
467 private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {
469 final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
470 "KeywordSearchEditListPanel.exportButtonAction.featureName.text");
472 JFileChooser chooser =
new JFileChooser();
473 final String EXTENSION =
"xml";
474 FileNameExtensionFilter filter =
new FileNameExtensionFilter(
475 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION);
476 chooser.setFileFilter(filter);
477 String listName = listsTable.getValueAt(listsTable.getSelectedRow(), 0).toString();
479 chooser.setSelectedFile(
new File(listName));
480 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
482 int returnVal = chooser.showSaveDialog(
this);
483 if (returnVal == JFileChooser.APPROVE_OPTION) {
484 File selFile = chooser.getSelectedFile();
485 if (selFile ==
null) {
490 String fileAbs = selFile.getAbsolutePath();
491 if (!fileAbs.endsWith(
"." + EXTENSION)) {
492 fileAbs = fileAbs +
"." + EXTENSION;
493 selFile =
new File(fileAbs);
496 boolean shouldWrite =
true;
497 if (selFile.exists()) {
498 shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME,
499 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt",
500 selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
506 XmlKeywordSearchList reader = XmlKeywordSearchList.getCurrent();
508 List<KeywordList> toWrite =
new ArrayList<>();
510 for (
int index : listsTable.getSelectedRows()) {
511 toWrite.add(reader.getList(listsTable.getValueAt(index, 0).toString()));
514 final XmlKeywordSearchList exporter =
new XmlKeywordSearchList(fileAbs);
515 boolean written = exporter.saveLists(toWrite);
517 KeywordSearchUtil.displayDialog(FEATURE_NAME,
518 NbBundle.getMessage(
this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"),
519 KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
524 private void copyListButtonActionPerformed(java.awt.event.ActionEvent evt) {
525 firePropertyChange(OptionsPanelController.PROP_CHANGED,
null,
null);
528 private void deleteListButtonActionPerformed(java.awt.event.ActionEvent evt) {
529 firePropertyChange(OptionsPanelController.PROP_CHANGED,
null,
null);
532 private void renameListButtonActionPerformed(java.awt.event.ActionEvent evt) {
533 firePropertyChange(OptionsPanelController.PROP_CHANGED,
null,
null);
537 private javax.swing.JButton copyListButton;
538 private javax.swing.JButton deleteListButton;
539 private javax.swing.JButton exportButton;
540 private javax.swing.JButton importButton;
541 private javax.swing.JScrollPane jScrollPane1;
542 private javax.swing.JLabel keywordListsLabel;
543 private javax.swing.JTable listsTable;
544 private javax.swing.JButton newListButton;
545 private javax.swing.JButton renameListButton;
549 public void store() {
555 listsTable.clearSelection();
562 void deleteSelected() {
563 int[] selected = listsTable.getSelectedRows();
564 if (selected.length == 0) {
567 tableModel.deleteSelected(selected);
574 private final XmlKeywordSearchList
listsHandle = XmlKeywordSearchList.getCurrent();
588 return NbBundle.getMessage(this.getClass(),
"KeywordSearchListsManagementPanel.getColName.text");
593 return listsHandle.getListNames(
false).get(rowIndex);
602 public void setValueAt(Object aValue,
int rowIndex,
int columnIndex) {
603 throw new UnsupportedOperationException(
604 NbBundle.getMessage(
this.getClass(),
"KeywordSearchListsManagementPanel.setValueAt.exception.msg"));
613 void deleteSelected(
int[] selected) {
614 List<String> toDel =
new ArrayList<>();
615 for (
int i : selected) {
616 toDel.add(getValueAt(i, 0).toString());
618 for (String del : toDel) {
619 listsHandle.deleteList(del);
625 fireTableDataChanged();
629 void addListSelectionListener(ListSelectionListener l) {
630 listsTable.getSelectionModel().addListSelectionListener(l);
static synchronized IngestManager getInstance()
boolean isIngestRunning()
void addIngestJobEventListener(final PropertyChangeListener listener)
String getColumnName(int column)
void setValueAt(Object aValue, int rowIndex, int columnIndex)
boolean isCellEditable(int rowIndex, int columnIndex)
final XmlKeywordSearchList listsHandle
Object getValueAt(int rowIndex, int columnIndex)
Class<?> getColumnClass(int c)
static final long serialVersionUID