mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Merge pull request #2406 from wishdasher/AUT-2250_keyword_list_substring
Add substring keyword option to keyword lists
This commit is contained in:
commit
73f47588da
@ -29,6 +29,7 @@ KeywordSearchEditListPanel.pasteMenuItem.text=Paste
|
|||||||
KeywordSearchEditListPanel.copyMenuItem.text=Copy
|
KeywordSearchEditListPanel.copyMenuItem.text=Copy
|
||||||
KeywordSearchEditListPanel.exportButton.text=Export List
|
KeywordSearchEditListPanel.exportButton.text=Export List
|
||||||
KeywordSearchEditListPanel.deleteListButton.text=Delete List
|
KeywordSearchEditListPanel.deleteListButton.text=Delete List
|
||||||
|
KeywordSearchEditListPanel.emptyKeyword.text=Empty keyword
|
||||||
KeywordSearchListsManagementPanel.newListButton.text=New List
|
KeywordSearchListsManagementPanel.newListButton.text=New List
|
||||||
KeywordSearchListsManagementPanel.importButton.text=Import List
|
KeywordSearchListsManagementPanel.importButton.text=Import List
|
||||||
KeywordSearchListsViewerPanel.searchAddButton.text=Search
|
KeywordSearchListsViewerPanel.searchAddButton.text=Search
|
||||||
@ -101,7 +102,6 @@ KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel=Keyword L
|
|||||||
KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt=File {0} exists, overwrite?
|
KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt=File {0} exists, overwrite?
|
||||||
KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg=Keyword lists exported
|
KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg=Keyword lists exported
|
||||||
KeywordSearchEditListPanel.kwColName=Keyword
|
KeywordSearchEditListPanel.kwColName=Keyword
|
||||||
KeywordSearchEditListPanel.exportButtonActionPerformed.regExColName=RegEx
|
|
||||||
KeywordSearchEditListPanel.addKeyword.message=Add a new word to the keyword search list\:
|
KeywordSearchEditListPanel.addKeyword.message=Add a new word to the keyword search list\:
|
||||||
KeywordSearchEditListPanel.addKeyword.title=New keyword
|
KeywordSearchEditListPanel.addKeyword.title=New keyword
|
||||||
KeywordSearchFilterNode.getFileActions.openExternViewActLbl=Open in External Viewer
|
KeywordSearchFilterNode.getFileActions.openExternViewActLbl=Open in External Viewer
|
||||||
@ -132,7 +132,7 @@ KeywordSearchListsViewerPanel.initIngest.ongoingIngestMsg=Files Indexed\: {0} (i
|
|||||||
KeywordSearchListsViewerPanel.initIngest.fileIndexCtMsg=Files Indexed\: {0}
|
KeywordSearchListsViewerPanel.initIngest.fileIndexCtMsg=Files Indexed\: {0}
|
||||||
KeywordSearch.selectedColLbl=Selected
|
KeywordSearch.selectedColLbl=Selected
|
||||||
KeywordSearch.nameColLbl=Name
|
KeywordSearch.nameColLbl=Name
|
||||||
KeywordSearch.regExColLbl=RegEx
|
KeywordSearch.typeColLbl=Keyword Type
|
||||||
KeywordSearchQueryManager.execute.exeWinTitle=Keyword search {0} - {1}
|
KeywordSearchQueryManager.execute.exeWinTitle=Keyword search {0} - {1}
|
||||||
KeywordSearch.newKeywordListMsg=New Keyword List
|
KeywordSearch.newKeywordListMsg=New Keyword List
|
||||||
KeywordSearch.importListFileDialogMsg=Error importing keyword list from file {0}
|
KeywordSearch.importListFileDialogMsg=Error importing keyword list from file {0}
|
||||||
@ -290,3 +290,8 @@ RawText.getText.error.msg=Error getting text
|
|||||||
GlobalListsManagementPanel.newListButton.text=New List
|
GlobalListsManagementPanel.newListButton.text=New List
|
||||||
GlobalListsManagementPanel.importButton.text=Import List
|
GlobalListsManagementPanel.importButton.text=Import List
|
||||||
GlobalListsManagementPanel.keywordListsLabel.text=Keyword Lists:
|
GlobalListsManagementPanel.keywordListsLabel.text=Keyword Lists:
|
||||||
|
NewKeywordPanel.regexButton.text=Regular Expression
|
||||||
|
NewKeywordPanel.exactButton.text=Exact Match
|
||||||
|
NewKeywordPanel.substringButton.text=Substring Match
|
||||||
|
NewKeywordPanel.keywordTextField.text=
|
||||||
|
NewKeywordPanel.newKeywordLabel.text=Enter a new keyword:
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2015 Basis Technology Corp.
|
* Copyright 2011-2015 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -39,9 +39,6 @@ import org.openide.util.NbBundle;
|
|||||||
import org.openide.util.actions.SystemAction;
|
import org.openide.util.actions.SystemAction;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import static javax.swing.SwingConstants.CENTER;
|
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Viewer panel widget for keyword lists that is used in the ingest config and
|
* Viewer panel widget for keyword lists that is used in the ingest config and
|
||||||
@ -93,10 +90,9 @@ class DropdownListSearchPanel extends KeywordSearchPanel {
|
|||||||
for (int i = 0; i < keywordsTable.getColumnCount(); i++) {
|
for (int i = 0; i < keywordsTable.getColumnCount(); i++) {
|
||||||
column = keywordsTable.getColumnModel().getColumn(i);
|
column = keywordsTable.getColumnModel().getColumn(i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
column.setPreferredWidth(((int) (rightWidth * 0.78)));
|
column.setPreferredWidth(((int) (rightWidth * 0.60)));
|
||||||
} else {
|
} else {
|
||||||
column.setPreferredWidth(((int) (rightWidth * 0.20)));
|
column.setPreferredWidth(((int) (rightWidth * 0.38)));
|
||||||
column.setCellRenderer(new CheckBoxRenderer());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,12 +119,9 @@ class DropdownListSearchPanel extends KeywordSearchPanel {
|
|||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
Object source = evt.getSource();
|
Object source = evt.getSource();
|
||||||
if (source instanceof String && ((String) source).equals("LOCAL")) { //NON-NLS
|
if (source instanceof String && ((String) source).equals("LOCAL")) { //NON-NLS
|
||||||
EventQueue.invokeLater(new Runnable() {
|
EventQueue.invokeLater(() -> {
|
||||||
@Override
|
ingestRunning = IngestManager.getInstance().isIngestRunning();
|
||||||
public void run() {
|
updateComponents();
|
||||||
ingestRunning = IngestManager.getInstance().isIngestRunning();
|
|
||||||
updateComponents();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,8 +313,8 @@ class DropdownListSearchPanel extends KeywordSearchPanel {
|
|||||||
private class KeywordListsTableModel extends AbstractTableModel {
|
private class KeywordListsTableModel extends AbstractTableModel {
|
||||||
//data
|
//data
|
||||||
|
|
||||||
private XmlKeywordSearchList listsHandle = XmlKeywordSearchList.getCurrent();
|
private final XmlKeywordSearchList listsHandle = XmlKeywordSearchList.getCurrent();
|
||||||
private List<ListTableEntry> listData = new ArrayList<>();
|
private final List<ListTableEntry> listData = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColumnCount() {
|
public int getColumnCount() {
|
||||||
@ -496,7 +489,7 @@ class DropdownListSearchPanel extends KeywordSearchPanel {
|
|||||||
ret = NbBundle.getMessage(this.getClass(), "KeywordSearch.nameColLbl");
|
ret = NbBundle.getMessage(this.getClass(), "KeywordSearch.nameColLbl");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ret = NbBundle.getMessage(this.getClass(), "KeywordSearch.regExColLbl");
|
ret = NbBundle.getMessage(this.getClass(), "KeywordSearch.typeColLbl");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -519,7 +512,7 @@ class DropdownListSearchPanel extends KeywordSearchPanel {
|
|||||||
ret = (Object) entry.name;
|
ret = (Object) entry.name;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ret = (Object) entry.regex;
|
ret = (Object) entry.keywordType;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -559,11 +552,11 @@ class DropdownListSearchPanel extends KeywordSearchPanel {
|
|||||||
private class KeywordTableEntry implements Comparable<KeywordTableEntry> {
|
private class KeywordTableEntry implements Comparable<KeywordTableEntry> {
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
Boolean regex;
|
String keywordType;
|
||||||
|
|
||||||
KeywordTableEntry(Keyword keyword) {
|
KeywordTableEntry(Keyword keyword) {
|
||||||
this.name = keyword.getSearchTerm();
|
this.name = keyword.getSearchTerm();
|
||||||
this.regex = !keyword.searchTermIsLiteral();
|
this.keywordType = keyword.getSearchTermType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -598,33 +591,4 @@ class DropdownListSearchPanel extends KeywordSearchPanel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A cell renderer for boolean cells that shows a center-aligned green check
|
|
||||||
* mark if true, nothing if false.
|
|
||||||
*/
|
|
||||||
private class CheckBoxRenderer extends DefaultTableCellRenderer {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
final ImageIcon theCheck = new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/checkmark.png")); // NON-NLS
|
|
||||||
|
|
||||||
CheckBoxRenderer() {
|
|
||||||
setHorizontalAlignment(CENTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
|
||||||
|
|
||||||
if ((value instanceof Boolean)) {
|
|
||||||
if ((Boolean) value) {
|
|
||||||
setIcon(theCheck);
|
|
||||||
setToolTipText(Bundle.IsRegularExpression());
|
|
||||||
} else {
|
|
||||||
setIcon(null);
|
|
||||||
setToolTipText(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ public class DropdownSingleKeywordSearchPanel extends KeywordSearchPanel {
|
|||||||
* Gets the default instance of a dropdown panel that provides GUI
|
* Gets the default instance of a dropdown panel that provides GUI
|
||||||
* components that allow a user to do three types of ad hoc single keyword
|
* components that allow a user to do three types of ad hoc single keyword
|
||||||
* searches.
|
* searches.
|
||||||
|
* @return the default instance of DropdownSingleKeywordSearchPanel
|
||||||
*/
|
*/
|
||||||
public static synchronized DropdownSingleKeywordSearchPanel getDefault() {
|
public static synchronized DropdownSingleKeywordSearchPanel getDefault() {
|
||||||
if (null == defaultInstance) {
|
if (null == defaultInstance) {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2016 Basis Technology Corp.
|
* Copyright 2011-2016 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -42,18 +42,7 @@ import org.openide.util.NbBundle;
|
|||||||
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
|
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.FlowLayout;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JCheckBox;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import static javax.swing.SwingConstants.CENTER;
|
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
|
||||||
import org.openide.util.NbBundle.Messages;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GlobalEditListPanel widget to manage keywords in lists
|
* GlobalEditListPanel widget to manage keywords in lists
|
||||||
@ -90,7 +79,6 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
|
|||||||
column.setPreferredWidth(((int) (width * 0.90)));
|
column.setPreferredWidth(((int) (width * 0.90)));
|
||||||
} else {
|
} else {
|
||||||
column.setPreferredWidth(((int) (width * 0.10)));
|
column.setPreferredWidth(((int) (width * 0.10)));
|
||||||
column.setCellRenderer(new CheckBoxRenderer());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keywordTable.setCellSelectionEnabled(false);
|
keywordTable.setCellSelectionEnabled(false);
|
||||||
@ -110,18 +98,13 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
|
|||||||
|
|
||||||
setButtonStates();
|
setButtonStates();
|
||||||
|
|
||||||
setButtonStates();
|
|
||||||
|
|
||||||
IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
|
IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
Object source = evt.getSource();
|
Object source = evt.getSource();
|
||||||
if (source instanceof String && ((String) source).equals("LOCAL")) { //NON-NLS
|
if (source instanceof String && ((String) source).equals("LOCAL")) { //NON-NLS
|
||||||
EventQueue.invokeLater(new Runnable() {
|
EventQueue.invokeLater(() -> {
|
||||||
@Override
|
setButtonStates();
|
||||||
public void run() {
|
|
||||||
setButtonStates();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,35 +334,26 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
|
|||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void newWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newWordButtonActionPerformed
|
private void newWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newWordButtonActionPerformed
|
||||||
JCheckBox chRegex = new JCheckBox(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.chRegex.text"));
|
NewKeywordPanel panel = new NewKeywordPanel();
|
||||||
chRegex.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.kwReToolTip"));
|
|
||||||
JTextField addWordField = new JTextField(25);
|
|
||||||
addWordField.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.enterNewWordToolTip"));
|
|
||||||
|
|
||||||
JPanel addKeywordPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
int result = JOptionPane.showConfirmDialog(null, panel,
|
||||||
addKeywordPanel.add(new JLabel(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.addKeyword.message")));
|
|
||||||
addKeywordPanel.add(addWordField);
|
|
||||||
addKeywordPanel.add(chRegex);
|
|
||||||
|
|
||||||
addKeywordPanel.setPreferredSize(new Dimension(250, 80));
|
|
||||||
|
|
||||||
int result = JOptionPane.showConfirmDialog(null, addKeywordPanel,
|
|
||||||
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.addKeyword.title"),
|
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.addKeyword.title"),
|
||||||
JOptionPane.OK_CANCEL_OPTION);
|
JOptionPane.OK_CANCEL_OPTION);
|
||||||
|
|
||||||
if (result == JOptionPane.OK_OPTION) {
|
if (result == JOptionPane.OK_OPTION) {
|
||||||
String newWord = addWordField.getText().trim();
|
String newWord = panel.getKeywordText();
|
||||||
boolean isLiteral = !chRegex.isSelected();
|
if (newWord.isEmpty()) {
|
||||||
final Keyword keyword = new Keyword(newWord, isLiteral);
|
KeywordSearchUtil.displayDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.newKwTitle"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.emptyKeyword.text"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||||
if (newWord.equals("")) {
|
|
||||||
return;
|
return;
|
||||||
} else if (currentKeywordList.hasKeyword(keyword)) {
|
}
|
||||||
|
final Keyword keyword = new Keyword(newWord, !panel.isKeywordRegex(), panel.isKeywordExact());
|
||||||
|
if (currentKeywordList.hasKeyword(keyword)) {
|
||||||
KeywordSearchUtil.displayDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.newKwTitle"),
|
KeywordSearchUtil.displayDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.newKwTitle"),
|
||||||
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.addWordButtonAction.kwAlreadyExistsMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.addWordButtonAction.kwAlreadyExistsMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if valid
|
//check if valid
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
try {
|
try {
|
||||||
@ -394,15 +368,13 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
|
|||||||
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.invalidKwMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
|
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.invalidKwMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//add & reset checkbox
|
//add & reset checkbox
|
||||||
tableModel.addKeyword(keyword);
|
tableModel.addKeyword(keyword);
|
||||||
XmlKeywordSearchList.getCurrent().addList(currentKeywordList);
|
XmlKeywordSearchList.getCurrent().addList(currentKeywordList);
|
||||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||||
setFocusOnKeywordTextBox();
|
setFocusOnKeywordTextBox();
|
||||||
setButtonStates();
|
setButtonStates();
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_newWordButtonActionPerformed
|
}//GEN-LAST:event_newWordButtonActionPerformed
|
||||||
|
|
||||||
@ -563,11 +535,10 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
|
|||||||
colName = NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.kwColName");
|
colName = NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.kwColName");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
colName = NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.regExColName");
|
colName = NbBundle.getMessage(this.getClass(), "KeywordSearch.typeColLbl");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
|
|
||||||
}
|
}
|
||||||
return colName;
|
return colName;
|
||||||
}
|
}
|
||||||
@ -581,10 +552,10 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
|
|||||||
Keyword word = currentKeywordList.getKeywords().get(rowIndex);
|
Keyword word = currentKeywordList.getKeywords().get(rowIndex);
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
ret = (Object) word.getSearchTerm();
|
ret = word.getSearchTerm();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ret = (Object) !word.searchTermIsLiteral();
|
ret = word.getSearchTermType();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger.log(Level.SEVERE, "Invalid table column index: {0}", columnIndex); //NON-NLS
|
logger.log(Level.SEVERE, "Invalid table column index: {0}", columnIndex); //NON-NLS
|
||||||
@ -629,36 +600,6 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A cell renderer for boolean cells that shows a center-aligned green check
|
|
||||||
* mark if true, nothing if false.
|
|
||||||
*/
|
|
||||||
private class CheckBoxRenderer extends DefaultTableCellRenderer {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
final ImageIcon theCheck = new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/checkmark.png")); // NON-NLS
|
|
||||||
|
|
||||||
CheckBoxRenderer() {
|
|
||||||
setHorizontalAlignment(CENTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Messages("IsRegularExpression=Keyword is a regular expression")
|
|
||||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
|
||||||
|
|
||||||
if ((value instanceof Boolean)) {
|
|
||||||
if ((Boolean) value) {
|
|
||||||
setIcon(theCheck);
|
|
||||||
setToolTipText(Bundle.IsRegularExpression());
|
|
||||||
} else {
|
|
||||||
setIcon(null);
|
|
||||||
setToolTipText(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the keyboard focus to new keyword textbox.
|
* Set the keyboard focus to new keyword textbox.
|
||||||
*/
|
*/
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2014 Basis Technology Corp.
|
* Copyright 2011-2016 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -76,7 +76,7 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option
|
|||||||
JOptionPane.PLAIN_MESSAGE,
|
JOptionPane.PLAIN_MESSAGE,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
currentKeywordList != null ? currentKeywordList.getName() : "");
|
currentKeywordList.getName());
|
||||||
if (listName == null || listName.trim().equals("")) {
|
if (listName == null || listName.trim().equals("")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2014 Basis Technology Corp.
|
* Copyright 2011-2016 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -40,8 +40,8 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Logger logger = Logger.getLogger(GlobalListsManagementPanel.class.getName());
|
private final Logger logger = Logger.getLogger(GlobalListsManagementPanel.class.getName());
|
||||||
private KeywordListTableModel tableModel;
|
private final KeywordListTableModel tableModel;
|
||||||
private final org.sleuthkit.autopsy.keywordsearch.GlobalListSettingsPanel globalListSettingsPanel;
|
private final org.sleuthkit.autopsy.keywordsearch.GlobalListSettingsPanel globalListSettingsPanel;
|
||||||
|
|
||||||
GlobalListsManagementPanel(org.sleuthkit.autopsy.keywordsearch.GlobalListSettingsPanel gsp) {
|
GlobalListsManagementPanel(org.sleuthkit.autopsy.keywordsearch.GlobalListSettingsPanel gsp) {
|
||||||
@ -345,7 +345,7 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa
|
|||||||
|
|
||||||
private class KeywordListTableModel extends AbstractTableModel {
|
private class KeywordListTableModel extends AbstractTableModel {
|
||||||
|
|
||||||
private XmlKeywordSearchList listsHandle = XmlKeywordSearchList.getCurrent();
|
private final XmlKeywordSearchList listsHandle = XmlKeywordSearchList.getCurrent();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColumnCount() {
|
public int getColumnCount() {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
package org.sleuthkit.autopsy.keywordsearch;
|
||||||
|
|
||||||
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,6 +120,18 @@ class Keyword {
|
|||||||
return isWholeWord;
|
return isWholeWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getSearchTermType() {
|
||||||
|
if (isLiteral) {
|
||||||
|
if (isWholeWord) {
|
||||||
|
return NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.exactButton.text");
|
||||||
|
} else {
|
||||||
|
return NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.substringButton.text");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.regexButton.text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the artifact attribute type associated with the keyword, if any.
|
* Sets the artifact attribute type associated with the keyword, if any.
|
||||||
*
|
*
|
||||||
@ -159,9 +172,9 @@ class Keyword {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Keyword other = (Keyword) obj;
|
Keyword other = (Keyword) obj;
|
||||||
return (this.searchTerm.equals(other.searchTerm)
|
return (this.searchTerm.equals(other.getSearchTerm())
|
||||||
&& this.isLiteral == other.isLiteral
|
&& this.isLiteral == other.searchTermIsLiteral()
|
||||||
&& this.isWholeWord == other.isWholeWord);
|
&& this.isWholeWord == other.searchTermIsWholeWord());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2014 Basis Technology Corp.
|
* Copyright 2011-2016 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -46,7 +46,7 @@ abstract class KeywordSearchList {
|
|||||||
private static final String CCN_REGEX = ".*[3456]([ -]?\\d){11,18}.*"; //12-19 digits, with possible single spaces or dashes in between. first digit is 3,4,5, or 6 //NON-NLS
|
private static final String CCN_REGEX = ".*[3456]([ -]?\\d){11,18}.*"; //12-19 digits, with possible single spaces or dashes in between. first digit is 3,4,5, or 6 //NON-NLS
|
||||||
|
|
||||||
protected String filePath;
|
protected String filePath;
|
||||||
Map<String, KeywordList> theLists; //the keyword data
|
Map<String, KeywordList> theLists; //the keyword data
|
||||||
|
|
||||||
PropertyChangeSupport changeSupport;
|
PropertyChangeSupport changeSupport;
|
||||||
protected List<String> lockedLists;
|
protected List<String> lockedLists;
|
||||||
@ -320,7 +320,7 @@ abstract class KeywordSearchList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean addList(String name, List<Keyword> newList, boolean useForIngest, boolean ingestMessages) {
|
boolean addList(String name, List<Keyword> newList, boolean useForIngest, boolean ingestMessages) {
|
||||||
//make sure that the list is readded as a locked/built in list
|
//make sure that the list is readded as a locked/built in list
|
||||||
boolean isLocked = this.lockedLists.contains(name);
|
boolean isLocked = this.lockedLists.contains(name);
|
||||||
return addList(name, newList, useForIngest, ingestMessages, isLocked);
|
return addList(name, newList, useForIngest, ingestMessages, isLocked);
|
||||||
}
|
}
|
||||||
|
108
KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/NewKeywordPanel.form
Executable file
108
KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/NewKeywordPanel.form
Executable file
@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
|
<NonVisualComponents>
|
||||||
|
<Component class="javax.swing.ButtonGroup" name="keywordTypeButtonGroup">
|
||||||
|
</Component>
|
||||||
|
</NonVisualComponents>
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Component id="exactButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="substringButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="regexButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Component id="newKeywordLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="keywordTextField" alignment="0" min="-2" pref="305" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="newKeywordLabel" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="keywordTextField" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="exactButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="substringButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="regexButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
<SubComponents>
|
||||||
|
<Component class="javax.swing.JTextField" name="keywordTextField">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="NewKeywordPanel.keywordTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="ancestorAdded" listener="javax.swing.event.AncestorListener" parameters="javax.swing.event.AncestorEvent" handler="keywordTextFieldAncestorAdded"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="exactButton">
|
||||||
|
<Properties>
|
||||||
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
|
<ComponentRef name="keywordTypeButtonGroup"/>
|
||||||
|
</Property>
|
||||||
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="NewKeywordPanel.exactButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="substringButton">
|
||||||
|
<Properties>
|
||||||
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
|
<ComponentRef name="keywordTypeButtonGroup"/>
|
||||||
|
</Property>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="NewKeywordPanel.substringButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="regexButton">
|
||||||
|
<Properties>
|
||||||
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
|
<ComponentRef name="keywordTypeButtonGroup"/>
|
||||||
|
</Property>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="NewKeywordPanel.regexButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="newKeywordLabel">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="NewKeywordPanel.newKeywordLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
</SubComponents>
|
||||||
|
</Form>
|
142
KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/NewKeywordPanel.java
Executable file
142
KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/NewKeywordPanel.java
Executable file
@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2011-2016 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.keywordsearch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A panel that is contained in NewKeywordDialog used when the user wants to add
|
||||||
|
* a new keyword to a list via the options panel. This panel allows the user to
|
||||||
|
* indicate whether they want the keyword to be an exact match, a substring, or
|
||||||
|
* a regular expression.
|
||||||
|
*/
|
||||||
|
class NewKeywordPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new form NewKeywordPanel
|
||||||
|
*/
|
||||||
|
public NewKeywordPanel() {
|
||||||
|
initComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the text for the new keyword
|
||||||
|
*/
|
||||||
|
String getKeywordText() {
|
||||||
|
return keywordTextField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the regular expression radio button is selected
|
||||||
|
*/
|
||||||
|
boolean isKeywordRegex() {
|
||||||
|
return regexButton.isSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the exact match radio button is selected
|
||||||
|
*/
|
||||||
|
boolean isKeywordExact() {
|
||||||
|
return exactButton.isSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called from within the constructor to initialize the form.
|
||||||
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
|
* regenerated by the Form Editor.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
|
private void initComponents() {
|
||||||
|
|
||||||
|
keywordTypeButtonGroup = new javax.swing.ButtonGroup();
|
||||||
|
keywordTextField = new javax.swing.JTextField();
|
||||||
|
exactButton = new javax.swing.JRadioButton();
|
||||||
|
substringButton = new javax.swing.JRadioButton();
|
||||||
|
regexButton = new javax.swing.JRadioButton();
|
||||||
|
newKeywordLabel = new javax.swing.JLabel();
|
||||||
|
|
||||||
|
keywordTextField.setText(org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.keywordTextField.text")); // NOI18N
|
||||||
|
keywordTextField.addAncestorListener(new javax.swing.event.AncestorListener() {
|
||||||
|
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
|
||||||
|
}
|
||||||
|
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
|
||||||
|
keywordTextFieldAncestorAdded(evt);
|
||||||
|
}
|
||||||
|
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
keywordTypeButtonGroup.add(exactButton);
|
||||||
|
exactButton.setSelected(true);
|
||||||
|
org.openide.awt.Mnemonics.setLocalizedText(exactButton, org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.exactButton.text")); // NOI18N
|
||||||
|
|
||||||
|
keywordTypeButtonGroup.add(substringButton);
|
||||||
|
org.openide.awt.Mnemonics.setLocalizedText(substringButton, org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.substringButton.text")); // NOI18N
|
||||||
|
|
||||||
|
keywordTypeButtonGroup.add(regexButton);
|
||||||
|
org.openide.awt.Mnemonics.setLocalizedText(regexButton, org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.regexButton.text")); // NOI18N
|
||||||
|
|
||||||
|
org.openide.awt.Mnemonics.setLocalizedText(newKeywordLabel, org.openide.util.NbBundle.getMessage(NewKeywordPanel.class, "NewKeywordPanel.newKeywordLabel.text")); // NOI18N
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
|
this.setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(exactButton)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(substringButton)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(regexButton))
|
||||||
|
.addComponent(newKeywordLabel)
|
||||||
|
.addComponent(keywordTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addComponent(newKeywordLabel)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(keywordTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(exactButton)
|
||||||
|
.addComponent(substringButton)
|
||||||
|
.addComponent(regexButton))
|
||||||
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
|
);
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
private void keywordTextFieldAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_keywordTextFieldAncestorAdded
|
||||||
|
evt.getComponent().requestFocusInWindow();
|
||||||
|
}//GEN-LAST:event_keywordTextFieldAncestorAdded
|
||||||
|
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JRadioButton exactButton;
|
||||||
|
private javax.swing.JTextField keywordTextField;
|
||||||
|
private javax.swing.ButtonGroup keywordTypeButtonGroup;
|
||||||
|
private javax.swing.JLabel newKeywordLabel;
|
||||||
|
private javax.swing.JRadioButton regexButton;
|
||||||
|
private javax.swing.JRadioButton substringButton;
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
}
|
@ -55,6 +55,7 @@ final class XmlKeywordSearchList extends KeywordSearchList {
|
|||||||
private static final String LIST_INGEST_MSGS = "ingest_messages"; //NON-NLS
|
private static final String LIST_INGEST_MSGS = "ingest_messages"; //NON-NLS
|
||||||
private static final String KEYWORD_EL = "keyword"; //NON-NLS
|
private static final String KEYWORD_EL = "keyword"; //NON-NLS
|
||||||
private static final String KEYWORD_LITERAL_ATTR = "literal"; //NON-NLS
|
private static final String KEYWORD_LITERAL_ATTR = "literal"; //NON-NLS
|
||||||
|
private static final String KEYWORD_WHOLE_ATTR = "whole"; //NON-NLS
|
||||||
private static final String KEYWORD_SELECTOR_ATTR = "selector"; //NON-NLS
|
private static final String KEYWORD_SELECTOR_ATTR = "selector"; //NON-NLS
|
||||||
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; //NON-NLS
|
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; //NON-NLS
|
||||||
private static final String ENCODING = "UTF-8"; //NON-NLS
|
private static final String ENCODING = "UTF-8"; //NON-NLS
|
||||||
@ -125,6 +126,8 @@ final class XmlKeywordSearchList extends KeywordSearchList {
|
|||||||
Element keywordEl = doc.createElement(KEYWORD_EL);
|
Element keywordEl = doc.createElement(KEYWORD_EL);
|
||||||
String literal = keyword.searchTermIsLiteral() ? "true" : "false"; //NON-NLS
|
String literal = keyword.searchTermIsLiteral() ? "true" : "false"; //NON-NLS
|
||||||
keywordEl.setAttribute(KEYWORD_LITERAL_ATTR, literal);
|
keywordEl.setAttribute(KEYWORD_LITERAL_ATTR, literal);
|
||||||
|
String whole = keyword.searchTermIsWholeWord() ? "true" : "false"; //NON-NLS
|
||||||
|
keywordEl.setAttribute(KEYWORD_WHOLE_ATTR, whole);
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE selectorType = keyword.getArtifactAttributeType();
|
BlackboardAttribute.ATTRIBUTE_TYPE selectorType = keyword.getArtifactAttributeType();
|
||||||
if (selectorType != null) {
|
if (selectorType != null) {
|
||||||
keywordEl.setAttribute(KEYWORD_SELECTOR_ATTR, selectorType.getLabel());
|
keywordEl.setAttribute(KEYWORD_SELECTOR_ATTR, selectorType.getLabel());
|
||||||
@ -195,14 +198,20 @@ final class XmlKeywordSearchList extends KeywordSearchList {
|
|||||||
Element wordEl = (Element) wordsNList.item(j);
|
Element wordEl = (Element) wordsNList.item(j);
|
||||||
String literal = wordEl.getAttribute(KEYWORD_LITERAL_ATTR);
|
String literal = wordEl.getAttribute(KEYWORD_LITERAL_ATTR);
|
||||||
boolean isLiteral = literal.equals("true"); //NON-NLS
|
boolean isLiteral = literal.equals("true"); //NON-NLS
|
||||||
Keyword keyword = new Keyword(wordEl.getTextContent(), isLiteral);
|
Keyword keyword;
|
||||||
|
String whole = wordEl.getAttribute(KEYWORD_WHOLE_ATTR);
|
||||||
|
if (whole.equals("")) {
|
||||||
|
keyword = new Keyword(wordEl.getTextContent(), isLiteral);
|
||||||
|
} else {
|
||||||
|
boolean isWhole = whole.equals("true");
|
||||||
|
keyword = new Keyword(wordEl.getTextContent(), isLiteral, isWhole);
|
||||||
|
}
|
||||||
String selector = wordEl.getAttribute(KEYWORD_SELECTOR_ATTR);
|
String selector = wordEl.getAttribute(KEYWORD_SELECTOR_ATTR);
|
||||||
if (!selector.equals("")) {
|
if (!selector.equals("")) {
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE selectorType = BlackboardAttribute.ATTRIBUTE_TYPE.fromLabel(selector);
|
BlackboardAttribute.ATTRIBUTE_TYPE selectorType = BlackboardAttribute.ATTRIBUTE_TYPE.fromLabel(selector);
|
||||||
keyword.setArtifactAttributeType(selectorType);
|
keyword.setArtifactAttributeType(selectorType);
|
||||||
}
|
}
|
||||||
words.add(keyword);
|
words.add(keyword);
|
||||||
|
|
||||||
}
|
}
|
||||||
theLists.put(name, list);
|
theLists.put(name, list);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user