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 org.apache.commons.lang.StringUtils;
35 import org.openide.util.NbBundle.Messages;
36 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 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
103 @Messages(
"DiscoveryDialog.name.text=Discovery")
104 private DiscoveryDialog() {
105 super(WindowManager.getDefault().getMainWindow(), Bundle.DiscoveryDialog_name_text(),
true);
107 listener =
new PropertyChangeListener() {
109 public void propertyChange(PropertyChangeEvent evt) {
110 if (evt.getPropertyName().equals(
"FilterError") && evt.getNewValue() != null) {
111 setValid(evt.getNewValue().toString());
115 updateSearchSettings();
116 groupByCombobox.addItemListener(
new ItemListener() {
118 public void itemStateChanged(ItemEvent event) {
119 if (event.getStateChange() == ItemEvent.SELECTED) {
120 getSelectedFilterPanel().setLastGroupingAttributeType(groupByCombobox.getItemAt(groupByCombobox.getSelectedIndex()));
124 orderByCombobox.addItemListener(
new ItemListener() {
126 public void itemStateChanged(ItemEvent event) {
127 if (event.getStateChange() == ItemEvent.SELECTED) {
128 getSelectedFilterPanel().setLastSortingMethod(orderByCombobox.getItemAt(orderByCombobox.getSelectedIndex()));
132 groupSortingComboBox.addItemListener(
new ItemListener() {
134 public void itemStateChanged(ItemEvent event) {
135 if (event.getStateChange() == ItemEvent.SELECTED) {
136 getSelectedFilterPanel().setLastGroupSortingAlg(groupSortingComboBox.getItemAt(groupSortingComboBox.getSelectedIndex()));
140 Case.addEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, this.
new CasePropertyChangeListener());
141 IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, this.
new ModuleChangeListener());
142 setPreferredSize(
new java.awt.Dimension(1000, 800));
148 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
149 void updateSearchSettings() {
151 imageFilterPanel = null;
152 videoFilterPanel = null;
153 documentFilterPanel = null;
154 imageFilterPanel =
new ImageFilterPanel();
155 videoFilterPanel =
new VideoFilterPanel();
156 documentFilterPanel =
new DocumentFilterPanel();
157 domainFilterPanel =
new DomainFilterPanel();
158 unselectAllButtons();
159 imagesButton.setSelected(
true);
160 imagesButton.setEnabled(
false);
161 imagesButton.setBackground(SELECTED_COLOR);
162 imagesButton.setForeground(Color.BLACK);
163 type = SearchData.Type.IMAGE;
164 add(imageFilterPanel, CENTER);
165 imageFilterPanel.addPropertyChangeListener(listener);
174 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
175 private
void unselectAllButtons() {
176 imagesButton.setSelected(
false);
177 imagesButton.setEnabled(
true);
178 imagesButton.setBackground(UNSELECTED_COLOR);
179 videosButton.setSelected(
false);
180 videosButton.setEnabled(
true);
181 videosButton.setBackground(UNSELECTED_COLOR);
182 documentsButton.setSelected(
false);
183 documentsButton.setEnabled(
true);
184 documentsButton.setBackground(UNSELECTED_COLOR);
185 domainsButton.setSelected(
false);
186 domainsButton.setEnabled(
true);
187 domainsButton.setBackground(UNSELECTED_COLOR);
193 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
194 private
void updateComboBoxes() {
196 List<GroupingAttributeType> groupingAttrs =
new ArrayList<>();
197 List<SortingMethod> sortingMethods =
new ArrayList<>();
198 groupByCombobox.removeAllItems();
199 if (type == SearchData.Type.DOMAIN) {
200 groupingAttrs.addAll(GroupingAttributeType.getOptionsForGroupingForDomains());
201 sortingMethods.addAll(SortingMethod.getOptionsForOrderingDomains());
203 groupingAttrs.addAll(GroupingAttributeType.getOptionsForGroupingForFiles());
204 sortingMethods.addAll(SortingMethod.getOptionsForOrderingFiles());
206 for (GroupingAttributeType groupingType : groupingAttrs) {
207 addTypeToGroupByComboBox(groupingType);
209 groupByCombobox.setSelectedItem(getSelectedFilterPanel().getLastGroupingAttributeType());
210 orderByCombobox.removeAllItems();
212 for (SortingMethod method : sortingMethods) {
213 if (method != SortingMethod.BY_FREQUENCY || CentralRepository.isEnabled()) {
214 orderByCombobox.addItem(method);
217 orderByCombobox.setSelectedItem(getSelectedFilterPanel().getLastSortingMethod());
218 groupSortingComboBox.removeAllItems();
219 for (GroupSortingAlgorithm groupSortAlgorithm : GroupSortingAlgorithm.values()) {
220 groupSortingComboBox.addItem(groupSortAlgorithm);
222 groupSortingComboBox.setSelectedItem(getSelectedFilterPanel().getLastGroupSortingAlg());
230 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
231 private AbstractFiltersPanel getSelectedFilterPanel() {
234 return imageFilterPanel;
236 return videoFilterPanel;
238 return documentFilterPanel;
240 return domainFilterPanel;
242 return imageFilterPanel;
252 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
253 private
void addTypeToGroupByComboBox(GroupingAttributeType type) {
256 if (!CentralRepository.isEnabled()) {
260 case OBJECT_DETECTED:
261 if (!imageFilterPanel.isObjectsFilterSupported()) {
265 case INTERESTING_ITEM_SET:
266 if (!imageFilterPanel.isInterestingItemsFilterSupported()) {
271 if (!imageFilterPanel.isHashSetFilterSupported()) {
278 groupByCombobox.addItem(type);
284 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
285 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));
321 setPreferredSize(
new java.awt.Dimension(1000, 800));
323 imagesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
324 org.openide.awt.Mnemonics.setLocalizedText(imagesButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.imagesButton.text"));
325 imagesButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
326 imagesButton.setFocusable(
false);
327 imagesButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
328 imagesButton.setMaximumSize(
new java.awt.Dimension(90, 43));
329 imagesButton.setMinimumSize(
new java.awt.Dimension(90, 43));
330 imagesButton.setPreferredSize(
new java.awt.Dimension(90, 43));
331 imagesButton.addActionListener(
new java.awt.event.ActionListener() {
332 public void actionPerformed(java.awt.event.ActionEvent evt) {
333 imagesButtonActionPerformed(evt);
337 videosButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
338 org.openide.awt.Mnemonics.setLocalizedText(videosButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.videosButton.text"));
339 videosButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
340 videosButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
341 videosButton.setFocusable(
false);
342 videosButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
343 videosButton.setMaximumSize(
new java.awt.Dimension(90, 43));
344 videosButton.setMinimumSize(
new java.awt.Dimension(90, 43));
345 videosButton.setPreferredSize(
new java.awt.Dimension(90, 43));
346 videosButton.addActionListener(
new java.awt.event.ActionListener() {
347 public void actionPerformed(java.awt.event.ActionEvent evt) {
348 videosButtonActionPerformed(evt);
352 documentsButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
353 org.openide.awt.Mnemonics.setLocalizedText(documentsButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.documentsButton.text"));
354 documentsButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
355 documentsButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
356 documentsButton.setFocusable(
false);
357 documentsButton.addActionListener(
new java.awt.event.ActionListener() {
358 public void actionPerformed(java.awt.event.ActionEvent evt) {
359 documentsButtonActionPerformed(evt);
363 org.openide.awt.Mnemonics.setLocalizedText(step1Label,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.step1Label.text"));
365 domainsButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/domain-32.png")));
366 org.openide.awt.Mnemonics.setLocalizedText(domainsButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.domainsButton.text"));
367 domainsButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/domain-32.png")));
368 domainsButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/domain-32.png")));
369 domainsButton.setFocusable(
false);
370 domainsButton.addActionListener(
new java.awt.event.ActionListener() {
371 public void actionPerformed(java.awt.event.ActionEvent evt) {
372 domainsButtonActionPerformed(evt);
376 javax.swing.GroupLayout toolBarPanelLayout =
new javax.swing.GroupLayout(toolBarPanel);
377 toolBarPanel.setLayout(toolBarPanelLayout);
378 toolBarPanelLayout.setHorizontalGroup(
379 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
380 .addGroup(toolBarPanelLayout.createSequentialGroup()
382 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
383 .addGroup(toolBarPanelLayout.createSequentialGroup()
385 .addComponent(imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
386 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
387 .addComponent(videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
388 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
389 .addComponent(documentsButton)
390 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
391 .addComponent(domainsButton)
392 .addContainerGap(190, Short.MAX_VALUE))
393 .addGroup(toolBarPanelLayout.createSequentialGroup()
394 .addComponent(step1Label, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
395 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
396 .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
397 .addContainerGap(391, Short.MAX_VALUE))))
400 toolBarPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {documentsButton, domainsButton, imagesButton, videosButton});
402 toolBarPanelLayout.setVerticalGroup(
403 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
404 .addGroup(toolBarPanelLayout.createSequentialGroup()
406 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
407 .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
408 .addComponent(step1Label))
410 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
411 .addComponent(videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
412 .addComponent(imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
413 .addComponent(documentsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
414 .addComponent(domainsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
418 getContentPane().add(toolBarPanel, java.awt.BorderLayout.PAGE_START);
420 org.openide.awt.Mnemonics.setLocalizedText(searchButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.searchButton.text"));
421 searchButton.addActionListener(
new java.awt.event.ActionListener() {
422 public void actionPerformed(java.awt.event.ActionEvent evt) {
423 searchButtonActionPerformed(evt);
427 errorLabel.setForeground(
new java.awt.Color(255, 0, 0));
429 sortingPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.sortingPanel.border.title")));
430 sortingPanel.setPreferredSize(
new java.awt.Dimension(345, 112));
432 org.openide.awt.Mnemonics.setLocalizedText(orderGroupsByLabel,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.orderGroupsByLabel.text"));
434 org.openide.awt.Mnemonics.setLocalizedText(orderByLabel,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.orderByLabel.text"));
436 org.openide.awt.Mnemonics.setLocalizedText(groupByLabel,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.groupByLabel.text"));
438 javax.swing.GroupLayout sortingPanelLayout =
new javax.swing.GroupLayout(sortingPanel);
439 sortingPanel.setLayout(sortingPanelLayout);
440 sortingPanelLayout.setHorizontalGroup(
441 sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
442 .addGroup(sortingPanelLayout.createSequentialGroup()
444 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
445 .addComponent(orderGroupsByLabel)
446 .addComponent(groupByLabel))
447 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
448 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
449 .addComponent(groupSortingComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
450 .addComponent(groupByCombobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
451 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
452 .addComponent(orderByLabel)
453 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
454 .addComponent(orderByCombobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
457 sortingPanelLayout.setVerticalGroup(
458 sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
459 .addGroup(sortingPanelLayout.createSequentialGroup()
461 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
462 .addComponent(groupByCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
463 .addComponent(groupByLabel)
464 .addComponent(orderByCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
465 .addComponent(orderByLabel))
467 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
468 .addComponent(groupSortingComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
469 .addComponent(orderGroupsByLabel))
473 javax.swing.GroupLayout displaySettingsPanelLayout =
new javax.swing.GroupLayout(displaySettingsPanel);
474 displaySettingsPanel.setLayout(displaySettingsPanelLayout);
475 displaySettingsPanelLayout.setHorizontalGroup(
476 displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
477 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, displaySettingsPanelLayout.createSequentialGroup()
479 .addGroup(displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
480 .addComponent(sortingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 741, Short.MAX_VALUE)
481 .addGroup(displaySettingsPanelLayout.createSequentialGroup()
482 .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 575, Short.MAX_VALUE)
484 .addComponent(searchButton, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
487 displaySettingsPanelLayout.setVerticalGroup(
488 displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
489 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, displaySettingsPanelLayout.createSequentialGroup()
491 .addComponent(sortingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
493 .addGroup(displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
494 .addComponent(errorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
495 .addComponent(searchButton))
499 getContentPane().add(displaySettingsPanel, java.awt.BorderLayout.PAGE_END);
504 private void imagesButtonActionPerformed(java.awt.event.ActionEvent evt) {
506 add(imageFilterPanel, CENTER);
507 unselectAllButtons();
508 imagesButton.setSelected(
true);
509 imagesButton.setEnabled(
false);
510 imagesButton.setBackground(SELECTED_COLOR);
511 imagesButton.setForeground(Color.BLACK);
512 type = SearchData.Type.IMAGE;
513 imageFilterPanel.addPropertyChangeListener(listener);
520 private void videosButtonActionPerformed(java.awt.event.ActionEvent evt) {
522 add(videoFilterPanel, CENTER);
523 unselectAllButtons();
524 videosButton.setSelected(
true);
525 videosButton.setEnabled(
false);
526 videosButton.setBackground(SELECTED_COLOR);
527 videosButton.setForeground(Color.BLACK);
528 videoFilterPanel.addPropertyChangeListener(listener);
529 type = SearchData.Type.VIDEO;
536 private void documentsButtonActionPerformed(java.awt.event.ActionEvent evt) {
538 add(documentFilterPanel, CENTER);
539 unselectAllButtons();
540 documentsButton.setSelected(
true);
541 documentsButton.setEnabled(
false);
542 documentsButton.setBackground(SELECTED_COLOR);
543 documentsButton.setForeground(Color.BLACK);
544 type = SearchData.Type.DOCUMENT;
545 documentFilterPanel.addPropertyChangeListener(listener);
555 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
556 private
void removeAllPanels() {
557 if (imageFilterPanel != null) {
558 remove(imageFilterPanel);
559 imageFilterPanel.removePropertyChangeListener(listener);
561 if (domainFilterPanel != null) {
562 remove(domainFilterPanel);
563 domainFilterPanel.removePropertyChangeListener(listener);
565 if (documentFilterPanel != null) {
566 remove(documentFilterPanel);
567 documentFilterPanel.removePropertyChangeListener(listener);
569 if (videoFilterPanel != null) {
570 remove(videoFilterPanel);
571 videoFilterPanel.removePropertyChangeListener(listener);
575 private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {
577 final DiscoveryTopComponent tc = DiscoveryTopComponent.getTopComponent();
579 setValid(
"No Top Component Found");
582 if (tc.isOpened() ==
false) {
585 tc.resetTopComponent();
587 List<AbstractFilter> filters;
588 if (videosButton.isSelected()) {
589 filters = videoFilterPanel.getFilters();
590 }
else if (documentsButton.isSelected()) {
591 filters = documentFilterPanel.getFilters();
592 }
else if (imagesButton.isSelected()) {
593 filters = imageFilterPanel.getFilters();
594 }
else if (domainsButton.isSelected()) {
595 filters = domainFilterPanel.getFilters();
597 logger.log(Level.SEVERE,
"No filter type selected");
598 filters =
new ArrayList<>();
601 DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.SearchStartedEvent(type));
604 DiscoveryAttributes.AttributeType groupingAttr = groupByCombobox.getItemAt(groupByCombobox.getSelectedIndex()).getAttributeType();
605 Group.GroupSortingAlgorithm groupSortAlgorithm = groupSortingComboBox.getItemAt(groupSortingComboBox.getSelectedIndex());
608 ResultsSorter.SortingMethod fileSort = (ResultsSorter.SortingMethod) orderByCombobox.getSelectedItem();
609 CentralRepository centralRepoDb = null;
610 if (CentralRepository.isEnabled()) {
612 centralRepoDb = CentralRepository.getInstance();
613 }
catch (CentralRepoException ex) {
614 centralRepoDb = null;
615 logger.log(Level.SEVERE,
"Error loading central repository database, no central repository options will be available for Discovery", ex);
618 searchWorker =
new SearchWorker(centralRepoDb, type, filters, groupingAttr, groupSortAlgorithm, fileSort);
619 searchWorker.execute();
624 private void domainsButtonActionPerformed(java.awt.event.ActionEvent evt) {
626 add(domainFilterPanel, CENTER);
627 unselectAllButtons();
628 domainsButton.setSelected(
true);
629 domainsButton.setEnabled(
false);
630 domainsButton.setBackground(SELECTED_COLOR);
631 domainsButton.setForeground(Color.BLACK);
632 type = SearchData.Type.DOMAIN;
633 domainFilterPanel.addPropertyChangeListener(listener);
640 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
642 public void dispose() {
649 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
650 void cancelSearch() {
651 if (searchWorker != null) {
652 searchWorker.cancel(
true);
664 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
665 private
void setValid(String error) {
666 if (StringUtils.isBlank(error)) {
667 errorLabel.setText(
"");
668 searchButton.setEnabled(
true);
670 errorLabel.setText(error);
671 searchButton.setEnabled(
false);
677 private javax.swing.JButton documentsButton;
678 private javax.swing.JButton domainsButton;
679 private javax.swing.JLabel errorLabel;
680 private javax.swing.JComboBox<GroupingAttributeType> groupByCombobox;
681 private javax.swing.JComboBox<GroupSortingAlgorithm> groupSortingComboBox;
682 private javax.swing.JButton imagesButton;
683 private javax.swing.JComboBox<SortingMethod> orderByCombobox;
684 private javax.swing.JButton searchButton;
685 private javax.swing.JButton videosButton;
695 @SuppressWarnings(
"fallthrough")
697 switch (
Case.
Events.valueOf(evt.getPropertyName())) {
699 if (evt.getNewValue() == null) {
705 case DATA_SOURCE_ADDED:
707 case DATA_SOURCE_DELETED:
724 @SuppressWarnings(
"fallthrough")
727 String eventType = evt.getPropertyName();
744 if (null != eventData) {
746 shouldUpdate =
shouldUpdateFilters(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DESCRIPTION.getTypeID(), eventData, objectsDetected);
747 }
else if (eventData.
getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
748 shouldUpdate =
shouldUpdateFilters(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), eventData, hashSets);
749 }
else if (eventData.
getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID()
750 || eventData.
getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()) {
751 shouldUpdate =
shouldUpdateFilters(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), eventData, interestingItems);
756 }
catch (TskCoreException ex) {
757 logger.log(Level.WARNING,
"Unable to determine if discovery UI should be updated", ex);
781 for (BlackboardArtifact artifact : eventData.getArtifacts()) {
782 if (artifact.getAttributes() != null) {
783 for (BlackboardAttribute attr : artifact.getAttributes()) {
784 if (attr.getAttributeType().getTypeID() == attributeTypeId && !filterSetToCheck.contains(attr)) {
785 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()