19 package org.sleuthkit.autopsy.discovery.ui;
22 import static java.awt.BorderLayout.CENTER;
23 import java.awt.Color;
24 import java.awt.event.ItemEvent;
25 import java.awt.event.ItemListener;
26 import java.beans.PropertyChangeEvent;
27 import java.beans.PropertyChangeListener;
28 import java.util.ArrayList;
29 import java.util.EnumSet;
30 import java.util.HashSet;
31 import java.util.List;
33 import java.util.logging.Level;
34 import javax.swing.SwingUtilities;
35 import org.apache.commons.lang.StringUtils;
36 import org.openide.util.NbBundle.Messages;
37 import org.openide.windows.WindowManager;
61 final class DiscoveryDialog
extends javax.swing.JDialog {
63 private static final Set<Case.Events> CASE_EVENTS_OF_INTEREST = EnumSet.of(Case.Events.CURRENT_CASE,
64 Case.Events.DATA_SOURCE_ADDED, Case.Events.DATA_SOURCE_DELETED);
65 private static final Set<IngestManager.IngestModuleEvent> INGEST_MODULE_EVENTS_OF_INTEREST = EnumSet.of(IngestManager.IngestModuleEvent.DATA_ADDED);
66 private static final long serialVersionUID = 1L;
67 private final static Logger logger = Logger.getLogger(DiscoveryDialog.class.getName());
68 private ImageFilterPanel imageFilterPanel = null;
69 private VideoFilterPanel videoFilterPanel = null;
70 private DocumentFilterPanel documentFilterPanel = null;
71 private DomainFilterPanel domainFilterPanel = null;
72 private static final Color SELECTED_COLOR =
new Color(216, 230, 242);
73 private static final Color UNSELECTED_COLOR =
new Color(240, 240, 240);
74 private SearchWorker searchWorker = null;
75 private static DiscoveryDialog discDialog;
76 private static volatile boolean shouldUpdate =
false;
77 private SearchData.Type type = SearchData.Type.IMAGE;
78 private final PropertyChangeListener listener;
79 private final Set<BlackboardAttribute> objectsDetected =
new HashSet<>();
80 private final Set<BlackboardAttribute> interestingItems =
new HashSet<>();
81 private final Set<BlackboardAttribute> hashSets =
new HashSet<>();
88 static synchronized DiscoveryDialog getDiscoveryDialogInstance() {
89 if (discDialog == null) {
90 discDialog =
new DiscoveryDialog();
93 discDialog.updateSearchSettings();
102 @Messages(
"DiscoveryDialog.name.text=Discovery")
103 private DiscoveryDialog() {
104 super(WindowManager.getDefault().getMainWindow(), Bundle.DiscoveryDialog_name_text(),
true);
106 listener =
new PropertyChangeListener() {
108 public void propertyChange(PropertyChangeEvent evt) {
109 if (evt.getPropertyName().equals(
"FilterError") && evt.getNewValue() != null) {
110 setValid(evt.getNewValue().toString());
114 updateSearchSettings();
115 groupByCombobox.addItemListener(
new ItemListener() {
117 public void itemStateChanged(ItemEvent event) {
118 if (event.getStateChange() == ItemEvent.SELECTED) {
119 SwingUtilities.invokeLater(() -> {
120 getSelectedFilterPanel().setLastGroupingAttributeType(groupByCombobox.getItemAt(groupByCombobox.getSelectedIndex()));
126 orderByCombobox.addItemListener(
new ItemListener() {
128 public void itemStateChanged(ItemEvent event) {
129 if (event.getStateChange() == ItemEvent.SELECTED) {
130 SwingUtilities.invokeLater(() -> {
131 getSelectedFilterPanel().setLastSortingMethod(orderByCombobox.getItemAt(orderByCombobox.getSelectedIndex()));
136 groupSortingComboBox.addItemListener(
new ItemListener() {
138 public void itemStateChanged(ItemEvent event) {
139 if (event.getStateChange() == ItemEvent.SELECTED) {
140 SwingUtilities.invokeLater(() -> {
141 getSelectedFilterPanel().setLastGroupSortingAlg(groupSortingComboBox.getItemAt(groupSortingComboBox.getSelectedIndex()));
146 Case.addEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, this.
new CasePropertyChangeListener());
147 IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, this.
new ModuleChangeListener());
148 setPreferredSize(
new java.awt.Dimension(1000, 650));
154 void updateSearchSettings() {
156 imageFilterPanel = null;
157 videoFilterPanel = null;
158 documentFilterPanel = null;
159 imageFilterPanel =
new ImageFilterPanel();
160 videoFilterPanel =
new VideoFilterPanel();
161 documentFilterPanel =
new DocumentFilterPanel();
162 domainFilterPanel =
new DomainFilterPanel();
163 unselectAllButtons();
164 imagesButton.setSelected(
true);
165 imagesButton.setEnabled(
false);
166 imagesButton.setBackground(SELECTED_COLOR);
167 imagesButton.setForeground(Color.BLACK);
168 type = SearchData.Type.IMAGE;
169 add(imageFilterPanel, CENTER);
170 imageFilterPanel.addPropertyChangeListener(listener);
179 private void unselectAllButtons() {
180 imagesButton.setSelected(
false);
181 imagesButton.setEnabled(
true);
182 imagesButton.setBackground(UNSELECTED_COLOR);
183 videosButton.setSelected(
false);
184 videosButton.setEnabled(
true);
185 videosButton.setBackground(UNSELECTED_COLOR);
186 documentsButton.setSelected(
false);
187 documentsButton.setEnabled(
true);
188 documentsButton.setBackground(UNSELECTED_COLOR);
189 domainsButton.setSelected(
false);
190 domainsButton.setEnabled(
true);
191 domainsButton.setBackground(UNSELECTED_COLOR);
197 private void updateComboBoxes() {
199 List<GroupingAttributeType> groupingAttrs =
new ArrayList<>();
200 List<SortingMethod> sortingMethods =
new ArrayList<>();
201 groupByCombobox.removeAllItems();
202 if (type == SearchData.Type.DOMAIN) {
203 groupingAttrs.addAll(GroupingAttributeType.getOptionsForGroupingForDomains());
204 sortingMethods.addAll(SortingMethod.getOptionsForOrderingDomains());
206 groupingAttrs.addAll(GroupingAttributeType.getOptionsForGroupingForFiles());
207 sortingMethods.addAll(SortingMethod.getOptionsForOrderingFiles());
209 for (GroupingAttributeType groupingType : groupingAttrs) {
210 addTypeToGroupByComboBox(groupingType);
212 groupByCombobox.setSelectedItem(getSelectedFilterPanel().getLastGroupingAttributeType());
213 orderByCombobox.removeAllItems();
215 for (SortingMethod method : sortingMethods) {
216 if (method != SortingMethod.BY_FREQUENCY || CentralRepository.isEnabled()) {
217 orderByCombobox.addItem(method);
220 orderByCombobox.setSelectedItem(getSelectedFilterPanel().getLastSortingMethod());
221 groupSortingComboBox.removeAllItems();
222 for (GroupSortingAlgorithm groupSortAlgorithm : GroupSortingAlgorithm.values()) {
223 groupSortingComboBox.addItem(groupSortAlgorithm);
225 groupSortingComboBox.setSelectedItem(getSelectedFilterPanel().getLastGroupSortingAlg());
233 private AbstractFiltersPanel getSelectedFilterPanel() {
236 return imageFilterPanel;
238 return videoFilterPanel;
240 return documentFilterPanel;
242 return domainFilterPanel;
244 return imageFilterPanel;
254 private void addTypeToGroupByComboBox(GroupingAttributeType type) {
257 if (!CentralRepository.isEnabled()) {
261 case OBJECT_DETECTED:
262 if (!imageFilterPanel.isObjectsFilterSupported()) {
266 case INTERESTING_ITEM_SET:
267 if (!imageFilterPanel.isInterestingItemsFilterSupported()) {
272 if (!imageFilterPanel.isHashSetFilterSupported()) {
279 groupByCombobox.addItem(type);
285 synchronized void validateDialog() {
286 AbstractFiltersPanel panel = getSelectedFilterPanel();
288 panel.validateFields();
297 @SuppressWarnings(
"unchecked")
299 private
void initComponents() {
301 javax.swing.JPanel toolBarPanel =
new javax.swing.JPanel();
302 imagesButton =
new javax.swing.JButton();
303 videosButton =
new javax.swing.JButton();
304 documentsButton =
new javax.swing.JButton();
305 javax.swing.JLabel step1Label =
new javax.swing.JLabel();
306 javax.swing.Box.Filler filler1 =
new javax.swing.Box.Filler(
new java.awt.Dimension(104, 0),
new java.awt.Dimension(104, 0),
new java.awt.Dimension(104, 32767));
307 domainsButton =
new javax.swing.JButton();
308 javax.swing.JPanel displaySettingsPanel =
new javax.swing.JPanel();
309 searchButton =
new javax.swing.JButton();
310 errorLabel =
new javax.swing.JLabel();
311 javax.swing.JPanel sortingPanel =
new javax.swing.JPanel();
312 groupByCombobox =
new javax.swing.JComboBox<>();
313 orderByCombobox =
new javax.swing.JComboBox<>();
314 javax.swing.JLabel orderGroupsByLabel =
new javax.swing.JLabel();
315 javax.swing.JLabel orderByLabel =
new javax.swing.JLabel();
316 javax.swing.JLabel groupByLabel =
new javax.swing.JLabel();
317 groupSortingComboBox =
new javax.swing.JComboBox<>();
319 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
320 setMinimumSize(
new java.awt.Dimension(600, 300));
322 imagesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
323 org.openide.awt.Mnemonics.setLocalizedText(imagesButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.imagesButton.text"));
324 imagesButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
325 imagesButton.setFocusable(
false);
326 imagesButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
327 imagesButton.setMaximumSize(
new java.awt.Dimension(90, 43));
328 imagesButton.setMinimumSize(
new java.awt.Dimension(90, 43));
329 imagesButton.setPreferredSize(
new java.awt.Dimension(90, 43));
330 imagesButton.addActionListener(
new java.awt.event.ActionListener() {
331 public void actionPerformed(java.awt.event.ActionEvent evt) {
332 imagesButtonActionPerformed(evt);
336 videosButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
337 org.openide.awt.Mnemonics.setLocalizedText(videosButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.videosButton.text"));
338 videosButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
339 videosButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
340 videosButton.setFocusable(
false);
341 videosButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
342 videosButton.setMaximumSize(
new java.awt.Dimension(90, 43));
343 videosButton.setMinimumSize(
new java.awt.Dimension(90, 43));
344 videosButton.setPreferredSize(
new java.awt.Dimension(90, 43));
345 videosButton.addActionListener(
new java.awt.event.ActionListener() {
346 public void actionPerformed(java.awt.event.ActionEvent evt) {
347 videosButtonActionPerformed(evt);
351 documentsButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
352 org.openide.awt.Mnemonics.setLocalizedText(documentsButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.documentsButton.text"));
353 documentsButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
354 documentsButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
355 documentsButton.setFocusable(
false);
356 documentsButton.addActionListener(
new java.awt.event.ActionListener() {
357 public void actionPerformed(java.awt.event.ActionEvent evt) {
358 documentsButtonActionPerformed(evt);
362 org.openide.awt.Mnemonics.setLocalizedText(step1Label,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.step1Label.text"));
364 domainsButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/domain-32.png")));
365 org.openide.awt.Mnemonics.setLocalizedText(domainsButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.domainsButton.text"));
366 domainsButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/domain-32.png")));
367 domainsButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/domain-32.png")));
368 domainsButton.setFocusable(
false);
369 domainsButton.addActionListener(
new java.awt.event.ActionListener() {
370 public void actionPerformed(java.awt.event.ActionEvent evt) {
371 domainsButtonActionPerformed(evt);
375 javax.swing.GroupLayout toolBarPanelLayout =
new javax.swing.GroupLayout(toolBarPanel);
376 toolBarPanel.setLayout(toolBarPanelLayout);
377 toolBarPanelLayout.setHorizontalGroup(
378 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
379 .addGroup(toolBarPanelLayout.createSequentialGroup()
381 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
382 .addGroup(toolBarPanelLayout.createSequentialGroup()
384 .addComponent(imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
385 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
386 .addComponent(videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
387 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
388 .addComponent(documentsButton)
389 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
390 .addComponent(domainsButton)
391 .addContainerGap(190, Short.MAX_VALUE))
392 .addGroup(toolBarPanelLayout.createSequentialGroup()
393 .addComponent(step1Label, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
394 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
395 .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
396 .addContainerGap(391, Short.MAX_VALUE))))
399 toolBarPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {documentsButton, domainsButton, imagesButton, videosButton});
401 toolBarPanelLayout.setVerticalGroup(
402 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
403 .addGroup(toolBarPanelLayout.createSequentialGroup()
405 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
406 .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
407 .addComponent(step1Label))
409 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
410 .addComponent(videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
411 .addComponent(imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
412 .addComponent(documentsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
413 .addComponent(domainsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
417 getContentPane().add(toolBarPanel, java.awt.BorderLayout.PAGE_START);
419 org.openide.awt.Mnemonics.setLocalizedText(searchButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.searchButton.text"));
420 searchButton.addActionListener(
new java.awt.event.ActionListener() {
421 public void actionPerformed(java.awt.event.ActionEvent evt) {
422 searchButtonActionPerformed(evt);
426 errorLabel.setForeground(
new java.awt.Color(255, 0, 0));
428 sortingPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.sortingPanel.border.title")));
429 sortingPanel.setPreferredSize(
new java.awt.Dimension(345, 112));
431 org.openide.awt.Mnemonics.setLocalizedText(orderGroupsByLabel,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.orderGroupsByLabel.text"));
433 org.openide.awt.Mnemonics.setLocalizedText(orderByLabel,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.orderByLabel.text"));
435 org.openide.awt.Mnemonics.setLocalizedText(groupByLabel,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.groupByLabel.text"));
437 javax.swing.GroupLayout sortingPanelLayout =
new javax.swing.GroupLayout(sortingPanel);
438 sortingPanel.setLayout(sortingPanelLayout);
439 sortingPanelLayout.setHorizontalGroup(
440 sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
441 .addGroup(sortingPanelLayout.createSequentialGroup()
443 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
444 .addComponent(orderGroupsByLabel)
445 .addComponent(groupByLabel))
446 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
447 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
448 .addComponent(groupSortingComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
449 .addComponent(groupByCombobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
450 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
451 .addComponent(orderByLabel)
452 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
453 .addComponent(orderByCombobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
456 sortingPanelLayout.setVerticalGroup(
457 sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
458 .addGroup(sortingPanelLayout.createSequentialGroup()
460 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
461 .addComponent(groupByCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
462 .addComponent(groupByLabel)
463 .addComponent(orderByCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
464 .addComponent(orderByLabel))
466 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
467 .addComponent(groupSortingComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
468 .addComponent(orderGroupsByLabel))
472 javax.swing.GroupLayout displaySettingsPanelLayout =
new javax.swing.GroupLayout(displaySettingsPanel);
473 displaySettingsPanel.setLayout(displaySettingsPanelLayout);
474 displaySettingsPanelLayout.setHorizontalGroup(
475 displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
476 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, displaySettingsPanelLayout.createSequentialGroup()
478 .addGroup(displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
479 .addComponent(sortingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 741, Short.MAX_VALUE)
480 .addGroup(displaySettingsPanelLayout.createSequentialGroup()
481 .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 575, Short.MAX_VALUE)
483 .addComponent(searchButton, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
486 displaySettingsPanelLayout.setVerticalGroup(
487 displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
488 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, displaySettingsPanelLayout.createSequentialGroup()
490 .addComponent(sortingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
492 .addGroup(displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
493 .addComponent(errorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
494 .addComponent(searchButton))
498 getContentPane().add(displaySettingsPanel, java.awt.BorderLayout.PAGE_END);
503 private void imagesButtonActionPerformed(java.awt.event.ActionEvent evt) {
505 add(imageFilterPanel, CENTER);
506 unselectAllButtons();
507 imagesButton.setSelected(
true);
508 imagesButton.setEnabled(
false);
509 imagesButton.setBackground(SELECTED_COLOR);
510 imagesButton.setForeground(Color.BLACK);
511 type = SearchData.Type.IMAGE;
512 imageFilterPanel.addPropertyChangeListener(listener);
519 private void videosButtonActionPerformed(java.awt.event.ActionEvent evt) {
521 add(videoFilterPanel, CENTER);
522 unselectAllButtons();
523 videosButton.setSelected(
true);
524 videosButton.setEnabled(
false);
525 videosButton.setBackground(SELECTED_COLOR);
526 videosButton.setForeground(Color.BLACK);
527 videoFilterPanel.addPropertyChangeListener(listener);
528 type = SearchData.Type.VIDEO;
535 private void documentsButtonActionPerformed(java.awt.event.ActionEvent evt) {
537 add(documentFilterPanel, CENTER);
538 unselectAllButtons();
539 documentsButton.setSelected(
true);
540 documentsButton.setEnabled(
false);
541 documentsButton.setBackground(SELECTED_COLOR);
542 documentsButton.setForeground(Color.BLACK);
543 type = SearchData.Type.DOCUMENT;
544 documentFilterPanel.addPropertyChangeListener(listener);
554 private void removeAllPanels() {
555 if (imageFilterPanel != null) {
556 remove(imageFilterPanel);
557 imageFilterPanel.removePropertyChangeListener(listener);
559 if (domainFilterPanel != null) {
560 remove(domainFilterPanel);
561 domainFilterPanel.removePropertyChangeListener(listener);
563 if (documentFilterPanel != null) {
564 remove(documentFilterPanel);
565 documentFilterPanel.removePropertyChangeListener(listener);
567 if (videoFilterPanel != null) {
568 remove(videoFilterPanel);
569 videoFilterPanel.removePropertyChangeListener(listener);
573 private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {
575 final DiscoveryTopComponent tc = DiscoveryTopComponent.getTopComponent();
577 setValid(
"No Top Component Found");
580 if (tc.isOpened() ==
false) {
583 tc.resetTopComponent();
584 List<AbstractFilter> filters;
585 if (videosButton.isSelected()) {
586 filters = videoFilterPanel.getFilters();
587 }
else if (documentsButton.isSelected()) {
588 filters = documentFilterPanel.getFilters();
589 }
else if (imagesButton.isSelected()) {
590 filters = imageFilterPanel.getFilters();
591 }
else if (domainsButton.isSelected()) {
592 filters = domainFilterPanel.getFilters();
594 logger.log(Level.SEVERE,
"No filter type selected");
595 filters =
new ArrayList<>();
598 DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.SearchStartedEvent(type));
601 DiscoveryAttributes.AttributeType groupingAttr = groupByCombobox.getItemAt(groupByCombobox.getSelectedIndex()).getAttributeType();
602 Group.GroupSortingAlgorithm groupSortAlgorithm = groupSortingComboBox.getItemAt(groupSortingComboBox.getSelectedIndex());
605 ResultsSorter.SortingMethod fileSort = (ResultsSorter.SortingMethod) orderByCombobox.getSelectedItem();
606 CentralRepository centralRepoDb = null;
607 if (CentralRepository.isEnabled()) {
609 centralRepoDb = CentralRepository.getInstance();
610 }
catch (CentralRepoException ex) {
611 centralRepoDb = null;
612 logger.log(Level.SEVERE,
"Error loading central repository database, no central repository options will be available for Discovery", ex);
615 searchWorker =
new SearchWorker(centralRepoDb, type, filters, groupingAttr, groupSortAlgorithm, fileSort);
616 searchWorker.execute();
622 private void domainsButtonActionPerformed(java.awt.event.ActionEvent evt) {
624 add(domainFilterPanel, CENTER);
625 unselectAllButtons();
626 domainsButton.setSelected(
true);
627 domainsButton.setEnabled(
false);
628 domainsButton.setBackground(SELECTED_COLOR);
629 domainsButton.setForeground(Color.BLACK);
630 type = SearchData.Type.DOMAIN;
631 domainFilterPanel.addPropertyChangeListener(listener);
639 public void dispose() {
646 void cancelSearch() {
647 if (searchWorker != null) {
648 searchWorker.cancel(
true);
659 private void setValid(String error) {
660 if (StringUtils.isBlank(error)) {
661 errorLabel.setText(
"");
662 searchButton.setEnabled(
true);
664 errorLabel.setText(error);
665 searchButton.setEnabled(
false);
671 private javax.swing.JButton documentsButton;
672 private javax.swing.JButton domainsButton;
673 private javax.swing.JLabel errorLabel;
674 private javax.swing.JComboBox<GroupingAttributeType> groupByCombobox;
675 private javax.swing.JComboBox<GroupSortingAlgorithm> groupSortingComboBox;
676 private javax.swing.JButton imagesButton;
677 private javax.swing.JComboBox<SortingMethod> orderByCombobox;
678 private javax.swing.JButton searchButton;
679 private javax.swing.JButton videosButton;
689 @SuppressWarnings(
"fallthrough")
691 switch (
Case.
Events.valueOf(evt.getPropertyName())) {
693 if (evt.getNewValue() == null) {
699 case DATA_SOURCE_ADDED:
701 case DATA_SOURCE_DELETED:
718 @SuppressWarnings(
"fallthrough")
721 String eventType = evt.getPropertyName();
738 if (null != eventData) {
740 shouldUpdate =
shouldUpdateFilters(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DESCRIPTION.getTypeID(), eventData, objectsDetected);
741 }
else if (eventData.
getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
742 shouldUpdate =
shouldUpdateFilters(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), eventData, hashSets);
743 }
else if (eventData.
getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID()
744 || eventData.
getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()) {
745 shouldUpdate =
shouldUpdateFilters(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), eventData, interestingItems);
751 }
catch (TskCoreException ex) {
752 logger.log(Level.WARNING,
"Unable to determine if discovery UI should be updated", ex);
776 for (BlackboardArtifact artifact : eventData.getArtifacts()) {
777 if (artifact.getAttributes() != null) {
778 for (BlackboardAttribute attr : artifact.getAttributes()) {
779 if (attr.getAttributeType().getTypeID() == attributeTypeId && !filterSetToCheck.contains(attr)) {
780 filterSetToCheck.add(attr);
Collection< BlackboardArtifact > getArtifacts()
BlackboardArtifact.Type getBlackboardArtifactType()
void propertyChange(PropertyChangeEvent evt)
boolean shouldUpdateFilters(int attributeTypeId, ModuleDataEvent eventData, Set< BlackboardAttribute > filterSetToCheck)
void propertyChange(PropertyChangeEvent evt)
static Case getCurrentCaseThrows()