diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties b/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties index f3ac99e12d..1de1c35a7d 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties @@ -17,5 +17,5 @@ CommonFilesPanel.intraCaseRadio.label=Correlate within current case only CommonFilesPanel.interCaseRadio.label=Correlate amongst all known cases (uses Central Repo) IntraCasePanel.allDataSourcesRadioButton.text=Matches may be from any data source IntraCasePanel.withinDataSourceRadioButton.text=At least one match must appear in the data source selected below: -InterCasePanel.anCentralRepoCaseRadio.text=Matches may be from any Central Repo case InterCasePanel.specificCentralRepoCaseRadio.text=Matches must be from the following Central Repo case: +InterCasePanel.anyCentralRepoCaseRadio.text=Matches may be from any Central Repo case diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java index 9fae239a88..8f85b3c4c0 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java @@ -304,7 +304,6 @@ public final class CommonFilesPanel extends javax.swing.JPanel { try { CommonFilesPanel.this.intraCasePanel.setDataSourceMap(this.get()); - updateUi(); } catch (InterruptedException ex) { @@ -602,12 +601,36 @@ public final class CommonFilesPanel extends javax.swing.JPanel { private void intraCaseRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_intraCaseRadioActionPerformed ((java.awt.CardLayout)this.layoutPanel.getLayout()).last(this.layoutPanel); + handleIntraCaseSearchCriteriaChanged(); }//GEN-LAST:event_intraCaseRadioActionPerformed + public void handleIntraCaseSearchCriteriaChanged() { + if(this.areIntraCaseSearchCriteriaMet()){ + this.searchButton.setEnabled(true); + this.hideErrorMessages(); + } else { + this.searchButton.setEnabled(false); + this.hideErrorMessages(); + this.showIntraCaseErrorMessage(); + } + } + private void interCaseRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_interCaseRadioActionPerformed ((java.awt.CardLayout)this.layoutPanel.getLayout()).first(this.layoutPanel); + handleInterCaseSearchCriteriaChanged(); }//GEN-LAST:event_interCaseRadioActionPerformed + public void handleInterCaseSearchCriteriaChanged() { + if(this.areInterCaseSearchCriteriaMet()){ + this.searchButton.setEnabled(true); + this.hideErrorMessages(); + } else { + this.searchButton.setEnabled(false); + this.hideErrorMessages(); + this.showInterCaseErrorMessage(); + } + } + private void toggleErrorTextAndSearchBox() { if (!this.pictureVideoCheckbox.isSelected() && !this.documentsCheckbox.isSelected() && !this.allFileCategoriesRadioButton.isSelected()) { this.searchButton.setEnabled(false); @@ -663,4 +686,26 @@ public final class CommonFilesPanel extends javax.swing.JPanel { void setSearchButtonEnabled(boolean enabled) { this.searchButton.setEnabled(enabled); } + + private boolean areIntraCaseSearchCriteriaMet() { + return this.intraCasePanel.areSearchCriteriaMet(); + } + + private boolean areInterCaseSearchCriteriaMet() { + return this.interCasePanel.areSearchCriteriaMet(); + } + + private void hideErrorMessages() { + this.errorText.setVisible(false); + } + + private void showIntraCaseErrorMessage() { + this.errorText.setText(Bundle.CommonFilesPanel_showIntraCaseErrorMessage_message()); + this.errorText.setVisible(true); + } + + private void showInterCaseErrorMessage() { + this.errorText.setText(this.interCasePanel.getErrorMessage()); + this.errorText.setVisible(true); + } } diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/InterCasePanel.form b/Core/src/org/sleuthkit/autopsy/commonfilesearch/InterCasePanel.form index f8060a7df3..daa29800f6 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/InterCasePanel.form +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/InterCasePanel.form @@ -23,7 +23,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -49,18 +49,18 @@ - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/InterCasePanel.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/InterCasePanel.java index 667fa1ba56..d7da1d7a85 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/InterCasePanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/InterCasePanel.java @@ -51,11 +51,14 @@ public class InterCasePanel extends javax.swing.JPanel { private CommonFilesPanel parent; + private String errorMessage; + /** * Creates new form InterCasePanel */ public InterCasePanel() { initComponents(); + this.errorMessage = ""; } private void specificCaseSelected(boolean selected) { @@ -70,6 +73,10 @@ public class InterCasePanel extends javax.swing.JPanel { this.parent = parent; } + String getErrorMessage(){ + return this.errorMessage; + } + /** * 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 @@ -80,16 +87,16 @@ public class InterCasePanel extends javax.swing.JPanel { private void initComponents() { buttonGroup = new javax.swing.ButtonGroup(); - anCentralRepoCaseRadio = new javax.swing.JRadioButton(); + anyCentralRepoCaseRadio = new javax.swing.JRadioButton(); specificCentralRepoCaseRadio = new javax.swing.JRadioButton(); caseComboBox = new javax.swing.JComboBox<>(); - buttonGroup.add(anCentralRepoCaseRadio); - anCentralRepoCaseRadio.setSelected(true); - org.openide.awt.Mnemonics.setLocalizedText(anCentralRepoCaseRadio, org.openide.util.NbBundle.getMessage(InterCasePanel.class, "InterCasePanel.anCentralRepoCaseRadio.text")); // NOI18N - anCentralRepoCaseRadio.addActionListener(new java.awt.event.ActionListener() { + buttonGroup.add(anyCentralRepoCaseRadio); + anyCentralRepoCaseRadio.setSelected(true); + org.openide.awt.Mnemonics.setLocalizedText(anyCentralRepoCaseRadio, org.openide.util.NbBundle.getMessage(InterCasePanel.class, "InterCasePanel.anyCentralRepoCaseRadio.text")); // NOI18N + anyCentralRepoCaseRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - anCentralRepoCaseRadioActionPerformed(evt); + anyCentralRepoCaseRadioActionPerformed(evt); } }); @@ -111,7 +118,7 @@ public class InterCasePanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(anCentralRepoCaseRadio) + .addComponent(anyCentralRepoCaseRadio) .addComponent(specificCentralRepoCaseRadio) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) @@ -122,7 +129,7 @@ public class InterCasePanel extends javax.swing.JPanel { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(anCentralRepoCaseRadio) + .addComponent(anyCentralRepoCaseRadio) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(specificCentralRepoCaseRadio) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -133,15 +140,20 @@ public class InterCasePanel extends javax.swing.JPanel { private void specificCentralRepoCaseRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_specificCentralRepoCaseRadioActionPerformed this.caseComboBox.setEnabled(true); + if(this.caseComboBox.getSelectedItem() == null){ + this.caseComboBox.setSelectedIndex(0); + } + this.parent.handleInterCaseSearchCriteriaChanged(); }//GEN-LAST:event_specificCentralRepoCaseRadioActionPerformed - private void anCentralRepoCaseRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_anCentralRepoCaseRadioActionPerformed + private void anyCentralRepoCaseRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_anyCentralRepoCaseRadioActionPerformed this.caseComboBox.setEnabled(false); - }//GEN-LAST:event_anCentralRepoCaseRadioActionPerformed + this.parent.handleInterCaseSearchCriteriaChanged(); + }//GEN-LAST:event_anyCentralRepoCaseRadioActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JRadioButton anCentralRepoCaseRadio; + private javax.swing.JRadioButton anyCentralRepoCaseRadio; private javax.swing.ButtonGroup buttonGroup; private javax.swing.JComboBox caseComboBox; private javax.swing.JRadioButton specificCentralRepoCaseRadio; @@ -157,8 +169,8 @@ public class InterCasePanel extends javax.swing.JPanel { } void rigForMultipleCases(boolean multipleCases) { - this.anCentralRepoCaseRadio.setEnabled(multipleCases); - this.anCentralRepoCaseRadio.setEnabled(multipleCases); + this.anyCentralRepoCaseRadio.setEnabled(multipleCases); + this.anyCentralRepoCaseRadio.setEnabled(multipleCases); if(!multipleCases){ this.specificCentralRepoCaseRadio.setSelected(true); @@ -173,4 +185,16 @@ public class InterCasePanel extends javax.swing.JPanel { boolean centralRepoHasMultipleCases() { return this.caseMap.size() >= 2; } + + @NbBundle.Messages({ + "CommonFilesPanel.showInterCaseErrorMessage.message=Cannot run intercase correlation search: no cases in Central Repository." + }) + boolean areSearchCriteriaMet() { + if(this.caseMap.isEmpty()){ + this.errorMessage = Bundle.CommonFilesPanel_showInterCaseErrorMessage_message(); + return false; + } else { + return true; + } + } } diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/IntraCasePanel.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/IntraCasePanel.java index 420e68dd6e..9edd3b4a68 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/IntraCasePanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/IntraCasePanel.java @@ -52,12 +52,15 @@ public class IntraCasePanel extends javax.swing.JPanel { private ComboBoxModel dataSourcesList = new DataSourceComboBoxModel(); private Map dataSourceMap; private CommonFilesPanel parent; + + private String errorMessage; /** * Creates new form IntraCasePanel */ public IntraCasePanel() { initComponents(); + this.errorMessage = ""; } public void setParent(CommonFilesPanel parent){ @@ -152,10 +155,12 @@ public class IntraCasePanel extends javax.swing.JPanel { private void allDataSourcesRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allDataSourcesRadioButtonActionPerformed selectDataSourceComboBox.setEnabled(!allDataSourcesRadioButton.isSelected()); singleDataSource = false; + this.parent.handleIntraCaseSearchCriteriaChanged(); }//GEN-LAST:event_allDataSourcesRadioButtonActionPerformed private void withinDataSourceRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_withinDataSourceRadioButtonActionPerformed withinDataSourceSelected(withinDataSourceRadioButton.isSelected()); + this.parent.handleIntraCaseSearchCriteriaChanged(); }//GEN-LAST:event_withinDataSourceRadioButtonActionPerformed private void selectDataSourceComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectDataSourceComboBoxActionPerformed @@ -200,4 +205,16 @@ public class IntraCasePanel extends javax.swing.JPanel { void setDataSourceMap(Map dataSourceMap) { this.dataSourceMap = dataSourceMap; } + + @NbBundle.Messages({ + "IntraCasePanel.areSearchCriteriaMet.message=Cannot run intra-case correlation search." + }) + boolean areSearchCriteriaMet() { + if(this.dataSourceMap.isEmpty()){ + this.errorMessage = Bundle.IntraCasePanel_areSearchCriteriaMet_message(); + return false; + } else { + return true; + } + } }