diff --git a/Core/src/org/sleuthkit/autopsy/discovery/AbstractFilterPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/AbstractFilterPanel.java index 235a78a420..cfa6d4843b 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/AbstractFilterPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/AbstractFilterPanel.java @@ -12,6 +12,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; /** * @@ -39,15 +41,27 @@ abstract class AbstractFilterPanel extends javax.swing.JPanel implements ActionL constraints.anchor = GridBagConstraints.NORTHWEST; } - void addFilter(AbstractDiscoveryFiltersPanel filterPanel) { + void addFilter(AbstractDiscoveryFiltersPanel filterPanel, int[] indicesSelected) { + filterPanel.configurePanel(true, indicesSelected); + filterPanel.addListeners(this, new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent evt) { + if (!evt.getValueIsAdjusting()) { + validateFields(); + } + } + }); filters.add(filterPanel); + addToGridBagLayout(filterPanel.getCheckbox(), null); + addToGridBagLayout(filterPanel, null); + updateLayout(); } void clearFilters() { filters.clear(); } - final void addToGridBagLayout(Component componentToAdd, Component additionalComponentToAdd) { + private void addToGridBagLayout(Component componentToAdd, Component additionalComponentToAdd) { if (constraints.gridx % 2 == 0) { constraints.weightx = LABEL_WEIGHT; constraints.gridwidth = LABEL_WIDTH; @@ -71,7 +85,7 @@ abstract class AbstractFilterPanel extends javax.swing.JPanel implements ActionL } } - final void updateLayout() { + private void updateLayout() { setLayout(layout); } @@ -81,18 +95,18 @@ abstract class AbstractFilterPanel extends javax.swing.JPanel implements ActionL * * @param error */ - void setInvalid(String error) { + private void setInvalid(String error) { firePropertyChange("FilterError", error, error); } /** * The settings are valid so enable the Search button */ - void setValid() { + private void setValid() { firePropertyChange("FilterError", null, null); } - void validateFields() { + private void validateFields() { String errorString; for (AbstractDiscoveryFiltersPanel filterPanel : filters) { errorString = filterPanel.checkForError(); @@ -130,4 +144,5 @@ abstract class AbstractFilterPanel extends javax.swing.JPanel implements ActionL } return filtersToUse; } + } diff --git a/Core/src/org/sleuthkit/autopsy/discovery/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/discovery/Bundle.properties-MERGED index fd0eea5829..12bbf80636 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/discovery/Bundle.properties-MERGED @@ -183,7 +183,6 @@ ImageThumbnailPanel.isDeleted.text=All instances of file are deleted. # {0} - otherInstanceCount ImageThumbnailPanel.nameLabel.more.text=\ and {0} more OpenDiscoveryAction.resultsIncomplete.text=Results may be incomplete -PastOccurrencesFilterPanel.crFrequencyCheckbox.text=Past Occurrences: ResultFile.score.interestingResult.description=At least one instance of the file has an interesting result associated with it. ResultFile.score.notableFile.description=At least one instance of the file was recognized as notable. ResultFile.score.notableTaggedFile.description=At least one instance of the file is tagged with a notable tag. diff --git a/Core/src/org/sleuthkit/autopsy/discovery/DiscoveryDialog.java b/Core/src/org/sleuthkit/autopsy/discovery/DiscoveryDialog.java index e0eadc7d15..b1ae12120d 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/DiscoveryDialog.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/DiscoveryDialog.java @@ -33,11 +33,14 @@ final class DiscoveryDialog extends javax.swing.JDialog { private static final long serialVersionUID = 1L; private final static Logger logger = Logger.getLogger(DiscoveryDialog.class.getName()); - private final FileSearchPanel filterPanel = new FileSearchPanel(); + private final ImageFilterPanel imageFilterPanel = new ImageFilterPanel(); + private final VideoFilterPanel videoFilterPanel = new VideoFilterPanel(); + private final DocumentFilterPanel documentFilterPanel = new DocumentFilterPanel(); private static final Color SELECTED_COLOR = new Color(216, 230, 242); private static final Color UNSELECTED_COLOR = new Color(240, 240, 240); private SearchWorker searchWorker = null; private static DiscoveryDialog discoveryDialog; + private FileSearchData.FileType fileType = FileSearchData.FileType.IMAGE; private DiscoveryDialog() { this(null, true); @@ -56,7 +59,7 @@ final class DiscoveryDialog extends javax.swing.JDialog { private DiscoveryDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); - filterPanel.addPropertyChangeListener(new PropertyChangeListener() { + PropertyChangeListener listener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getNewValue() instanceof String) { @@ -69,16 +72,18 @@ final class DiscoveryDialog extends javax.swing.JDialog { } } - }); + }; + imageFilterPanel.addPropertyChangeListener(listener); + videoFilterPanel.addPropertyChangeListener(listener); + documentFilterPanel.addPropertyChangeListener(listener); updateSearchSettings(); - add(filterPanel, CENTER); + } /** * Update the search settings to a default state. */ private void updateSearchSettings() { - filterPanel.resetPanel(); imagesButton.setSelected(true); imagesButton.setEnabled(false); imagesButton.setBackground(SELECTED_COLOR); @@ -89,7 +94,11 @@ final class DiscoveryDialog extends javax.swing.JDialog { documentsButton.setSelected(false); documentsButton.setEnabled(true); documentsButton.setBackground(UNSELECTED_COLOR); - filterPanel.setSelectedType(FileSearchData.FileType.IMAGE); + fileType = FileSearchData.FileType.IMAGE; + remove(imageFilterPanel); + remove(videoFilterPanel); + remove(documentFilterPanel); + add(imageFilterPanel, CENTER); } /** @@ -226,6 +235,9 @@ final class DiscoveryDialog extends javax.swing.JDialog { private void imagesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imagesButtonActionPerformed // resetTopComponent(); + remove(videoFilterPanel); + remove(documentFilterPanel); + add(imageFilterPanel, CENTER); imagesButton.setSelected(true); imagesButton.setEnabled(false); imagesButton.setBackground(SELECTED_COLOR); @@ -236,10 +248,13 @@ final class DiscoveryDialog extends javax.swing.JDialog { documentsButton.setSelected(false); documentsButton.setEnabled(true); documentsButton.setBackground(UNSELECTED_COLOR); - filterPanel.setSelectedType(FileSearchData.FileType.IMAGE); + fileType = FileSearchData.FileType.IMAGE; }//GEN-LAST:event_imagesButtonActionPerformed private void videosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_videosButtonActionPerformed + remove(imageFilterPanel); + remove(documentFilterPanel); + add(videoFilterPanel, CENTER); imagesButton.setSelected(false); imagesButton.setEnabled(true); imagesButton.setBackground(UNSELECTED_COLOR); @@ -250,10 +265,13 @@ final class DiscoveryDialog extends javax.swing.JDialog { documentsButton.setSelected(false); documentsButton.setEnabled(true); documentsButton.setBackground(UNSELECTED_COLOR); - filterPanel.setSelectedType(FileSearchData.FileType.VIDEO); + fileType = FileSearchData.FileType.VIDEO; }//GEN-LAST:event_videosButtonActionPerformed private void documentsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_documentsButtonActionPerformed + remove(imageFilterPanel); + remove(documentFilterPanel); + add(documentFilterPanel, CENTER); documentsButton.setSelected(true); documentsButton.setEnabled(false); documentsButton.setBackground(SELECTED_COLOR); @@ -264,7 +282,7 @@ final class DiscoveryDialog extends javax.swing.JDialog { imagesButton.setSelected(false); imagesButton.setEnabled(true); imagesButton.setBackground(UNSELECTED_COLOR); - filterPanel.setSelectedType(FileSearchData.FileType.DOCUMENTS); + fileType = FileSearchData.FileType.DOCUMENTS; }//GEN-LAST:event_documentsButtonActionPerformed private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed @@ -279,15 +297,22 @@ final class DiscoveryDialog extends javax.swing.JDialog { tc.open(); } tc.resetTopComponent(); - List filters = filterPanel.getFilters(); - DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.SearchStartedEvent(filterPanel.getSelectedType())); + List filters; + if (videosButton.isSelected()) { + filters = videoFilterPanel.getFilters(); + } else if (documentsButton.isSelected()) { + filters = documentFilterPanel.getFilters(); + } else { + filters = imageFilterPanel.getFilters(); + } + DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.SearchStartedEvent(fileType)); // Get the grouping attribute and group sorting method - FileSearch.AttributeType groupingAttr = filterPanel.getGroupingAttribute(); - FileGroup.GroupSortingAlgorithm groupSortAlgorithm = filterPanel.getGroupSortingMethod(); + FileSearch.AttributeType groupingAttr = FileSearch.GroupingAttributeType.FILE_SIZE.getAttributeType(); + FileGroup.GroupSortingAlgorithm groupSortAlgorithm = FileGroup.GroupSortingAlgorithm.BY_GROUP_NAME; // Get the file sorting method - FileSorter.SortingMethod fileSort = filterPanel.getFileSortingMethod(); + FileSorter.SortingMethod fileSort = FileSorter.SortingMethod.BY_FILE_NAME; CentralRepository centralRepoDb = null; if (CentralRepository.isEnabled()) { try { @@ -310,7 +335,9 @@ final class DiscoveryDialog extends javax.swing.JDialog { }//GEN-LAST:event_cancelButtonActionPerformed void cancelSearch() { - filterPanel.cancelSearch(); + if (searchWorker != null) { + searchWorker.cancel(true); + } } /** diff --git a/Core/src/org/sleuthkit/autopsy/discovery/DocumentFilterPanel.form b/Core/src/org/sleuthkit/autopsy/discovery/DocumentFilterPanel.form new file mode 100644 index 0000000000..4f9abb50dc --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/DocumentFilterPanel.form @@ -0,0 +1,28 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Core/src/org/sleuthkit/autopsy/discovery/DocumentFilterPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/DocumentFilterPanel.java new file mode 100644 index 0000000000..73f8d389f1 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/DocumentFilterPanel.java @@ -0,0 +1,64 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.discovery; + +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; + +/** + * + * @author wschaefer + */ +final class DocumentFilterPanel extends AbstractFilterPanel { + + private static final long serialVersionUID = 1L; + + /** + * Creates new form DocumentFilterPanel + */ + DocumentFilterPanel() { + initComponents(); + initConstraints(); + SizeFilterPanel sizeFilterPanel = new SizeFilterPanel(FileSearchData.FileType.DOCUMENTS); + addFilter(sizeFilterPanel, null); + addFilter(new DataSourceFilterPanel(), null); + int[] pastOccurrencesIndices; + if (!CentralRepository.isEnabled()) { + pastOccurrencesIndices = new int[]{0}; + } else { + pastOccurrencesIndices = new int[]{1, 2, 3, 4, 5, 6, 7}; + } + addFilter(new PastOccurrencesFilterPanel(), pastOccurrencesIndices); + addFilter(new HashSetFilterPanel(), null); + addFilter(new InterestingItemsFilterPanel(), null); + addFilter(new ObjectDetectedFilterPanel(), null); + addFilter(new ParentFolderFilterPanel(), null); + } + + /** + * 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 400, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + ); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + // End of variables declaration//GEN-END:variables +} diff --git a/Core/src/org/sleuthkit/autopsy/discovery/FileSearchPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/FileSearchPanel.java index 1fce33132c..c7a991fc9b 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/FileSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/FileSearchPanel.java @@ -36,6 +36,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.discovery.FileGroup.GroupSortingAlgorithm; import org.sleuthkit.autopsy.discovery.FileSearch.GroupingAttributeType; diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ImageFilterPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ImageFilterPanel.java index 1c62d061b7..c09b6b17b9 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ImageFilterPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ImageFilterPanel.java @@ -5,8 +5,7 @@ */ package org.sleuthkit.autopsy.discovery; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * @@ -22,43 +21,22 @@ final class ImageFilterPanel extends AbstractFilterPanel { ImageFilterPanel() { initComponents(); initConstraints(); - addSizeFilter(); - addDataSourceFilter(); - } - - private void addDataSourceFilter() { - DataSourceFilterPanel dataSourceFilter = new DataSourceFilterPanel(); - dataSourceFilter.configurePanel(true, null); - dataSourceFilter.addListeners(this, new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent evt) { - if (!evt.getValueIsAdjusting()) { - validateFields(); - } - } - }); - addFilter(dataSourceFilter); - addToGridBagLayout(dataSourceFilter.getCheckbox(), null); - addToGridBagLayout(dataSourceFilter, null); - updateLayout(); - } - - private void addSizeFilter() { - SizeFilterPanel sizeFilter = new SizeFilterPanel(FileSearchData.FileType.IMAGE); - int[] indicesSelected = {1, 2, 3, 4, 5}; - sizeFilter.configurePanel(true, indicesSelected); - sizeFilter.addListeners(this, new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent evt) { - if (!evt.getValueIsAdjusting()) { - validateFields(); - } - } - }); - addFilter(sizeFilter); - addToGridBagLayout(sizeFilter.getCheckbox(), null); - addToGridBagLayout(sizeFilter, null); - updateLayout(); + SizeFilterPanel sizeFilterPanel = new SizeFilterPanel(FileSearchData.FileType.IMAGE); + int[] sizeIndicesSelected = {1, 2, 3, 4, 5}; + addFilter(sizeFilterPanel, sizeIndicesSelected); + addFilter(new DataSourceFilterPanel(), null); + int[] pastOccurrencesIndices; + if (!CentralRepository.isEnabled()) { + pastOccurrencesIndices = new int[]{0}; + } else { + pastOccurrencesIndices = new int[]{1, 2, 3, 4, 5, 6, 7}; + } + addFilter(new PastOccurrencesFilterPanel(), pastOccurrencesIndices); + addFilter(new UserCreatedFilterPanel(), null); + addFilter(new HashSetFilterPanel(), null); + addFilter(new InterestingItemsFilterPanel(), null); + addFilter(new ObjectDetectedFilterPanel(), null); + addFilter(new ParentFolderFilterPanel(), null); } /** diff --git a/Core/src/org/sleuthkit/autopsy/discovery/PastOccurrencesFilterPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/PastOccurrencesFilterPanel.java index e186617168..b2aa93fc71 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/PastOccurrencesFilterPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/PastOccurrencesFilterPanel.java @@ -76,7 +76,17 @@ public class PastOccurrencesFilterPanel extends AbstractDiscoveryFiltersPanel { @Override void configurePanel(boolean selected, int[] indicesSelected) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + pastOccurrencesCheckbox.setSelected(selected); + if (pastOccurrencesCheckbox.isEnabled() && pastOccurrencesCheckbox.isSelected()) { + crFrequencyScrollPane.setEnabled(true); + crFrequencyList.setEnabled(true); + if (indicesSelected != null) { + crFrequencyList.setSelectedIndices(indicesSelected); + } + } else { + crFrequencyScrollPane.setEnabled(false); + crFrequencyList.setEnabled(false); + } } @Override diff --git a/Core/src/org/sleuthkit/autopsy/discovery/VideoFilterPanel.form b/Core/src/org/sleuthkit/autopsy/discovery/VideoFilterPanel.form new file mode 100644 index 0000000000..4f9abb50dc --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/VideoFilterPanel.form @@ -0,0 +1,28 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Core/src/org/sleuthkit/autopsy/discovery/VideoFilterPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/VideoFilterPanel.java new file mode 100644 index 0000000000..e8522a0852 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/VideoFilterPanel.java @@ -0,0 +1,65 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.discovery; + +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; + +/** + * + * @author wschaefer + */ +final class VideoFilterPanel extends AbstractFilterPanel { + + private static final long serialVersionUID = 1L; + + /** + * Creates new form VideoFilterPanel + */ + VideoFilterPanel() { + initComponents(); + initConstraints(); + SizeFilterPanel sizeFilterPanel = new SizeFilterPanel(FileSearchData.FileType.VIDEO); + addFilter(sizeFilterPanel, null); + addFilter(new DataSourceFilterPanel(), null); + int[] pastOccurrencesIndices; + if (!CentralRepository.isEnabled()) { + pastOccurrencesIndices = new int[]{0}; + } else { + pastOccurrencesIndices = new int[]{1, 2, 3, 4, 5, 6, 7}; + } + addFilter(new PastOccurrencesFilterPanel(), pastOccurrencesIndices); + addFilter(new UserCreatedFilterPanel(), null); + addFilter(new HashSetFilterPanel(), null); + addFilter(new InterestingItemsFilterPanel(), null); + addFilter(new ObjectDetectedFilterPanel(), null); + addFilter(new ParentFolderFilterPanel(), null); + } + + /** + * 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 400, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + ); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + // End of variables declaration//GEN-END:variables +}