mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
TSK-361 Incorporate standard selectors / reg-exp - gui changes
This commit is contained in:
parent
3a3e04ff3d
commit
4c89e766ba
@ -83,3 +83,4 @@ KeywordSearchListsViewerPanel.searchAddButton.text=Search
|
||||
KeywordSearchListsViewerPanel.manageListsButton.text=Manage Lists
|
||||
KeywordSearchIngestSimplePanel.jLabel1.text=Select lists to use during ingest:
|
||||
KeywordSearchListsViewerPanel.ingestIndexLabel.text=Files Indexed:
|
||||
KeywordSearchEditListPanel.selectorsCombo.toolTipText=Regular Expression selector type (optional)
|
||||
|
@ -98,31 +98,28 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="useForIngestCheckbox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="62" max="32767" attributes="0"/>
|
||||
<Component id="deleteWordButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="46" max="-2" attributes="0"/>
|
||||
<Component id="addKeywordPanel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="34" max="32767" attributes="0"/>
|
||||
<Component id="addKeywordPanel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jScrollPane1" pref="272" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="263" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="addKeywordPanel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="deleteWordButton" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="useForIngestCheckbox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
@ -185,15 +182,19 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="addWordField" min="-2" pref="152" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="10" pref="10" max="10" attributes="0"/>
|
||||
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="addWordField" min="-2" pref="152" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="addWordButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="1">
|
||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
||||
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="selectorsCombo" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="44" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -206,7 +207,10 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="addWordField" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="selectorsCombo" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chRegex" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@ -241,6 +245,19 @@
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchEditListPanel.chRegex.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chRegexActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="selectorsCombo">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchEditListPanel.selectorsCombo.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
|
@ -17,11 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* KeywordSearchEditListPanel.java
|
||||
*
|
||||
* Created on Feb 10, 2012, 4:20:03 PM
|
||||
*/
|
||||
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.awt.Component;
|
||||
@ -39,14 +35,13 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import javax.swing.DefaultListSelectionModel;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
@ -54,19 +49,18 @@ import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableColumn;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author dfickling
|
||||
* KeywordSearchEditListPanel widget to manage keywords in lists
|
||||
*/
|
||||
class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelectionListener{
|
||||
class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelectionListener {
|
||||
|
||||
private static Logger logger = Logger.getLogger(KeywordSearchEditListPanel.class.getName());
|
||||
private KeywordTableModel tableModel;
|
||||
private String currentKeywordList;
|
||||
private boolean ingestRunning;
|
||||
private boolean locked;
|
||||
|
||||
private static KeywordSearchEditListPanel instance = null;
|
||||
|
||||
/** Creates new form KeywordSearchEditListPanel */
|
||||
@ -115,13 +109,42 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
final ListSelectionModel lsm = keywordTable.getSelectionModel();
|
||||
lsm.addListSelectionListener(new ListSelectionListener() {
|
||||
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
if(lsm.isSelectionEmpty() || locked)
|
||||
if (lsm.isSelectionEmpty() || locked) {
|
||||
deleteWordButton.setEnabled(false);
|
||||
else
|
||||
} else {
|
||||
deleteWordButton.setEnabled(true);
|
||||
}
|
||||
|
||||
//show selector if available
|
||||
DefaultListSelectionModel selModel = (DefaultListSelectionModel) e.getSource();
|
||||
if (!selModel.getValueIsAdjusting()) {
|
||||
List<Keyword> keywords = tableModel.getAllKeywords();
|
||||
final int minIndex = selModel.getMinSelectionIndex();
|
||||
final int maxIndex = selModel.getMaxSelectionIndex();
|
||||
int selected = -1;
|
||||
for (int i = minIndex; i <= maxIndex; i++) {
|
||||
if (selModel.isSelectedIndex(i)) {
|
||||
selected = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selected > -1 && selected < keywords.size()) {
|
||||
Keyword k = keywords.get(selected);
|
||||
BlackboardAttribute.ATTRIBUTE_TYPE selType = k.getType();
|
||||
if (selType != null) {
|
||||
selectorsCombo.setSelectedIndex(selType.ordinal());
|
||||
} else {
|
||||
//set to none (last item)
|
||||
selectorsCombo.setSelectedIndex(selectorsCombo.getItemCount() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//loadDefaultKeywords();
|
||||
@ -129,19 +152,21 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
initButtons();
|
||||
|
||||
addWordField.setComponentPopupMenu(rightClickMenu);
|
||||
ActionListener actList = new ActionListener(){
|
||||
ActionListener actList = new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e){
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JMenuItem jmi = (JMenuItem) e.getSource();
|
||||
if(jmi.equals(cutMenuItem))
|
||||
if (jmi.equals(cutMenuItem)) {
|
||||
addWordField.cut();
|
||||
else if(jmi.equals(copyMenuItem))
|
||||
} else if (jmi.equals(copyMenuItem)) {
|
||||
addWordField.copy();
|
||||
else if(jmi.equals(pasteMenuItem))
|
||||
} else if (jmi.equals(pasteMenuItem)) {
|
||||
addWordField.paste();
|
||||
else if(jmi.equals(selectAllMenuItem))
|
||||
} else if (jmi.equals(selectAllMenuItem)) {
|
||||
addWordField.selectAll();
|
||||
}
|
||||
}
|
||||
};
|
||||
cutMenuItem.addActionListener(actList);
|
||||
copyMenuItem.addActionListener(actList);
|
||||
@ -150,10 +175,11 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
|
||||
|
||||
if(IngestManager.getDefault().isServiceRunning(KeywordSearchIngestService.getDefault()))
|
||||
if (IngestManager.getDefault().isServiceRunning(KeywordSearchIngestService.getDefault())) {
|
||||
initIngest(0);
|
||||
else
|
||||
} else {
|
||||
initIngest(1);
|
||||
}
|
||||
|
||||
IngestManager.addPropertyChangeListener(new PropertyChangeListener() {
|
||||
|
||||
@ -161,19 +187,27 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
String changed = evt.getPropertyName();
|
||||
Object oldValue = evt.getOldValue();
|
||||
if(changed.equals(IngestManager.SERVICE_COMPLETED_EVT) &&
|
||||
((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME))
|
||||
if (changed.equals(IngestManager.SERVICE_COMPLETED_EVT)
|
||||
&& ((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME)) {
|
||||
initIngest(1);
|
||||
else if(changed.equals(IngestManager.SERVICE_STARTED_EVT) &&
|
||||
((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME))
|
||||
} else if (changed.equals(IngestManager.SERVICE_STARTED_EVT)
|
||||
&& ((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME)) {
|
||||
initIngest(0);
|
||||
else if(changed.equals(IngestManager.SERVICE_STOPPED_EVT) &&
|
||||
((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME))
|
||||
} else if (changed.equals(IngestManager.SERVICE_STOPPED_EVT)
|
||||
&& ((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME)) {
|
||||
initIngest(1);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//selectors
|
||||
selectorsCombo.setEnabled(false);
|
||||
for (BlackboardAttribute.ATTRIBUTE_TYPE type : BlackboardAttribute.ATTRIBUTE_TYPE.values()) {
|
||||
selectorsCombo.addItem(type.getDisplayName());
|
||||
}
|
||||
selectorsCombo.addItem("<none>");
|
||||
selectorsCombo.setSelectedIndex(selectorsCombo.getItemCount() - 1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,6 +250,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
addWordButton.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked);
|
||||
addWordField.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked);
|
||||
chRegex.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked);
|
||||
selectorsCombo.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked && chRegex.isSelected());
|
||||
useForIngestCheckbox.setEnabled(listSet && (!ingestOngoing || !inIngest));
|
||||
saveListButton.setEnabled(listSet);
|
||||
exportButton.setEnabled(listSet);
|
||||
@ -255,6 +290,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
addWordButton = new javax.swing.JButton();
|
||||
addWordField = new javax.swing.JTextField();
|
||||
chRegex = new javax.swing.JCheckBox();
|
||||
selectorsCombo = new javax.swing.JComboBox();
|
||||
saveListButton = new javax.swing.JButton();
|
||||
exportButton = new javax.swing.JButton();
|
||||
deleteListButton = new javax.swing.JButton();
|
||||
@ -308,6 +344,13 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
});
|
||||
|
||||
chRegex.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.chRegex.text")); // NOI18N
|
||||
chRegex.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
chRegexActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
selectorsCombo.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.selectorsCombo.toolTipText")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout addKeywordPanelLayout = new javax.swing.GroupLayout(addKeywordPanel);
|
||||
addKeywordPanel.setLayout(addKeywordPanelLayout);
|
||||
@ -316,13 +359,16 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
.addGroup(addKeywordPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(addKeywordPanelLayout.createSequentialGroup()
|
||||
.addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(addWordButton))
|
||||
.addGroup(addKeywordPanelLayout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addComponent(chRegex)))
|
||||
.addComponent(chRegex)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(addWordButton)
|
||||
.addContainerGap())
|
||||
.addComponent(selectorsCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap(44, Short.MAX_VALUE))
|
||||
);
|
||||
addKeywordPanelLayout.setVerticalGroup(
|
||||
addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@ -333,7 +379,9 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
.addGroup(addKeywordPanelLayout.createSequentialGroup()
|
||||
.addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chRegex)))
|
||||
.addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(selectorsCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chRegex))))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@ -342,25 +390,24 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
listEditorPanelLayout.setHorizontalGroup(
|
||||
listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, listEditorPanelLayout.createSequentialGroup()
|
||||
.addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(listEditorPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(useForIngestCheckbox)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE)
|
||||
.addComponent(deleteWordButton))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, listEditorPanelLayout.createSequentialGroup()
|
||||
.addGap(46, 46, 46)
|
||||
.addComponent(addKeywordPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(deleteWordButton)
|
||||
.addContainerGap())
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, listEditorPanelLayout.createSequentialGroup()
|
||||
.addContainerGap(34, Short.MAX_VALUE)
|
||||
.addComponent(addKeywordPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(19, 19, 19))
|
||||
);
|
||||
listEditorPanelLayout.setVerticalGroup(
|
||||
listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, listEditorPanelLayout.createSequentialGroup()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
|
||||
.addGap(5, 5, 5)
|
||||
.addComponent(addKeywordPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(deleteWordButton)
|
||||
.addComponent(useForIngestCheckbox))
|
||||
@ -422,6 +469,14 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
String newWord = addWordField.getText().trim();
|
||||
boolean isLiteral = !chRegex.isSelected();
|
||||
final Keyword keyword = new Keyword(newWord, isLiteral);
|
||||
if (!isLiteral) {
|
||||
//get selector
|
||||
int selI = this.selectorsCombo.getSelectedIndex();
|
||||
if (selI < this.selectorsCombo.getItemCount() - 1) {
|
||||
BlackboardAttribute.ATTRIBUTE_TYPE selector = BlackboardAttribute.ATTRIBUTE_TYPE.values()[selI];
|
||||
keyword.setType(selector);
|
||||
}
|
||||
}
|
||||
|
||||
if (newWord.equals("")) {
|
||||
return;
|
||||
@ -475,7 +530,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
return;
|
||||
}
|
||||
|
||||
if (writer.listExists(listName) && writer.getList(listName).isLocked()){
|
||||
if (writer.listExists(listName) && writer.getList(listName).isLocked()) {
|
||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Cannot overwrite default list", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
|
||||
return;
|
||||
}
|
||||
@ -567,6 +622,9 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
deleter.deleteList(toDelete);
|
||||
}//GEN-LAST:event_deleteListButtonActionPerformed
|
||||
|
||||
private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed
|
||||
selectorsCombo.setEnabled(chRegex.isEnabled() && chRegex.isSelected());
|
||||
}//GEN-LAST:event_chRegexActionPerformed
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel addKeywordPanel;
|
||||
private javax.swing.JButton addWordButton;
|
||||
@ -585,6 +643,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
private javax.swing.JPopupMenu rightClickMenu;
|
||||
private javax.swing.JButton saveListButton;
|
||||
private javax.swing.JMenuItem selectAllMenuItem;
|
||||
private javax.swing.JComboBox selectorsCombo;
|
||||
private javax.swing.JCheckBox useForIngestCheckbox;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@ -680,8 +739,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
return colName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
Object ret = null;
|
||||
@ -693,10 +750,10 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
}
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
ret = (Object) entry.keyword;
|
||||
ret = (Object) entry.keyword.getQuery();
|
||||
break;
|
||||
case 1:
|
||||
ret = (Object) !entry.isLiteral;
|
||||
ret = (Object) !entry.keyword.isLiteral();
|
||||
break;
|
||||
default:
|
||||
logger.log(Level.SEVERE, "Invalid table column index: " + columnIndex);
|
||||
@ -712,7 +769,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
@Override
|
||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -723,16 +779,16 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
List<Keyword> getAllKeywords() {
|
||||
List<Keyword> ret = new ArrayList<Keyword>();
|
||||
for (TableEntry e : keywordData) {
|
||||
ret.add(new Keyword(e.keyword, e.isLiteral));
|
||||
ret.add(e.keyword);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
List<Keyword> getSelectedKeywords(int[] selected) {
|
||||
List<Keyword> ret = new ArrayList<Keyword>();
|
||||
for(int i = 0; i < selected.length; i++){
|
||||
Keyword word = new Keyword((String) getValueAt(0, selected[i]), !((Boolean) getValueAt(1, selected[i])));
|
||||
ret.add(word);
|
||||
Keyword[] in = keywordData.toArray(new Keyword[0]);
|
||||
for (int i = 0; i < selected.length; i++) {
|
||||
ret.add(in[selected[i]]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -776,8 +832,9 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
//delete selected from handle, events are fired from the handle
|
||||
void deleteSelected(int[] selected) {
|
||||
List<TableEntry> toDel = new ArrayList<TableEntry>();
|
||||
for(int i = 0; i < selected.length; i++){
|
||||
Keyword word = new Keyword((String) getValueAt(selected[i], 0), !((Boolean) getValueAt(selected[i], 1)));
|
||||
Keyword[] in = keywordData.toArray(new Keyword[0]);
|
||||
for (int i = 0; i < selected.length; i++) {
|
||||
Keyword word = in[selected[i]];
|
||||
toDel.add(new TableEntry(word));
|
||||
}
|
||||
for (TableEntry del : toDel) {
|
||||
@ -789,31 +846,25 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
class TableEntry implements Comparable {
|
||||
|
||||
String keyword;
|
||||
Boolean isLiteral;
|
||||
Keyword keyword;
|
||||
|
||||
TableEntry(Keyword keyword) {
|
||||
this.keyword = keyword.getQuery();
|
||||
this.isLiteral = keyword.isLiteral();
|
||||
}
|
||||
|
||||
TableEntry(String keyword, Boolean isLiteral) {
|
||||
this.keyword = keyword;
|
||||
this.isLiteral = isLiteral;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
int keywords = this.keyword.compareTo(((TableEntry) o).keyword);
|
||||
if (keywords != 0)
|
||||
int keywords = this.keyword.getQuery().compareTo(((TableEntry) o).keyword.getQuery());
|
||||
if (keywords != 0) {
|
||||
return keywords;
|
||||
else return this.isLiteral.compareTo(((TableEntry) o).isLiteral);
|
||||
} else {
|
||||
return Boolean.valueOf(keyword.isLiteral()).compareTo(((TableEntry) o).keyword.isLiteral());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class CheckBoxRenderer extends JCheckBox implements TableCellRenderer{
|
||||
private class CheckBoxRenderer extends JCheckBox implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(
|
||||
@ -826,7 +877,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
Boolean selected = (Boolean) table.getModel().getValueAt(row, 1);
|
||||
setSelected(selected);
|
||||
if(isSelected){
|
||||
if (isSelected) {
|
||||
setBackground(keywordTable.getSelectionBackground());
|
||||
setForeground(keywordTable.getSelectionForeground());
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user