6305 implement document and video panel

This commit is contained in:
William Schaefer 2020-05-18 11:42:54 -04:00
parent a7ad8b5a20
commit fd630b59dc
10 changed files with 277 additions and 62 deletions

View File

@ -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;
}
}

View File

@ -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.

View File

@ -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<FileSearchFiltering.FileFilter> filters = filterPanel.getFilters();
DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.SearchStartedEvent(filterPanel.getSelectedType()));
List<FileSearchFiltering.FileFilter> 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);
}
}
/**

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

View File

@ -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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}

View File

@ -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;

View File

@ -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);
}
/**

View File

@ -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

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

View File

@ -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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}