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;
62 final class DiscoveryDialog
extends javax.swing.JDialog {
64 private static final Set<Case.Events> CASE_EVENTS_OF_INTEREST = EnumSet.of(Case.Events.CURRENT_CASE,
65 Case.Events.DATA_SOURCE_ADDED, Case.Events.DATA_SOURCE_DELETED);
66 private static final Set<IngestManager.IngestModuleEvent> INGEST_MODULE_EVENTS_OF_INTEREST = EnumSet.of(IngestManager.IngestModuleEvent.DATA_ADDED);
67 private static final long serialVersionUID = 1L;
68 private final static Logger logger = Logger.getLogger(DiscoveryDialog.class.getName());
69 private ImageFilterPanel imageFilterPanel = null;
70 private VideoFilterPanel videoFilterPanel = null;
71 private DocumentFilterPanel documentFilterPanel = null;
72 private DomainFilterPanel domainFilterPanel = null;
73 private static final Color SELECTED_COLOR =
new Color(216, 230, 242);
74 private static final Color UNSELECTED_COLOR =
new Color(240, 240, 240);
75 private SearchWorker searchWorker = null;
76 private static DiscoveryDialog discDialog;
77 private static volatile boolean shouldUpdate =
false;
78 private SearchData.Type type = SearchData.Type.IMAGE;
79 private final PropertyChangeListener listener;
80 private final Set<BlackboardAttribute> objectsDetected =
new HashSet<>();
81 private final Set<BlackboardAttribute> interestingItems =
new HashSet<>();
82 private final Set<BlackboardAttribute> hashSets =
new HashSet<>();
89 static synchronized DiscoveryDialog getDiscoveryDialogInstance() {
90 if (discDialog == null) {
91 discDialog =
new DiscoveryDialog();
94 discDialog.updateSearchSettings();
103 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
104 @Messages(
"DiscoveryDialog.name.text=Discovery")
105 private DiscoveryDialog() {
106 super(WindowManager.getDefault().getMainWindow(), Bundle.DiscoveryDialog_name_text(),
true);
108 listener =
new PropertyChangeListener() {
110 public void propertyChange(PropertyChangeEvent evt) {
111 if (evt.getPropertyName().equals(
"FilterError") && evt.getNewValue() != null) {
112 setValid(evt.getNewValue().toString());
116 updateSearchSettings();
117 groupByCombobox.addItemListener(
new ItemListener() {
119 public void itemStateChanged(ItemEvent event) {
120 if (event.getStateChange() == ItemEvent.SELECTED) {
121 getSelectedFilterPanel().setLastGroupingAttributeType(groupByCombobox.getItemAt(groupByCombobox.getSelectedIndex()));
125 orderByCombobox.addItemListener(
new ItemListener() {
127 public void itemStateChanged(ItemEvent event) {
128 if (event.getStateChange() == ItemEvent.SELECTED) {
129 getSelectedFilterPanel().setLastSortingMethod(orderByCombobox.getItemAt(orderByCombobox.getSelectedIndex()));
133 groupSortingComboBox.addItemListener(
new ItemListener() {
135 public void itemStateChanged(ItemEvent event) {
136 if (event.getStateChange() == ItemEvent.SELECTED) {
137 getSelectedFilterPanel().setLastGroupSortingAlg(groupSortingComboBox.getItemAt(groupSortingComboBox.getSelectedIndex()));
141 Case.addEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, this.
new CasePropertyChangeListener());
142 IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, this.
new ModuleChangeListener());
143 setPreferredSize(
new java.awt.Dimension(1000, 800));
149 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
150 void updateSearchSettings() {
152 imageFilterPanel = null;
153 videoFilterPanel = null;
154 documentFilterPanel = null;
155 imageFilterPanel =
new ImageFilterPanel();
156 videoFilterPanel =
new VideoFilterPanel();
157 documentFilterPanel =
new DocumentFilterPanel();
158 domainFilterPanel =
new DomainFilterPanel();
159 unselectAllButtons();
160 imagesButton.setSelected(
true);
161 imagesButton.setEnabled(
false);
162 imagesButton.setBackground(SELECTED_COLOR);
163 imagesButton.setForeground(Color.BLACK);
164 type = SearchData.Type.IMAGE;
165 add(imageFilterPanel, CENTER);
166 imageFilterPanel.addPropertyChangeListener(listener);
175 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
176 private
void unselectAllButtons() {
177 imagesButton.setSelected(
false);
178 imagesButton.setEnabled(
true);
179 imagesButton.setBackground(UNSELECTED_COLOR);
180 videosButton.setSelected(
false);
181 videosButton.setEnabled(
true);
182 videosButton.setBackground(UNSELECTED_COLOR);
183 documentsButton.setSelected(
false);
184 documentsButton.setEnabled(
true);
185 documentsButton.setBackground(UNSELECTED_COLOR);
186 domainsButton.setSelected(
false);
187 domainsButton.setEnabled(
true);
188 domainsButton.setBackground(UNSELECTED_COLOR);
194 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
195 private
void updateComboBoxes() {
197 List<GroupingAttributeType> groupingAttrs =
new ArrayList<>();
198 List<SortingMethod> sortingMethods =
new ArrayList<>();
199 groupByCombobox.removeAllItems();
200 if (type == SearchData.Type.DOMAIN) {
201 groupingAttrs.addAll(GroupingAttributeType.getOptionsForGroupingForDomains());
202 sortingMethods.addAll(SortingMethod.getOptionsForOrderingDomains());
204 groupingAttrs.addAll(GroupingAttributeType.getOptionsForGroupingForFiles());
205 sortingMethods.addAll(SortingMethod.getOptionsForOrderingFiles());
207 for (GroupingAttributeType groupingType : groupingAttrs) {
208 addTypeToGroupByComboBox(groupingType);
210 groupByCombobox.setSelectedItem(getSelectedFilterPanel().getLastGroupingAttributeType());
211 orderByCombobox.removeAllItems();
213 for (SortingMethod method : sortingMethods) {
214 if (method != SortingMethod.BY_FREQUENCY || CentralRepository.isEnabled()) {
215 orderByCombobox.addItem(method);
218 orderByCombobox.setSelectedItem(getSelectedFilterPanel().getLastSortingMethod());
219 groupSortingComboBox.removeAllItems();
220 for (GroupSortingAlgorithm groupSortAlgorithm : GroupSortingAlgorithm.values()) {
221 groupSortingComboBox.addItem(groupSortAlgorithm);
223 groupSortingComboBox.setSelectedItem(getSelectedFilterPanel().getLastGroupSortingAlg());
231 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
232 private AbstractFiltersPanel getSelectedFilterPanel() {
235 return imageFilterPanel;
237 return videoFilterPanel;
239 return documentFilterPanel;
241 return domainFilterPanel;
243 return imageFilterPanel;
253 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
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 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
286 void validateDialog() {
287 AbstractFiltersPanel panel = getSelectedFilterPanel();
289 panel.validateFields();
298 @SuppressWarnings(
"unchecked")
300 private
void initComponents() {
302 javax.swing.JPanel toolBarPanel =
new javax.swing.JPanel();
303 imagesButton =
new javax.swing.JButton();
304 videosButton =
new javax.swing.JButton();
305 documentsButton =
new javax.swing.JButton();
306 javax.swing.JLabel step1Label =
new javax.swing.JLabel();
307 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));
308 domainsButton =
new javax.swing.JButton();
309 javax.swing.JPanel displaySettingsPanel =
new javax.swing.JPanel();
310 searchButton =
new javax.swing.JButton();
311 errorLabel =
new javax.swing.JLabel();
312 javax.swing.JPanel sortingPanel =
new javax.swing.JPanel();
313 groupByCombobox =
new javax.swing.JComboBox<>();
314 orderByCombobox =
new javax.swing.JComboBox<>();
315 javax.swing.JLabel orderGroupsByLabel =
new javax.swing.JLabel();
316 javax.swing.JLabel orderByLabel =
new javax.swing.JLabel();
317 javax.swing.JLabel groupByLabel =
new javax.swing.JLabel();
318 groupSortingComboBox =
new javax.swing.JComboBox<>();
320 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
321 setMinimumSize(
new java.awt.Dimension(600, 300));
322 setPreferredSize(
new java.awt.Dimension(1000, 800));
324 imagesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
325 org.openide.awt.Mnemonics.setLocalizedText(imagesButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.imagesButton.text"));
326 imagesButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
327 imagesButton.setFocusable(
false);
328 imagesButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
329 imagesButton.setMaximumSize(
new java.awt.Dimension(90, 43));
330 imagesButton.setMinimumSize(
new java.awt.Dimension(90, 43));
331 imagesButton.setPreferredSize(
new java.awt.Dimension(90, 43));
332 imagesButton.addActionListener(
new java.awt.event.ActionListener() {
333 public void actionPerformed(java.awt.event.ActionEvent evt) {
334 imagesButtonActionPerformed(evt);
338 videosButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
339 org.openide.awt.Mnemonics.setLocalizedText(videosButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.videosButton.text"));
340 videosButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
341 videosButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
342 videosButton.setFocusable(
false);
343 videosButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
344 videosButton.setMaximumSize(
new java.awt.Dimension(90, 43));
345 videosButton.setMinimumSize(
new java.awt.Dimension(90, 43));
346 videosButton.setPreferredSize(
new java.awt.Dimension(90, 43));
347 videosButton.addActionListener(
new java.awt.event.ActionListener() {
348 public void actionPerformed(java.awt.event.ActionEvent evt) {
349 videosButtonActionPerformed(evt);
353 documentsButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
354 org.openide.awt.Mnemonics.setLocalizedText(documentsButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.documentsButton.text"));
355 documentsButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
356 documentsButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
357 documentsButton.setFocusable(
false);
358 documentsButton.addActionListener(
new java.awt.event.ActionListener() {
359 public void actionPerformed(java.awt.event.ActionEvent evt) {
360 documentsButtonActionPerformed(evt);
364 org.openide.awt.Mnemonics.setLocalizedText(step1Label,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.step1Label.text"));
366 domainsButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/domain-32.png")));
367 org.openide.awt.Mnemonics.setLocalizedText(domainsButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.domainsButton.text"));
368 domainsButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/domain-32.png")));
369 domainsButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/domain-32.png")));
370 domainsButton.setFocusable(
false);
371 domainsButton.addActionListener(
new java.awt.event.ActionListener() {
372 public void actionPerformed(java.awt.event.ActionEvent evt) {
373 domainsButtonActionPerformed(evt);
377 javax.swing.GroupLayout toolBarPanelLayout =
new javax.swing.GroupLayout(toolBarPanel);
378 toolBarPanel.setLayout(toolBarPanelLayout);
379 toolBarPanelLayout.setHorizontalGroup(
380 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
381 .addGroup(toolBarPanelLayout.createSequentialGroup()
383 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
384 .addGroup(toolBarPanelLayout.createSequentialGroup()
386 .addComponent(imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
387 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
388 .addComponent(videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
389 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
390 .addComponent(documentsButton)
391 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
392 .addComponent(domainsButton)
393 .addContainerGap(190, Short.MAX_VALUE))
394 .addGroup(toolBarPanelLayout.createSequentialGroup()
395 .addComponent(step1Label, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
396 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
397 .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
398 .addContainerGap(391, Short.MAX_VALUE))))
401 toolBarPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {documentsButton, domainsButton, imagesButton, videosButton});
403 toolBarPanelLayout.setVerticalGroup(
404 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
405 .addGroup(toolBarPanelLayout.createSequentialGroup()
407 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
408 .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
409 .addComponent(step1Label))
411 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
412 .addComponent(videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
413 .addComponent(imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
414 .addComponent(documentsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
415 .addComponent(domainsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
419 getContentPane().add(toolBarPanel, java.awt.BorderLayout.PAGE_START);
421 org.openide.awt.Mnemonics.setLocalizedText(searchButton,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.searchButton.text"));
422 searchButton.addActionListener(
new java.awt.event.ActionListener() {
423 public void actionPerformed(java.awt.event.ActionEvent evt) {
424 searchButtonActionPerformed(evt);
428 errorLabel.setForeground(
new java.awt.Color(255, 0, 0));
430 sortingPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.sortingPanel.border.title")));
431 sortingPanel.setPreferredSize(
new java.awt.Dimension(345, 112));
433 org.openide.awt.Mnemonics.setLocalizedText(orderGroupsByLabel,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.orderGroupsByLabel.text"));
435 org.openide.awt.Mnemonics.setLocalizedText(orderByLabel,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.orderByLabel.text"));
437 org.openide.awt.Mnemonics.setLocalizedText(groupByLabel,
org.openide.util.NbBundle.getMessage(DiscoveryDialog.class,
"DiscoveryDialog.groupByLabel.text"));
439 javax.swing.GroupLayout sortingPanelLayout =
new javax.swing.GroupLayout(sortingPanel);
440 sortingPanel.setLayout(sortingPanelLayout);
441 sortingPanelLayout.setHorizontalGroup(
442 sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
443 .addGroup(sortingPanelLayout.createSequentialGroup()
445 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
446 .addComponent(orderGroupsByLabel)
447 .addComponent(groupByLabel))
448 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
449 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
450 .addComponent(groupSortingComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
451 .addComponent(groupByCombobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
452 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
453 .addComponent(orderByLabel)
454 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
455 .addComponent(orderByCombobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
458 sortingPanelLayout.setVerticalGroup(
459 sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
460 .addGroup(sortingPanelLayout.createSequentialGroup()
462 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
463 .addComponent(groupByCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
464 .addComponent(groupByLabel)
465 .addComponent(orderByCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
466 .addComponent(orderByLabel))
468 .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
469 .addComponent(groupSortingComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
470 .addComponent(orderGroupsByLabel))
474 javax.swing.GroupLayout displaySettingsPanelLayout =
new javax.swing.GroupLayout(displaySettingsPanel);
475 displaySettingsPanel.setLayout(displaySettingsPanelLayout);
476 displaySettingsPanelLayout.setHorizontalGroup(
477 displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
478 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, displaySettingsPanelLayout.createSequentialGroup()
480 .addGroup(displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
481 .addComponent(sortingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 741, Short.MAX_VALUE)
482 .addGroup(displaySettingsPanelLayout.createSequentialGroup()
483 .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 575, Short.MAX_VALUE)
485 .addComponent(searchButton, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
488 displaySettingsPanelLayout.setVerticalGroup(
489 displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
490 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, displaySettingsPanelLayout.createSequentialGroup()
492 .addComponent(sortingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
494 .addGroup(displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
495 .addComponent(errorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
496 .addComponent(searchButton))
500 getContentPane().add(displaySettingsPanel, java.awt.BorderLayout.PAGE_END);
505 private void imagesButtonActionPerformed(java.awt.event.ActionEvent evt) {
507 add(imageFilterPanel, CENTER);
508 unselectAllButtons();
509 imagesButton.setSelected(
true);
510 imagesButton.setEnabled(
false);
511 imagesButton.setBackground(SELECTED_COLOR);
512 imagesButton.setForeground(Color.BLACK);
513 type = SearchData.Type.IMAGE;
514 imageFilterPanel.addPropertyChangeListener(listener);
521 private void videosButtonActionPerformed(java.awt.event.ActionEvent evt) {
523 add(videoFilterPanel, CENTER);
524 unselectAllButtons();
525 videosButton.setSelected(
true);
526 videosButton.setEnabled(
false);
527 videosButton.setBackground(SELECTED_COLOR);
528 videosButton.setForeground(Color.BLACK);
529 videoFilterPanel.addPropertyChangeListener(listener);
530 type = SearchData.Type.VIDEO;
537 private void documentsButtonActionPerformed(java.awt.event.ActionEvent evt) {
539 add(documentFilterPanel, CENTER);
540 unselectAllButtons();
541 documentsButton.setSelected(
true);
542 documentsButton.setEnabled(
false);
543 documentsButton.setBackground(SELECTED_COLOR);
544 documentsButton.setForeground(Color.BLACK);
545 type = SearchData.Type.DOCUMENT;
546 documentFilterPanel.addPropertyChangeListener(listener);
556 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
557 private
void removeAllPanels() {
558 if (imageFilterPanel != null) {
559 remove(imageFilterPanel);
560 imageFilterPanel.removePropertyChangeListener(listener);
562 if (domainFilterPanel != null) {
563 remove(domainFilterPanel);
564 domainFilterPanel.removePropertyChangeListener(listener);
566 if (documentFilterPanel != null) {
567 remove(documentFilterPanel);
568 documentFilterPanel.removePropertyChangeListener(listener);
570 if (videoFilterPanel != null) {
571 remove(videoFilterPanel);
572 videoFilterPanel.removePropertyChangeListener(listener);
576 private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {
578 final DiscoveryTopComponent tc = DiscoveryTopComponent.getTopComponent();
580 setValid(
"No Top Component Found");
583 if (tc.isOpened() ==
false) {
586 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();
625 private void domainsButtonActionPerformed(java.awt.event.ActionEvent evt) {
627 add(domainFilterPanel, CENTER);
628 unselectAllButtons();
629 domainsButton.setSelected(
true);
630 domainsButton.setEnabled(
false);
631 domainsButton.setBackground(SELECTED_COLOR);
632 domainsButton.setForeground(Color.BLACK);
633 type = SearchData.Type.DOMAIN;
634 domainFilterPanel.addPropertyChangeListener(listener);
641 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
643 public void dispose() {
650 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
651 void cancelSearch() {
652 if (searchWorker != null) {
653 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);
757 }
catch (TskCoreException ex) {
758 logger.log(Level.WARNING,
"Unable to determine if discovery UI should be updated", ex);
782 for (BlackboardArtifact artifact : eventData.getArtifacts()) {
783 if (artifact.getAttributes() != null) {
784 for (BlackboardAttribute attr : artifact.getAttributes()) {
785 if (attr.getAttributeType().getTypeID() == attributeTypeId && !filterSetToCheck.contains(attr)) {
786 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()