19 package org.sleuthkit.autopsy.communications;
22 import com.google.common.collect.ImmutableSet;
23 import com.google.common.eventbus.Subscribe;
24 import java.awt.event.ItemListener;
25 import java.beans.PropertyChangeListener;
26 import java.time.Instant;
27 import java.time.LocalDate;
28 import java.time.LocalDateTime;
29 import java.time.ZoneId;
30 import java.util.ArrayList;
31 import java.util.Collection;
32 import java.util.Comparator;
33 import java.util.EnumSet;
34 import java.util.HashMap;
35 import java.util.List;
37 import java.util.Map.Entry;
39 import java.util.stream.Collectors;
40 import javax.swing.Box;
41 import javax.swing.BoxLayout;
42 import javax.swing.Icon;
43 import javax.swing.ImageIcon;
44 import javax.swing.JCheckBox;
45 import javax.swing.JLabel;
46 import javax.swing.JPanel;
47 import org.openide.util.NbBundle;
60 import org.
sleuthkit.datamodel.CommunicationsFilter.AccountTypeFilter;
61 import org.
sleuthkit.datamodel.CommunicationsFilter.DateRangeFilter;
62 import org.
sleuthkit.datamodel.CommunicationsFilter.DeviceFilter;
63 import org.
sleuthkit.datamodel.CommunicationsFilter.MostRecentFilter;
65 import static org.
sleuthkit.datamodel.Relationship.Type.CALL_LOG;
66 import static org.
sleuthkit.datamodel.Relationship.Type.CONTACT;
67 import static org.
sleuthkit.datamodel.Relationship.Type.MESSAGE;
73 @SuppressWarnings(
"PMD.SingularField")
76 private static final long serialVersionUID = 1L;
84 private final Map<Account.Type, JCheckBox> accountTypeMap = new HashMap<>();
90 private final Map<String, JCheckBox> devicesMap = new HashMap<>();
95 private final PropertyChangeListener ingestListener;
96 private final PropertyChangeListener ingestJobListener;
102 private
boolean needsRefresh;
109 private final ItemListener validationListener;
119 private
boolean deviceAccountTypeEnabled;
123 @NbBundle.Messages({
"refreshText=Refresh Results",
"applyText=Apply"})
127 initalizeDeviceAccountType();
128 setDateTimeFiltersToDefault();
130 deviceRequiredLabel.setVisible(
false);
131 accountTypeRequiredLabel.setVisible(
false);
132 startDatePicker.setDate(LocalDate.now().minusWeeks(3));
133 endDatePicker.setDateToToday();
134 startDatePicker.getSettings().setVetoPolicy(
136 startDate -> endCheckBox.isSelected() ==
false
137 || startDate.compareTo(endDatePicker.getDate()) <= 0
139 endDatePicker.getSettings().setVetoPolicy(
141 endDate -> startCheckBox.isSelected() ==
false
142 || endDate.compareTo(startDatePicker.getDate()) >= 0
146 validationListener = itemEvent -> validateFilters();
155 this.ingestListener = pce -> {
156 String eventType = pce.getPropertyName();
157 if (eventType.equals(DATA_ADDED.toString())) {
172 refreshThrottler =
new RefreshThrottler(
new FilterPanelRefresher(
false,
false));
174 this.ingestJobListener = pce -> {
175 String eventType = pce.getPropertyName();
176 if (eventType.equals(COMPLETED.toString()) && !needsRefresh) {
184 applyFiltersButton.addActionListener(e -> applyFilters());
185 refreshButton.addActionListener(e -> applyFilters());
195 boolean someDevice = devicesMap.values().stream().anyMatch(JCheckBox::isSelected);
196 boolean someAccountType = accountTypeMap.values().stream().anyMatch(JCheckBox::isSelected);
197 boolean validLimit = validateLimitValue();
199 deviceRequiredLabel.setVisible(someDevice ==
false);
200 accountTypeRequiredLabel.setVisible(someAccountType ==
false);
201 limitErrorMsgLabel.setVisible(!validLimit);
203 applyFiltersButton.setEnabled(someDevice && someAccountType && validLimit);
204 refreshButton.setEnabled(someDevice && someAccountType && needsRefresh && validLimit);
205 needsRefreshLabel.setVisible(needsRefresh);
209 String selectedValue = (String) limitComboBox.getSelectedItem();
210 if (selectedValue.trim().equalsIgnoreCase(
"all")) {
214 int value = Integer.parseInt(selectedValue);
216 }
catch (NumberFormatException ex) {
222 void initalizeFilters() {
223 Runnable runnable =
new Runnable() {
226 new FilterPanelRefresher(
true,
true).refresh();
239 refreshThrottler.registerForIngestModuleEvents();
245 devicesListPane.removeAll();
247 accountTypeMap.clear();
248 accountTypeListPane.removeAll();
250 initalizeDeviceAccountType();
256 super.removeNotify();
257 refreshThrottler.unregisterEventListener();
263 CheckBoxIconPanel panel = createAccoutTypeCheckBoxPanel(Account.Type.DEVICE,
true);
264 accountTypeMap.put(Account.Type.DEVICE, panel.getCheckBox());
265 accountTypeListPane.add(panel);
277 boolean newOneFound =
false;
279 for (Account.Type type : accountTypesInUse) {
280 if (!accountTypeMap.containsKey(type) && !type.equals(Account.Type.CREDIT_CARD)) {
281 CheckBoxIconPanel panel = createAccoutTypeCheckBoxPanel(type, checkNewOnes);
282 accountTypeMap.put(type, panel.getCheckBox());
283 accountTypeListPane.add(panel);
290 accountTypeListPane.validate();
306 CheckBoxIconPanel panel =
new CheckBoxIconPanel(
307 type.getDisplayName(),
310 panel.setSelected(initalState);
311 panel.addItemListener(validationListener);
324 boolean newOneFound =
false;
325 for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
326 if (devicesMap.containsKey(entry.getValue().getDeviceId())) {
330 final JCheckBox jCheckBox =
new JCheckBox(entry.getKey(), checkNewOnes);
331 jCheckBox.addItemListener(validationListener);
332 jCheckBox.setToolTipText(entry.getKey());
333 devicesListPane.add(jCheckBox);
334 devicesMap.put(entry.getValue().getDeviceId(), jCheckBox);
340 devicesListPane.removeAll();
341 List<JCheckBox> checkList =
new ArrayList<>(devicesMap.values());
342 checkList.sort(
new DeviceCheckBoxComparator());
344 for (JCheckBox cb : checkList) {
345 devicesListPane.add(cb);
348 devicesListPane.revalidate();
353 if (start != null && start != 0) {
357 if (end != null && end != 0) {
369 List<CommunicationsFilter.SubFilter> subFilters = commFilter.getAndFilters();
370 subFilters.forEach(subFilter -> {
371 if (subFilter instanceof DeviceFilter) {
372 setDeviceFilter((DeviceFilter) subFilter);
373 }
else if (subFilter instanceof AccountTypeFilter) {
374 setAccountTypeFilter((AccountTypeFilter) subFilter);
375 }
else if (subFilter instanceof MostRecentFilter) {
376 setMostRecentFilter((MostRecentFilter) subFilter);
387 Collection<String> deviceIDs = deviceFilter.getDevices();
388 devicesMap.forEach((type, cb) -> {
389 cb.setSelected(deviceIDs.contains(type));
401 accountTypeMap.forEach((type, cb) -> {
402 cb.setSelected(typeFilter.getAccountTypes().contains(type));
413 startDatePicker.setDate(state.getDate());
414 startCheckBox.setSelected(state.isEnabled());
415 startDatePicker.setEnabled(state.isEnabled());
425 endDatePicker.setDate(state.getDate());
426 endCheckBox.setSelected(state.isEnabled());
427 endDatePicker.setEnabled(state.isEnabled());
437 int limit = filter.getLimit();
439 limitComboBox.setSelectedItem(filter.getLimit());
441 limitComboBox.setSelectedItem(
"All");
446 void filtersBack(CVTEvents.StateChangeEvent event) {
447 if (event.getCommunicationsState().getCommunicationsFilter() != null) {
448 setFilters(event.getCommunicationsState().getCommunicationsFilter());
449 setStartDateControlState(event.getCommunicationsState().getStartControlState());
450 setEndDateControlState(event.getCommunicationsState().getEndControlState());
451 needsRefresh =
false;
461 @SuppressWarnings(
"unchecked")
463 private
void initComponents() {
464 java.awt.GridBagConstraints gridBagConstraints;
466 setLayout(
new java.awt.GridBagLayout());
468 scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
469 scrollPane.setAutoscrolls(
true);
470 scrollPane.setBorder(null);
472 mainPanel.setLayout(
new java.awt.GridBagLayout());
474 limitPane.setLayout(
new java.awt.GridBagLayout());
476 mostRecentLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.mostRecentLabel.text"));
477 gridBagConstraints =
new java.awt.GridBagConstraints();
478 gridBagConstraints.gridx = 0;
479 gridBagConstraints.gridy = 1;
480 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
481 gridBagConstraints.insets =
new java.awt.Insets(0, 9, 0, 9);
482 limitPane.add(mostRecentLabel, gridBagConstraints);
484 limitComboBox.setEditable(
true);
485 limitComboBox.setModel(
new javax.swing.DefaultComboBoxModel<>(
new String[] {
"All",
"10000",
"5000",
"1000",
"500",
"100" }));
486 limitComboBox.addActionListener(
new java.awt.event.ActionListener() {
487 public void actionPerformed(java.awt.event.ActionEvent evt) {
488 limitComboBoxActionPerformed(evt);
491 gridBagConstraints =
new java.awt.GridBagConstraints();
492 gridBagConstraints.gridx = 1;
493 gridBagConstraints.gridy = 1;
494 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
495 limitPane.add(limitComboBox, gridBagConstraints);
497 limitTitlePanel.setLayout(
new java.awt.GridBagLayout());
499 limitHeaderLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.limitHeaderLabel.text"));
500 gridBagConstraints =
new java.awt.GridBagConstraints();
501 gridBagConstraints.gridx = 0;
502 gridBagConstraints.gridy = 0;
503 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
504 gridBagConstraints.weightx = 1.0;
505 limitTitlePanel.add(limitHeaderLabel, gridBagConstraints);
507 limitErrorMsgLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/error-icon-16.png")));
508 limitErrorMsgLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.limitErrorMsgLabel.text"));
509 limitErrorMsgLabel.setForeground(
new java.awt.Color(255, 0, 0));
510 limitErrorMsgLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
511 gridBagConstraints =
new java.awt.GridBagConstraints();
512 gridBagConstraints.gridx = 1;
513 gridBagConstraints.gridy = 0;
514 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
515 limitTitlePanel.add(limitErrorMsgLabel, gridBagConstraints);
517 gridBagConstraints =
new java.awt.GridBagConstraints();
518 gridBagConstraints.gridx = 0;
519 gridBagConstraints.gridy = 0;
520 gridBagConstraints.gridwidth = 2;
521 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
522 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
523 gridBagConstraints.weightx = 1.0;
524 gridBagConstraints.insets =
new java.awt.Insets(0, 0, 9, 0);
525 limitPane.add(limitTitlePanel, gridBagConstraints);
527 gridBagConstraints =
new java.awt.GridBagConstraints();
528 gridBagConstraints.gridx = 0;
529 gridBagConstraints.gridy = 4;
530 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
531 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
532 gridBagConstraints.weightx = 1.0;
533 gridBagConstraints.weighty = 1.0;
534 gridBagConstraints.insets =
new java.awt.Insets(15, 0, 15, 25);
535 mainPanel.add(limitPane, gridBagConstraints);
537 startDatePicker.setEnabled(
false);
539 dateRangeLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/calendar.png")));
540 dateRangeLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.dateRangeLabel.text"));
542 startCheckBox.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.startCheckBox.text"));
543 startCheckBox.addChangeListener(
new javax.swing.event.ChangeListener() {
544 public void stateChanged(javax.swing.event.ChangeEvent evt) {
545 startCheckBoxStateChanged(evt);
549 endCheckBox.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.endCheckBox.text"));
550 endCheckBox.addChangeListener(
new javax.swing.event.ChangeListener() {
551 public void stateChanged(javax.swing.event.ChangeEvent evt) {
552 endCheckBoxStateChanged(evt);
556 endDatePicker.setEnabled(
false);
558 javax.swing.GroupLayout dateRangePaneLayout =
new javax.swing.GroupLayout(dateRangePane);
559 dateRangePane.setLayout(dateRangePaneLayout);
560 dateRangePaneLayout.setHorizontalGroup(
561 dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
562 .addGroup(dateRangePaneLayout.createSequentialGroup()
563 .addGroup(dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
564 .addComponent(dateRangeLabel)
565 .addGroup(dateRangePaneLayout.createSequentialGroup()
567 .addGroup(dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
568 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, dateRangePaneLayout.createSequentialGroup()
569 .addComponent(endCheckBox)
571 .addComponent(endDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
572 .addGroup(dateRangePaneLayout.createSequentialGroup()
573 .addComponent(startCheckBox)
575 .addComponent(startDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
576 .addGap(0, 0, Short.MAX_VALUE))
579 dateRangePaneLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {endCheckBox, startCheckBox});
581 dateRangePaneLayout.setVerticalGroup(
582 dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
583 .addGroup(dateRangePaneLayout.createSequentialGroup()
584 .addComponent(dateRangeLabel)
586 .addGroup(dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
587 .addComponent(startDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
588 .addComponent(startCheckBox))
589 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
590 .addGroup(dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
591 .addComponent(endDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
592 .addComponent(endCheckBox)))
595 gridBagConstraints =
new java.awt.GridBagConstraints();
596 gridBagConstraints.gridx = 0;
597 gridBagConstraints.gridy = 3;
598 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
599 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
600 gridBagConstraints.weightx = 1.0;
601 gridBagConstraints.insets =
new java.awt.Insets(15, 0, 0, 25);
602 mainPanel.add(dateRangePane, gridBagConstraints);
604 devicesPane.setPreferredSize(
new java.awt.Dimension(300, 300));
605 devicesPane.setLayout(
new java.awt.GridBagLayout());
607 unCheckAllDevicesButton.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.unCheckAllDevicesButton.text"));
608 unCheckAllDevicesButton.addActionListener(
new java.awt.event.ActionListener() {
609 public void actionPerformed(java.awt.event.ActionEvent evt) {
610 unCheckAllDevicesButtonActionPerformed(evt);
613 gridBagConstraints =
new java.awt.GridBagConstraints();
614 gridBagConstraints.gridx = 0;
615 gridBagConstraints.gridy = 2;
616 gridBagConstraints.gridwidth = 2;
617 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
618 gridBagConstraints.weightx = 1.0;
619 gridBagConstraints.insets =
new java.awt.Insets(9, 0, 0, 9);
620 devicesPane.add(unCheckAllDevicesButton, gridBagConstraints);
622 devicesLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/image.png")));
623 devicesLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.devicesLabel.text"));
624 gridBagConstraints =
new java.awt.GridBagConstraints();
625 gridBagConstraints.gridx = 0;
626 gridBagConstraints.gridy = 0;
627 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
628 gridBagConstraints.insets =
new java.awt.Insets(0, 0, 9, 0);
629 devicesPane.add(devicesLabel, gridBagConstraints);
631 checkAllDevicesButton.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.checkAllDevicesButton.text"));
632 checkAllDevicesButton.addActionListener(
new java.awt.event.ActionListener() {
633 public void actionPerformed(java.awt.event.ActionEvent evt) {
634 checkAllDevicesButtonActionPerformed(evt);
637 gridBagConstraints =
new java.awt.GridBagConstraints();
638 gridBagConstraints.gridx = 2;
639 gridBagConstraints.gridy = 2;
640 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
641 gridBagConstraints.insets =
new java.awt.Insets(9, 0, 0, 0);
642 devicesPane.add(checkAllDevicesButton, gridBagConstraints);
644 devicesScrollPane.setMaximumSize(
new java.awt.Dimension(32767, 30));
645 devicesScrollPane.setMinimumSize(
new java.awt.Dimension(27, 30));
646 devicesScrollPane.setPreferredSize(
new java.awt.Dimension(3, 30));
648 devicesListPane.setMinimumSize(
new java.awt.Dimension(4, 100));
649 devicesListPane.setLayout(
new javax.swing.BoxLayout(devicesListPane, javax.swing.BoxLayout.Y_AXIS));
650 devicesScrollPane.setViewportView(devicesListPane);
652 gridBagConstraints =
new java.awt.GridBagConstraints();
653 gridBagConstraints.gridx = 0;
654 gridBagConstraints.gridy = 1;
655 gridBagConstraints.gridwidth = 3;
656 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
657 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
658 gridBagConstraints.weightx = 1.0;
659 gridBagConstraints.weighty = 1.0;
660 devicesPane.add(devicesScrollPane, gridBagConstraints);
662 deviceRequiredLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/error-icon-16.png")));
663 deviceRequiredLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.deviceRequiredLabel.text"));
664 deviceRequiredLabel.setForeground(
new java.awt.Color(255, 0, 0));
665 deviceRequiredLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
666 gridBagConstraints =
new java.awt.GridBagConstraints();
667 gridBagConstraints.gridx = 1;
668 gridBagConstraints.gridy = 0;
669 gridBagConstraints.gridwidth = 2;
670 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
671 gridBagConstraints.insets =
new java.awt.Insets(0, 0, 9, 0);
672 devicesPane.add(deviceRequiredLabel, gridBagConstraints);
674 gridBagConstraints =
new java.awt.GridBagConstraints();
675 gridBagConstraints.gridx = 0;
676 gridBagConstraints.gridy = 2;
677 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
678 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
679 gridBagConstraints.weightx = 1.0;
680 gridBagConstraints.weighty = 1.0;
681 gridBagConstraints.insets =
new java.awt.Insets(15, 0, 0, 25);
682 mainPanel.add(devicesPane, gridBagConstraints);
684 accountTypesPane.setLayout(
new java.awt.GridBagLayout());
686 unCheckAllAccountTypesButton.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.unCheckAllAccountTypesButton.text"));
687 unCheckAllAccountTypesButton.addActionListener(
new java.awt.event.ActionListener() {
688 public void actionPerformed(java.awt.event.ActionEvent evt) {
689 unCheckAllAccountTypesButtonActionPerformed(evt);
692 gridBagConstraints =
new java.awt.GridBagConstraints();
693 gridBagConstraints.gridx = 0;
694 gridBagConstraints.gridy = 2;
695 gridBagConstraints.gridwidth = 2;
696 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
697 gridBagConstraints.weightx = 1.0;
698 gridBagConstraints.insets =
new java.awt.Insets(9, 0, 0, 9);
699 accountTypesPane.add(unCheckAllAccountTypesButton, gridBagConstraints);
701 accountTypesLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/accounts.png")));
702 accountTypesLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.accountTypesLabel.text"));
703 gridBagConstraints =
new java.awt.GridBagConstraints();
704 gridBagConstraints.gridx = 0;
705 gridBagConstraints.gridy = 0;
706 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
707 accountTypesPane.add(accountTypesLabel, gridBagConstraints);
709 checkAllAccountTypesButton.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.checkAllAccountTypesButton.text"));
710 checkAllAccountTypesButton.addActionListener(
new java.awt.event.ActionListener() {
711 public void actionPerformed(java.awt.event.ActionEvent evt) {
712 checkAllAccountTypesButtonActionPerformed(evt);
715 gridBagConstraints =
new java.awt.GridBagConstraints();
716 gridBagConstraints.gridx = 2;
717 gridBagConstraints.gridy = 2;
718 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
719 gridBagConstraints.insets =
new java.awt.Insets(9, 0, 0, 0);
720 accountTypesPane.add(checkAllAccountTypesButton, gridBagConstraints);
722 accountTypesScrollPane.setMaximumSize(
new java.awt.Dimension(32767, 210));
723 accountTypesScrollPane.setMinimumSize(
new java.awt.Dimension(20, 210));
724 accountTypesScrollPane.setName(
"");
725 accountTypesScrollPane.setPreferredSize(
new java.awt.Dimension(2, 210));
727 accountTypeListPane.setLayout(
new javax.swing.BoxLayout(accountTypeListPane, javax.swing.BoxLayout.PAGE_AXIS));
728 accountTypesScrollPane.setViewportView(accountTypeListPane);
730 gridBagConstraints =
new java.awt.GridBagConstraints();
731 gridBagConstraints.gridx = 0;
732 gridBagConstraints.gridy = 1;
733 gridBagConstraints.gridwidth = 3;
734 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
735 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
736 gridBagConstraints.weightx = 1.0;
737 gridBagConstraints.weighty = 1.0;
738 gridBagConstraints.insets =
new java.awt.Insets(9, 0, 0, 0);
739 accountTypesPane.add(accountTypesScrollPane, gridBagConstraints);
741 accountTypeRequiredLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/error-icon-16.png")));
742 accountTypeRequiredLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.accountTypeRequiredLabel.text"));
743 accountTypeRequiredLabel.setForeground(
new java.awt.Color(255, 0, 0));
744 accountTypeRequiredLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
745 gridBagConstraints =
new java.awt.GridBagConstraints();
746 gridBagConstraints.gridx = 1;
747 gridBagConstraints.gridy = 0;
748 gridBagConstraints.gridwidth = 2;
749 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
750 accountTypesPane.add(accountTypeRequiredLabel, gridBagConstraints);
752 gridBagConstraints =
new java.awt.GridBagConstraints();
753 gridBagConstraints.gridx = 0;
754 gridBagConstraints.gridy = 1;
755 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
756 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
757 gridBagConstraints.weightx = 1.0;
758 gridBagConstraints.insets =
new java.awt.Insets(15, 0, 0, 25);
759 mainPanel.add(accountTypesPane, gridBagConstraints);
761 topPane.setLayout(
new java.awt.GridBagLayout());
763 filtersTitleLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/funnel.png")));
764 filtersTitleLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.filtersTitleLabel.text"));
765 gridBagConstraints =
new java.awt.GridBagConstraints();
766 gridBagConstraints.gridx = 0;
767 gridBagConstraints.gridy = 0;
768 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
769 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
770 gridBagConstraints.weightx = 1.0;
771 topPane.add(filtersTitleLabel, gridBagConstraints);
773 refreshButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/arrow-circle-double-135.png")));
774 refreshButton.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.refreshButton.text"));
775 gridBagConstraints =
new java.awt.GridBagConstraints();
776 gridBagConstraints.gridx = 2;
777 gridBagConstraints.gridy = 0;
778 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
779 topPane.add(refreshButton, gridBagConstraints);
781 applyFiltersButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/tick.png")));
782 applyFiltersButton.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.applyFiltersButton.text"));
783 gridBagConstraints =
new java.awt.GridBagConstraints();
784 gridBagConstraints.gridx = 1;
785 gridBagConstraints.gridy = 0;
786 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
787 gridBagConstraints.weightx = 1.0;
788 gridBagConstraints.insets =
new java.awt.Insets(0, 0, 0, 5);
789 topPane.add(applyFiltersButton, gridBagConstraints);
791 needsRefreshLabel.setText(
org.openide.util.NbBundle.getMessage(
FiltersPanel.class,
"FiltersPanel.needsRefreshLabel.text"));
792 needsRefreshLabel.setForeground(
new java.awt.Color(255, 0, 0));
793 gridBagConstraints =
new java.awt.GridBagConstraints();
794 gridBagConstraints.gridx = 0;
795 gridBagConstraints.gridy = 1;
796 gridBagConstraints.gridwidth = 3;
797 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
798 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
799 gridBagConstraints.weightx = 1.0;
800 topPane.add(needsRefreshLabel, gridBagConstraints);
802 gridBagConstraints =
new java.awt.GridBagConstraints();
803 gridBagConstraints.gridx = 0;
804 gridBagConstraints.gridy = 0;
805 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
806 gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_END;
807 gridBagConstraints.weightx = 1.0;
808 gridBagConstraints.insets =
new java.awt.Insets(0, 0, 0, 25);
809 mainPanel.add(topPane, gridBagConstraints);
811 scrollPane.setViewportView(mainPanel);
813 gridBagConstraints =
new java.awt.GridBagConstraints();
814 gridBagConstraints.gridx = 0;
815 gridBagConstraints.gridy = 0;
816 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
817 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
818 gridBagConstraints.weightx = 1.0;
819 gridBagConstraints.weighty = 1.0;
820 gridBagConstraints.insets =
new java.awt.Insets(9, 15, 0, 0);
821 add(scrollPane, gridBagConstraints);
827 void applyFilters() {
828 needsRefresh =
false;
830 CVTEvents.getCVTEventBus().post(
new CVTEvents.FilterChangeEvent(getFilter(), getStartControlState(), getEndControlState()));
840 CommunicationsFilter commsFilter =
new CommunicationsFilter();
841 commsFilter.addAndFilter(getDeviceFilter());
842 commsFilter.addAndFilter(getAccountTypeFilter());
843 commsFilter.addAndFilter(getDateRangeFilter());
844 commsFilter.addAndFilter(
new CommunicationsFilter.RelationshipTypeFilter(
845 ImmutableSet.of(CALL_LOG, MESSAGE, CONTACT)));
846 commsFilter.addAndFilter(getMostRecentFilter());
856 DeviceFilter deviceFilter =
new DeviceFilter(
857 devicesMap.entrySet().stream()
858 .filter(entry -> entry.getValue().isSelected())
860 .collect(Collectors.toSet()));
870 AccountTypeFilter accountTypeFilter =
new AccountTypeFilter(
871 accountTypeMap.entrySet().stream()
872 .filter(entry -> entry.getValue().isSelected())
873 .map(entry -> entry.getKey())
874 .collect(Collectors.toSet()));
875 return accountTypeFilter;
886 return new DateRangeFilter(startCheckBox.isSelected() ? startDatePicker.getDate().atStartOfDay(zone).toEpochSecond() : 0,
887 endCheckBox.isSelected() ? endDatePicker.getDate().atStartOfDay(zone).toEpochSecond() : 0);
897 String value = (String) limitComboBox.getSelectedItem();
898 if (value.trim().equalsIgnoreCase(
"all")) {
899 return new MostRecentFilter(-1);
902 int count = Integer.parseInt(value);
903 return new MostRecentFilter(count);
904 }
catch (NumberFormatException ex) {
911 return new DateControlState(startDatePicker.getDate(), startCheckBox.isSelected());
915 return new DateControlState(endDatePicker.getDate(), endCheckBox.isSelected());
924 private
void setAllAccountTypesSelected(
boolean selected) {
925 setAllSelected(accountTypeMap, selected);
934 private
void setAllDevicesSelected(
boolean selected) {
935 setAllSelected(devicesMap, selected);
946 private
void setAllSelected(Map<?, JCheckBox> map,
boolean selected) {
947 map.values().forEach(box -> box.setSelected(selected));
951 startDatePicker.setDate(LocalDate.now().minusWeeks(3));
952 endDatePicker.setDate(LocalDate.now());
956 setAllAccountTypesSelected(
false);
960 setAllAccountTypesSelected(
true);
964 setAllDevicesSelected(
false);
968 setAllDevicesSelected(
true);
972 startDatePicker.setEnabled(startCheckBox.isSelected());
977 endDatePicker.setEnabled(endCheckBox.isSelected());
990 final class DateControlState {
992 private final LocalDate date;
993 private final boolean enabled;
1002 protected DateControlState(LocalDate date,
boolean enabled) {
1004 this.enabled = enabled;
1012 public LocalDate getDate() {
1021 public boolean isEnabled() {
1028 private final javax.swing.JPanel accountTypeListPane =
new javax.swing.JPanel();
1029 private final javax.swing.JLabel accountTypeRequiredLabel =
new javax.swing.JLabel();
1030 private final javax.swing.JLabel accountTypesLabel =
new javax.swing.JLabel();
1031 private final javax.swing.JPanel accountTypesPane =
new javax.swing.JPanel();
1032 private final javax.swing.JScrollPane accountTypesScrollPane =
new javax.swing.JScrollPane();
1033 private final javax.swing.JButton applyFiltersButton =
new javax.swing.JButton();
1034 private final javax.swing.JButton checkAllAccountTypesButton =
new javax.swing.JButton();
1035 private final javax.swing.JButton checkAllDevicesButton =
new javax.swing.JButton();
1036 private final javax.swing.JLabel dateRangeLabel =
new javax.swing.JLabel();
1037 private final javax.swing.JPanel dateRangePane =
new javax.swing.JPanel();
1038 private final javax.swing.JLabel deviceRequiredLabel =
new javax.swing.JLabel();
1039 private final javax.swing.JLabel devicesLabel =
new javax.swing.JLabel();
1040 private final javax.swing.JPanel devicesListPane =
new javax.swing.JPanel();
1041 private final javax.swing.JPanel devicesPane =
new javax.swing.JPanel();
1042 private final javax.swing.JScrollPane devicesScrollPane =
new javax.swing.JScrollPane();
1043 private final javax.swing.JCheckBox endCheckBox =
new javax.swing.JCheckBox();
1044 private final com.github.lgooddatepicker.components.DatePicker endDatePicker =
new com.github.lgooddatepicker.components.DatePicker();
1045 private final javax.swing.JLabel filtersTitleLabel =
new javax.swing.JLabel();
1046 private final javax.swing.JComboBox<String> limitComboBox =
new javax.swing.JComboBox<>();
1047 private final javax.swing.JLabel limitErrorMsgLabel =
new javax.swing.JLabel();
1048 private final javax.swing.JLabel limitHeaderLabel =
new javax.swing.JLabel();
1049 private final javax.swing.JPanel limitPane =
new javax.swing.JPanel();
1050 private final javax.swing.JPanel limitTitlePanel =
new javax.swing.JPanel();
1051 private final javax.swing.JPanel mainPanel =
new javax.swing.JPanel();
1052 private final javax.swing.JLabel mostRecentLabel =
new javax.swing.JLabel();
1053 private final javax.swing.JLabel needsRefreshLabel =
new javax.swing.JLabel();
1054 private final javax.swing.JButton refreshButton =
new javax.swing.JButton();
1055 private final javax.swing.JScrollPane scrollPane =
new javax.swing.JScrollPane();
1056 private final javax.swing.JCheckBox startCheckBox =
new javax.swing.JCheckBox();
1057 private final com.github.lgooddatepicker.components.DatePicker startDatePicker =
new com.github.lgooddatepicker.components.DatePicker();
1058 private final javax.swing.JPanel topPane =
new javax.swing.JPanel();
1059 private final javax.swing.JButton unCheckAllAccountTypesButton =
new javax.swing.JButton();
1060 private final javax.swing.JButton unCheckAllDevicesButton =
new javax.swing.JButton();
1068 final class CheckBoxIconPanel
extends JPanel {
1070 private static final long serialVersionUID = 1L;
1072 private final JCheckBox checkbox;
1073 private final JLabel label;
1081 private CheckBoxIconPanel(String labelText, Icon image) {
1082 checkbox =
new JCheckBox();
1083 label =
new JLabel(labelText);
1084 label.setIcon(image);
1085 setLayout(
new BoxLayout(
this, BoxLayout.X_AXIS));
1089 add(Box.createHorizontalGlue());
1097 void setSelected(
boolean selected) {
1098 checkbox.setSelected(selected);
1102 public void setEnabled(
boolean enabled) {
1103 checkbox.setEnabled(enabled);
1111 JCheckBox getCheckBox() {
1120 void addItemListener(ItemListener l) {
1121 checkbox.addItemListener(l);
1130 final class FilterPanelRefresher
extends CVTFilterRefresher {
1132 private final boolean selectNewOption;
1133 private final boolean refreshAfterUpdate;
1135 FilterPanelRefresher(
boolean selectNewOptions,
boolean refreshAfterUpdate) {
1136 this.selectNewOption = selectNewOptions;
1137 this.refreshAfterUpdate = refreshAfterUpdate;
1141 void updateFilterPanel(CVTFilterRefresher.FilterPanelData data) {
1142 updateDateTimePicker(data.getStartTime(), data.getEndTime());
1143 updateDeviceFilterPanel(data.getDataSourceMap(), selectNewOption);
1144 updateAccountTypeFilter(data.getAccountTypesInUse(), selectNewOption);
1146 FiltersPanel.this.repaint();
1148 if (refreshAfterUpdate) {
1166 class DeviceCheckBoxComparator
implements Comparator<JCheckBox> {
1169 public int compare(JCheckBox e1, JCheckBox e2) {
1170 return e1.getText().toLowerCase().compareTo(e2.getText().toLowerCase());
BlackboardArtifact.Type getBlackboardArtifactType()
void unCheckAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt)
void removeIngestModuleEventListener(final PropertyChangeListener listener)
void updateDeviceFilterPanel(Map< String, DataSource > dataSourceMap, boolean checkNewOnes)
MostRecentFilter getMostRecentFilter()
void setEndDateControlState(DateControlState state)
static synchronized IngestManager getInstance()
void initalizeDeviceAccountType()
void setMostRecentFilter(MostRecentFilter filter)
void setDeviceFilter(DeviceFilter deviceFilter)
void unCheckAllAccountTypesButtonActionPerformed(java.awt.event.ActionEvent evt)
void endCheckBoxStateChanged(javax.swing.event.ChangeEvent evt)
void startCheckBoxStateChanged(javax.swing.event.ChangeEvent evt)
void removeIngestJobEventListener(final PropertyChangeListener listener)
CheckBoxIconPanel createAccoutTypeCheckBoxPanel(Account.Type type, boolean initalState)
void setStartDateControlState(DateControlState state)
void limitComboBoxActionPerformed(java.awt.event.ActionEvent evt)
static final String DISPLAY_TIMES_IN_LOCAL_TIME
void addIngestJobEventListener(final PropertyChangeListener listener)
void setAccountTypeFilter(AccountTypeFilter typeFilter)
CommunicationsFilter getFilter()
void setFilters(CommunicationsFilter commFilter)
void checkAllAccountTypesButtonActionPerformed(java.awt.event.ActionEvent evt)
static ZoneId getUserPreferredZoneId()
DateControlState getStartControlState()
boolean validateLimitValue()
void addIngestModuleEventListener(final PropertyChangeListener listener)
void setDateTimeFiltersToDefault()
DateControlState getEndControlState()
synchronized static Logger getLogger(String name)
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void addChangeListener(PreferenceChangeListener listener)
void checkAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt)
static final String getIconFilePath(Account.Type type)
DeviceFilter getDeviceFilter()
DateRangeFilter getDateRangeFilter()
AccountTypeFilter getAccountTypeFilter()
boolean updateAccountTypeFilter(List< Account.Type > accountTypesInUse, boolean checkNewOnes)
static final String TIME_ZONE_FOR_DISPLAYS
void updateDateTimePicker(Integer start, Integer end)