Autopsy  4.19.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
FiltersPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2017-2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.communications;
20 
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;
36 import java.util.Map;
37 import java.util.Map.Entry;
38 import java.util.Set;
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;
57 import org.sleuthkit.datamodel.Account;
58 import org.sleuthkit.datamodel.BlackboardArtifact;
59 import org.sleuthkit.datamodel.CommunicationsFilter;
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;
64 import org.sleuthkit.datamodel.DataSource;
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;
68 
73 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
74 final public class FiltersPanel extends JPanel {
75 
76  private static final long serialVersionUID = 1L;
77  private static final Logger logger = Logger.getLogger(FiltersPanel.class.getName());
78  private static final Set<IngestManager.IngestJobEvent> INGEST_JOB_EVENTS_OF_INTEREST = EnumSet.of(IngestManager.IngestJobEvent.COMPLETED);
79  private static final Set<IngestManager.IngestModuleEvent> INGEST_MODULE_EVENTS_OF_INTEREST = EnumSet.of(DATA_ADDED);
84  private final Map<Account.Type, JCheckBox> accountTypeMap = new HashMap<>();
85 
89  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
90  private final Map<String, JCheckBox> devicesMap = new HashMap<>();
91 
95  private final PropertyChangeListener ingestListener;
96  private final PropertyChangeListener ingestJobListener;
97 
102  private boolean needsRefresh;
103 
109  private final ItemListener validationListener;
110 
111  private final RefreshThrottler refreshThrottler;
112 
119  private boolean deviceAccountTypeEnabled;
120 
121  private Case openCase = null;
122 
123  @NbBundle.Messages({"refreshText=Refresh Results", "applyText=Apply"})
124  public FiltersPanel() {
125  initComponents();
126 
127  initalizeDeviceAccountType();
128  setDateTimeFiltersToDefault();
129 
130  deviceRequiredLabel.setVisible(false);
131  accountTypeRequiredLabel.setVisible(false);
132  startDatePicker.setDate(LocalDate.now().minusWeeks(3));
133  endDatePicker.setDateToToday();
134  startDatePicker.getSettings().setVetoPolicy(
135  //no end date, or start is before end
136  startDate -> endCheckBox.isSelected() == false
137  || startDate.compareTo(endDatePicker.getDate()) <= 0
138  );
139  endDatePicker.getSettings().setVetoPolicy(
140  //no start date, or end is after start
141  endDate -> startCheckBox.isSelected() == false
142  || endDate.compareTo(startDatePicker.getDate()) >= 0
143  );
144 
145  updateTimeZone();
146  validationListener = itemEvent -> validateFilters();
147 
148  UserPreferences.addChangeListener(preferenceChangeEvent -> {
149  if (preferenceChangeEvent.getKey().equals(UserPreferences.DISPLAY_TIMES_IN_LOCAL_TIME)
150  || preferenceChangeEvent.getKey().equals(UserPreferences.TIME_ZONE_FOR_DISPLAYS)) {
151  updateTimeZone();
152  }
153  });
154 
155  this.ingestListener = pce -> {
156  String eventType = pce.getPropertyName();
157  if (eventType.equals(DATA_ADDED.toString())) {
158  // Indicate that a refresh may be needed, unless the data added is Keyword or Hashset hits
159  ModuleDataEvent eventData = (ModuleDataEvent) pce.getOldValue();
160  if (!needsRefresh
161  && null != eventData
162  && (eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()
163  || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT.getTypeID()
164  || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()
165  || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID())) {
166  needsRefresh = true;
167  validateFilters();
168  }
169  }
170  };
171 
172  refreshThrottler = new RefreshThrottler(new FilterPanelRefresher(false, false));
173 
174  this.ingestJobListener = pce -> {
175  String eventType = pce.getPropertyName();
176  if (eventType.equals(COMPLETED.toString()) && !needsRefresh) {
177 
178  needsRefresh = true;
179  validateFilters();
180 
181  }
182  };
183 
184  applyFiltersButton.addActionListener(e -> applyFilters());
185  refreshButton.addActionListener(e -> applyFilters());
186  }
187 
188 
195  private void validateFilters() {
196  boolean someDevice = devicesMap.values().stream().anyMatch(JCheckBox::isSelected);
197  boolean someAccountType = accountTypeMap.values().stream().anyMatch(JCheckBox::isSelected);
198  boolean validLimit = validateLimitValue();
199 
200  deviceRequiredLabel.setVisible(someDevice == false);
201  accountTypeRequiredLabel.setVisible(someAccountType == false);
202  limitErrorMsgLabel.setVisible(!validLimit);
203 
204  applyFiltersButton.setEnabled(someDevice && someAccountType && validLimit);
205  refreshButton.setEnabled(someDevice && someAccountType && needsRefresh && validLimit);
206  needsRefreshLabel.setVisible(needsRefresh);
207  }
208 
209  private boolean validateLimitValue() {
210  String selectedValue = (String) limitComboBox.getSelectedItem();
211  if (selectedValue.trim().equalsIgnoreCase("all")) {
212  return true;
213  } else {
214  try {
215  int value = Integer.parseInt(selectedValue);
216  return value > 0;
217  } catch (NumberFormatException ex) {
218  return false;
219  }
220  }
221  }
222 
223  void initalizeFilters() {
224 
225  applyFiltersButton.setEnabled(false);
226  refreshButton.setEnabled(true);
227  needsRefreshLabel.setText("Loading filters...");
228  needsRefreshLabel.setVisible(true);
229 
230  (new Thread(new Runnable(){
231  @Override
232  public void run() {
233  new FilterPanelRefresher(true, true).refresh();
234  }
235  })).start();
236  }
237 
238  private void updateTimeZone() {
239  dateRangeLabel.setText("Date Range (" + Utils.getUserPreferredZoneId().toString() + "):");
240  }
241 
242  @Override
243  public void addNotify() {
244  super.addNotify();
245  refreshThrottler.registerForIngestModuleEvents();
246  IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, ingestListener);
247  IngestManager.getInstance().addIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, ingestJobListener);
248  Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> {
249  //clear the device filter widget when the case changes.
250  devicesMap.clear();
251  devicesListPane.removeAll();
252 
253  accountTypeMap.clear();
254  accountTypeListPane.removeAll();
255 
256  initalizeDeviceAccountType();
257  });
258  }
259 
260  @Override
261  public void removeNotify() {
262  super.removeNotify();
263  refreshThrottler.unregisterEventListener();
266  }
267 
268  private void initalizeDeviceAccountType() {
269  CheckBoxIconPanel panel = createAccoutTypeCheckBoxPanel(Account.Type.DEVICE, true);
270  accountTypeMap.put(Account.Type.DEVICE, panel.getCheckBox());
271  accountTypeListPane.add(panel);
272  }
273 
282  private boolean updateAccountTypeFilter(List<Account.Type> accountTypesInUse, boolean checkNewOnes) {
283  boolean newOneFound = false;
284 
285  for (Account.Type type : accountTypesInUse) {
286  if (!accountTypeMap.containsKey(type) && !type.equals(Account.Type.CREDIT_CARD)) {
287  CheckBoxIconPanel panel = createAccoutTypeCheckBoxPanel(type, checkNewOnes);
288  accountTypeMap.put(type, panel.getCheckBox());
289  accountTypeListPane.add(panel);
290 
291  newOneFound = true;
292  }
293  }
294 
295  if (newOneFound) {
296  accountTypeListPane.validate();
297  }
298 
299  return newOneFound;
300  }
301 
311  private CheckBoxIconPanel createAccoutTypeCheckBoxPanel(Account.Type type, boolean initalState) {
312  CheckBoxIconPanel panel = new CheckBoxIconPanel(
313  type.getDisplayName(),
314  new ImageIcon(FiltersPanel.class.getResource(Utils.getIconFilePath(type))));
315 
316  panel.setSelected(initalState);
317  panel.addItemListener(validationListener);
318  return panel;
319  }
320 
329  private void updateDeviceFilterPanel(Map<String, DataSource> dataSourceMap, boolean checkNewOnes) {
330  boolean newOneFound = false;
331  for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
332  if (devicesMap.containsKey(entry.getValue().getDeviceId())) {
333  continue;
334  }
335 
336  final JCheckBox jCheckBox = new JCheckBox(entry.getKey(), checkNewOnes);
337  jCheckBox.addItemListener(validationListener);
338  jCheckBox.setToolTipText(entry.getKey());
339  devicesListPane.add(jCheckBox);
340  devicesMap.put(entry.getValue().getDeviceId(), jCheckBox);
341 
342  newOneFound = true;
343  }
344 
345  if (newOneFound) {
346  devicesListPane.removeAll();
347  List<JCheckBox> checkList = new ArrayList<>(devicesMap.values());
348  checkList.sort(new DeviceCheckBoxComparator());
349 
350  for (JCheckBox cb : checkList) {
351  devicesListPane.add(cb);
352  }
353 
354  devicesListPane.revalidate();
355  }
356  }
357 
358  private void updateDateTimePicker(Integer start, Integer end) {
359  if (start != null && start != 0) {
360  startDatePicker.setDate(LocalDateTime.ofInstant(Instant.ofEpochSecond(start), Utils.getUserPreferredZoneId()).toLocalDate());
361  }
362 
363  if (end != null && end != 0) {
364  endDatePicker.setDate(LocalDateTime.ofInstant(Instant.ofEpochSecond(end), Utils.getUserPreferredZoneId()).toLocalDate());
365  }
366  }
367 
374  public void setFilters(CommunicationsFilter commFilter) {
375  List<CommunicationsFilter.SubFilter> subFilters = commFilter.getAndFilters();
376  subFilters.forEach(subFilter -> {
377  if (subFilter instanceof DeviceFilter) {
378  setDeviceFilter((DeviceFilter) subFilter);
379  } else if (subFilter instanceof AccountTypeFilter) {
380  setAccountTypeFilter((AccountTypeFilter) subFilter);
381  } else if (subFilter instanceof MostRecentFilter) {
382  setMostRecentFilter((MostRecentFilter) subFilter);
383  }
384  });
385  }
386 
392  private void setDeviceFilter(DeviceFilter deviceFilter) {
393  Collection<String> deviceIDs = deviceFilter.getDevices();
394  devicesMap.forEach((type, cb) -> {
395  cb.setSelected(deviceIDs.contains(type));
396  });
397  }
398 
405  private void setAccountTypeFilter(AccountTypeFilter typeFilter) {
406 
407  accountTypeMap.forEach((type, cb) -> {
408  cb.setSelected(typeFilter.getAccountTypes().contains(type));
409  });
410  }
411 
418  private void setStartDateControlState(DateControlState state) {
419  startDatePicker.setDate(state.getDate());
420  startCheckBox.setSelected(state.isEnabled());
421  startDatePicker.setEnabled(state.isEnabled());
422  }
423 
430  private void setEndDateControlState(DateControlState state) {
431  endDatePicker.setDate(state.getDate());
432  endCheckBox.setSelected(state.isEnabled());
433  endDatePicker.setEnabled(state.isEnabled());
434  }
435 
442  private void setMostRecentFilter(MostRecentFilter filter) {
443  int limit = filter.getLimit();
444  if (limit > 0) {
445  limitComboBox.setSelectedItem(filter.getLimit());
446  } else {
447  limitComboBox.setSelectedItem("All");
448  }
449  }
450 
451  @Subscribe
452  void filtersBack(CVTEvents.StateChangeEvent event) {
453  if (event.getCommunicationsState().getCommunicationsFilter() != null) {
454  setFilters(event.getCommunicationsState().getCommunicationsFilter());
455  setStartDateControlState(event.getCommunicationsState().getStartControlState());
456  setEndDateControlState(event.getCommunicationsState().getEndControlState());
457  needsRefresh = false;
458  validateFilters();
459  }
460  }
461 
467  @SuppressWarnings("unchecked")
468  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
469  private void initComponents() {
470  java.awt.GridBagConstraints gridBagConstraints;
471 
472  setLayout(new java.awt.GridBagLayout());
473 
474  scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
475  scrollPane.setAutoscrolls(true);
476  scrollPane.setBorder(null);
477 
478  mainPanel.setLayout(new java.awt.GridBagLayout());
479 
480  limitPane.setLayout(new java.awt.GridBagLayout());
481 
482  mostRecentLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.mostRecentLabel.text")); // NOI18N
483  gridBagConstraints = new java.awt.GridBagConstraints();
484  gridBagConstraints.gridx = 0;
485  gridBagConstraints.gridy = 1;
486  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
487  gridBagConstraints.insets = new java.awt.Insets(0, 9, 0, 9);
488  limitPane.add(mostRecentLabel, gridBagConstraints);
489 
490  limitComboBox.setEditable(true);
491  limitComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "All", "10000", "5000", "1000", "500", "100" }));
492  limitComboBox.addActionListener(new java.awt.event.ActionListener() {
493  public void actionPerformed(java.awt.event.ActionEvent evt) {
494  limitComboBoxActionPerformed(evt);
495  }
496  });
497  gridBagConstraints = new java.awt.GridBagConstraints();
498  gridBagConstraints.gridx = 1;
499  gridBagConstraints.gridy = 1;
500  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
501  limitPane.add(limitComboBox, gridBagConstraints);
502 
503  limitTitlePanel.setLayout(new java.awt.GridBagLayout());
504 
505  limitHeaderLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.limitHeaderLabel.text")); // NOI18N
506  gridBagConstraints = new java.awt.GridBagConstraints();
507  gridBagConstraints.gridx = 0;
508  gridBagConstraints.gridy = 0;
509  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
510  gridBagConstraints.weightx = 1.0;
511  limitTitlePanel.add(limitHeaderLabel, gridBagConstraints);
512 
513  limitErrorMsgLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/error-icon-16.png"))); // NOI18N
514  limitErrorMsgLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.limitErrorMsgLabel.text")); // NOI18N
515  limitErrorMsgLabel.setForeground(new java.awt.Color(255, 0, 0));
516  limitErrorMsgLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
517  gridBagConstraints = new java.awt.GridBagConstraints();
518  gridBagConstraints.gridx = 1;
519  gridBagConstraints.gridy = 0;
520  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
521  limitTitlePanel.add(limitErrorMsgLabel, gridBagConstraints);
522 
523  gridBagConstraints = new java.awt.GridBagConstraints();
524  gridBagConstraints.gridx = 0;
525  gridBagConstraints.gridy = 0;
526  gridBagConstraints.gridwidth = 2;
527  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
528  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
529  gridBagConstraints.weightx = 1.0;
530  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 0);
531  limitPane.add(limitTitlePanel, gridBagConstraints);
532 
533  gridBagConstraints = new java.awt.GridBagConstraints();
534  gridBagConstraints.gridx = 0;
535  gridBagConstraints.gridy = 4;
536  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
537  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
538  gridBagConstraints.weightx = 1.0;
539  gridBagConstraints.weighty = 1.0;
540  gridBagConstraints.insets = new java.awt.Insets(15, 0, 15, 25);
541  mainPanel.add(limitPane, gridBagConstraints);
542 
543  startDatePicker.setEnabled(false);
544 
545  dateRangeLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/calendar.png"))); // NOI18N
546  dateRangeLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.dateRangeLabel.text")); // NOI18N
547 
548  startCheckBox.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.startCheckBox.text")); // NOI18N
549  startCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
550  public void stateChanged(javax.swing.event.ChangeEvent evt) {
551  startCheckBoxStateChanged(evt);
552  }
553  });
554 
555  endCheckBox.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.endCheckBox.text")); // NOI18N
556  endCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
557  public void stateChanged(javax.swing.event.ChangeEvent evt) {
558  endCheckBoxStateChanged(evt);
559  }
560  });
561 
562  endDatePicker.setEnabled(false);
563 
564  javax.swing.GroupLayout dateRangePaneLayout = new javax.swing.GroupLayout(dateRangePane);
565  dateRangePane.setLayout(dateRangePaneLayout);
566  dateRangePaneLayout.setHorizontalGroup(
567  dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
568  .addGroup(dateRangePaneLayout.createSequentialGroup()
569  .addGroup(dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
570  .addComponent(dateRangeLabel)
571  .addGroup(dateRangePaneLayout.createSequentialGroup()
572  .addContainerGap()
573  .addGroup(dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
574  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, dateRangePaneLayout.createSequentialGroup()
575  .addComponent(endCheckBox)
576  .addGap(12, 12, 12)
577  .addComponent(endDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
578  .addGroup(dateRangePaneLayout.createSequentialGroup()
579  .addComponent(startCheckBox)
580  .addGap(12, 12, 12)
581  .addComponent(startDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
582  .addGap(0, 0, Short.MAX_VALUE))
583  );
584 
585  dateRangePaneLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {endCheckBox, startCheckBox});
586 
587  dateRangePaneLayout.setVerticalGroup(
588  dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
589  .addGroup(dateRangePaneLayout.createSequentialGroup()
590  .addComponent(dateRangeLabel)
591  .addGap(6, 6, 6)
592  .addGroup(dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
593  .addComponent(startDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
594  .addComponent(startCheckBox))
595  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
596  .addGroup(dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
597  .addComponent(endDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
598  .addComponent(endCheckBox)))
599  );
600 
601  gridBagConstraints = new java.awt.GridBagConstraints();
602  gridBagConstraints.gridx = 0;
603  gridBagConstraints.gridy = 3;
604  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
605  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
606  gridBagConstraints.weightx = 1.0;
607  gridBagConstraints.insets = new java.awt.Insets(15, 0, 0, 25);
608  mainPanel.add(dateRangePane, gridBagConstraints);
609 
610  devicesPane.setPreferredSize(new java.awt.Dimension(300, 300));
611  devicesPane.setLayout(new java.awt.GridBagLayout());
612 
613  unCheckAllDevicesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.unCheckAllDevicesButton.text")); // NOI18N
614  unCheckAllDevicesButton.addActionListener(new java.awt.event.ActionListener() {
615  public void actionPerformed(java.awt.event.ActionEvent evt) {
616  unCheckAllDevicesButtonActionPerformed(evt);
617  }
618  });
619  gridBagConstraints = new java.awt.GridBagConstraints();
620  gridBagConstraints.gridx = 0;
621  gridBagConstraints.gridy = 2;
622  gridBagConstraints.gridwidth = 2;
623  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
624  gridBagConstraints.weightx = 1.0;
625  gridBagConstraints.insets = new java.awt.Insets(9, 0, 0, 9);
626  devicesPane.add(unCheckAllDevicesButton, gridBagConstraints);
627 
628  devicesLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/image.png"))); // NOI18N
629  devicesLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.devicesLabel.text")); // NOI18N
630  gridBagConstraints = new java.awt.GridBagConstraints();
631  gridBagConstraints.gridx = 0;
632  gridBagConstraints.gridy = 0;
633  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
634  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 0);
635  devicesPane.add(devicesLabel, gridBagConstraints);
636 
637  checkAllDevicesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.checkAllDevicesButton.text")); // NOI18N
638  checkAllDevicesButton.addActionListener(new java.awt.event.ActionListener() {
639  public void actionPerformed(java.awt.event.ActionEvent evt) {
640  checkAllDevicesButtonActionPerformed(evt);
641  }
642  });
643  gridBagConstraints = new java.awt.GridBagConstraints();
644  gridBagConstraints.gridx = 2;
645  gridBagConstraints.gridy = 2;
646  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
647  gridBagConstraints.insets = new java.awt.Insets(9, 0, 0, 0);
648  devicesPane.add(checkAllDevicesButton, gridBagConstraints);
649 
650  devicesScrollPane.setMaximumSize(new java.awt.Dimension(32767, 30));
651  devicesScrollPane.setMinimumSize(new java.awt.Dimension(27, 30));
652  devicesScrollPane.setPreferredSize(new java.awt.Dimension(3, 30));
653 
654  devicesListPane.setMinimumSize(new java.awt.Dimension(4, 100));
655  devicesListPane.setLayout(new javax.swing.BoxLayout(devicesListPane, javax.swing.BoxLayout.Y_AXIS));
656  devicesScrollPane.setViewportView(devicesListPane);
657 
658  gridBagConstraints = new java.awt.GridBagConstraints();
659  gridBagConstraints.gridx = 0;
660  gridBagConstraints.gridy = 1;
661  gridBagConstraints.gridwidth = 3;
662  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
663  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
664  gridBagConstraints.weightx = 1.0;
665  gridBagConstraints.weighty = 1.0;
666  devicesPane.add(devicesScrollPane, gridBagConstraints);
667 
668  deviceRequiredLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/error-icon-16.png"))); // NOI18N
669  deviceRequiredLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.deviceRequiredLabel.text")); // NOI18N
670  deviceRequiredLabel.setForeground(new java.awt.Color(255, 0, 0));
671  deviceRequiredLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
672  gridBagConstraints = new java.awt.GridBagConstraints();
673  gridBagConstraints.gridx = 1;
674  gridBagConstraints.gridy = 0;
675  gridBagConstraints.gridwidth = 2;
676  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
677  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 0);
678  devicesPane.add(deviceRequiredLabel, gridBagConstraints);
679 
680  gridBagConstraints = new java.awt.GridBagConstraints();
681  gridBagConstraints.gridx = 0;
682  gridBagConstraints.gridy = 2;
683  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
684  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
685  gridBagConstraints.weightx = 1.0;
686  gridBagConstraints.weighty = 1.0;
687  gridBagConstraints.insets = new java.awt.Insets(15, 0, 0, 25);
688  mainPanel.add(devicesPane, gridBagConstraints);
689 
690  accountTypesPane.setLayout(new java.awt.GridBagLayout());
691 
692  unCheckAllAccountTypesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.unCheckAllAccountTypesButton.text")); // NOI18N
693  unCheckAllAccountTypesButton.addActionListener(new java.awt.event.ActionListener() {
694  public void actionPerformed(java.awt.event.ActionEvent evt) {
695  unCheckAllAccountTypesButtonActionPerformed(evt);
696  }
697  });
698  gridBagConstraints = new java.awt.GridBagConstraints();
699  gridBagConstraints.gridx = 0;
700  gridBagConstraints.gridy = 2;
701  gridBagConstraints.gridwidth = 2;
702  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
703  gridBagConstraints.weightx = 1.0;
704  gridBagConstraints.insets = new java.awt.Insets(9, 0, 0, 9);
705  accountTypesPane.add(unCheckAllAccountTypesButton, gridBagConstraints);
706 
707  accountTypesLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/accounts.png"))); // NOI18N
708  accountTypesLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.accountTypesLabel.text")); // NOI18N
709  gridBagConstraints = new java.awt.GridBagConstraints();
710  gridBagConstraints.gridx = 0;
711  gridBagConstraints.gridy = 0;
712  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
713  accountTypesPane.add(accountTypesLabel, gridBagConstraints);
714 
715  checkAllAccountTypesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.checkAllAccountTypesButton.text")); // NOI18N
716  checkAllAccountTypesButton.addActionListener(new java.awt.event.ActionListener() {
717  public void actionPerformed(java.awt.event.ActionEvent evt) {
718  checkAllAccountTypesButtonActionPerformed(evt);
719  }
720  });
721  gridBagConstraints = new java.awt.GridBagConstraints();
722  gridBagConstraints.gridx = 2;
723  gridBagConstraints.gridy = 2;
724  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
725  gridBagConstraints.insets = new java.awt.Insets(9, 0, 0, 0);
726  accountTypesPane.add(checkAllAccountTypesButton, gridBagConstraints);
727 
728  accountTypesScrollPane.setMaximumSize(new java.awt.Dimension(32767, 210));
729  accountTypesScrollPane.setMinimumSize(new java.awt.Dimension(20, 210));
730  accountTypesScrollPane.setName(""); // NOI18N
731  accountTypesScrollPane.setPreferredSize(new java.awt.Dimension(2, 210));
732 
733  accountTypeListPane.setLayout(new javax.swing.BoxLayout(accountTypeListPane, javax.swing.BoxLayout.PAGE_AXIS));
734  accountTypesScrollPane.setViewportView(accountTypeListPane);
735 
736  gridBagConstraints = new java.awt.GridBagConstraints();
737  gridBagConstraints.gridx = 0;
738  gridBagConstraints.gridy = 1;
739  gridBagConstraints.gridwidth = 3;
740  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
741  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
742  gridBagConstraints.weightx = 1.0;
743  gridBagConstraints.weighty = 1.0;
744  gridBagConstraints.insets = new java.awt.Insets(9, 0, 0, 0);
745  accountTypesPane.add(accountTypesScrollPane, gridBagConstraints);
746 
747  accountTypeRequiredLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/error-icon-16.png"))); // NOI18N
748  accountTypeRequiredLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.accountTypeRequiredLabel.text")); // NOI18N
749  accountTypeRequiredLabel.setForeground(new java.awt.Color(255, 0, 0));
750  accountTypeRequiredLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
751  gridBagConstraints = new java.awt.GridBagConstraints();
752  gridBagConstraints.gridx = 1;
753  gridBagConstraints.gridy = 0;
754  gridBagConstraints.gridwidth = 2;
755  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
756  accountTypesPane.add(accountTypeRequiredLabel, gridBagConstraints);
757 
758  gridBagConstraints = new java.awt.GridBagConstraints();
759  gridBagConstraints.gridx = 0;
760  gridBagConstraints.gridy = 1;
761  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
762  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
763  gridBagConstraints.weightx = 1.0;
764  gridBagConstraints.insets = new java.awt.Insets(15, 0, 0, 25);
765  mainPanel.add(accountTypesPane, gridBagConstraints);
766 
767  topPane.setLayout(new java.awt.GridBagLayout());
768 
769  filtersTitleLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/funnel.png"))); // NOI18N
770  filtersTitleLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.filtersTitleLabel.text")); // NOI18N
771  gridBagConstraints = new java.awt.GridBagConstraints();
772  gridBagConstraints.gridx = 0;
773  gridBagConstraints.gridy = 0;
774  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
775  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
776  gridBagConstraints.weightx = 1.0;
777  topPane.add(filtersTitleLabel, gridBagConstraints);
778 
779  refreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/arrow-circle-double-135.png"))); // NOI18N
780  refreshButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.refreshButton.text")); // NOI18N
781  gridBagConstraints = new java.awt.GridBagConstraints();
782  gridBagConstraints.gridx = 2;
783  gridBagConstraints.gridy = 0;
784  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
785  topPane.add(refreshButton, gridBagConstraints);
786 
787  applyFiltersButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/tick.png"))); // NOI18N
788  applyFiltersButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.applyFiltersButton.text")); // NOI18N
789  gridBagConstraints = new java.awt.GridBagConstraints();
790  gridBagConstraints.gridx = 1;
791  gridBagConstraints.gridy = 0;
792  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
793  gridBagConstraints.weightx = 1.0;
794  gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
795  topPane.add(applyFiltersButton, gridBagConstraints);
796 
797  needsRefreshLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.needsRefreshLabel.text")); // NOI18N
798  needsRefreshLabel.setForeground(new java.awt.Color(255, 0, 0));
799  gridBagConstraints = new java.awt.GridBagConstraints();
800  gridBagConstraints.gridx = 0;
801  gridBagConstraints.gridy = 1;
802  gridBagConstraints.gridwidth = 3;
803  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
804  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
805  gridBagConstraints.weightx = 1.0;
806  topPane.add(needsRefreshLabel, gridBagConstraints);
807 
808  gridBagConstraints = new java.awt.GridBagConstraints();
809  gridBagConstraints.gridx = 0;
810  gridBagConstraints.gridy = 0;
811  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
812  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_END;
813  gridBagConstraints.weightx = 1.0;
814  gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 25);
815  mainPanel.add(topPane, gridBagConstraints);
816 
817  scrollPane.setViewportView(mainPanel);
818 
819  gridBagConstraints = new java.awt.GridBagConstraints();
820  gridBagConstraints.gridx = 0;
821  gridBagConstraints.gridy = 0;
822  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
823  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
824  gridBagConstraints.weightx = 1.0;
825  gridBagConstraints.weighty = 1.0;
826  gridBagConstraints.insets = new java.awt.Insets(9, 15, 0, 0);
827  add(scrollPane, gridBagConstraints);
828  }// </editor-fold>//GEN-END:initComponents
829 
833  void applyFilters() {
834  needsRefresh = false;
835  validateFilters();
836  CVTEvents.getCVTEventBus().post(new CVTEvents.FilterChangeEvent(getFilter(), getStartControlState(), getEndControlState()));
837 
838  }
839 
845  private CommunicationsFilter getFilter() {
846  CommunicationsFilter commsFilter = new CommunicationsFilter();
847  commsFilter.addAndFilter(getDeviceFilter());
848  commsFilter.addAndFilter(getAccountTypeFilter());
849  commsFilter.addAndFilter(getDateRangeFilter());
850  commsFilter.addAndFilter(new CommunicationsFilter.RelationshipTypeFilter(
851  ImmutableSet.of(CALL_LOG, MESSAGE, CONTACT)));
852  commsFilter.addAndFilter(getMostRecentFilter());
853  return commsFilter;
854  }
855 
861  private DeviceFilter getDeviceFilter() {
862  DeviceFilter deviceFilter = new DeviceFilter(
863  devicesMap.entrySet().stream()
864  .filter(entry -> entry.getValue().isSelected())
865  .map(Entry::getKey)
866  .collect(Collectors.toSet()));
867  return deviceFilter;
868  }
869 
875  private AccountTypeFilter getAccountTypeFilter() {
876  AccountTypeFilter accountTypeFilter = new AccountTypeFilter(
877  accountTypeMap.entrySet().stream()
878  .filter(entry -> entry.getValue().isSelected())
879  .map(entry -> entry.getKey())
880  .collect(Collectors.toSet()));
881  return accountTypeFilter;
882  }
883 
889  private DateRangeFilter getDateRangeFilter() {
890  ZoneId zone = Utils.getUserPreferredZoneId();
891 
892  return new DateRangeFilter(startCheckBox.isSelected() ? startDatePicker.getDate().atStartOfDay(zone).toEpochSecond() : 0,
893  endCheckBox.isSelected() ? endDatePicker.getDate().atStartOfDay(zone).toEpochSecond() : 0);
894  }
895 
902  private MostRecentFilter getMostRecentFilter() {
903  String value = (String) limitComboBox.getSelectedItem();
904  if (value.trim().equalsIgnoreCase("all")) {
905  return new MostRecentFilter(-1);
906  } else {
907  try {
908  int count = Integer.parseInt(value);
909  return new MostRecentFilter(count);
910  } catch (NumberFormatException ex) {
911  return null;
912  }
913  }
914  }
915 
916  private DateControlState getStartControlState() {
917  return new DateControlState(startDatePicker.getDate(), startCheckBox.isSelected());
918  }
919 
920  private DateControlState getEndControlState() {
921  return new DateControlState(endDatePicker.getDate(), endCheckBox.isSelected());
922  }
923 
930  private void setAllAccountTypesSelected(boolean selected) {
931  setAllSelected(accountTypeMap, selected);
932  }
933 
940  private void setAllDevicesSelected(boolean selected) {
941  setAllSelected(devicesMap, selected);
942  }
943 
952  private void setAllSelected(Map<?, JCheckBox> map, boolean selected) {
953  map.values().forEach(box -> box.setSelected(selected));
954  }
955 
957  startDatePicker.setDate(LocalDate.now().minusWeeks(3));
958  endDatePicker.setDate(LocalDate.now());
959  }
960 
961  private void unCheckAllAccountTypesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unCheckAllAccountTypesButtonActionPerformed
962  setAllAccountTypesSelected(false);
963  }//GEN-LAST:event_unCheckAllAccountTypesButtonActionPerformed
964 
965  private void checkAllAccountTypesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAllAccountTypesButtonActionPerformed
966  setAllAccountTypesSelected(true);
967  }//GEN-LAST:event_checkAllAccountTypesButtonActionPerformed
968 
969  private void unCheckAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unCheckAllDevicesButtonActionPerformed
970  setAllDevicesSelected(false);
971  }//GEN-LAST:event_unCheckAllDevicesButtonActionPerformed
972 
973  private void checkAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAllDevicesButtonActionPerformed
974  setAllDevicesSelected(true);
975  }//GEN-LAST:event_checkAllDevicesButtonActionPerformed
976 
977  private void startCheckBoxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_startCheckBoxStateChanged
978  startDatePicker.setEnabled(startCheckBox.isSelected());
979  validateFilters();
980  }//GEN-LAST:event_startCheckBoxStateChanged
981 
982  private void endCheckBoxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_endCheckBoxStateChanged
983  endDatePicker.setEnabled(endCheckBox.isSelected());
984  validateFilters();
985  }//GEN-LAST:event_endCheckBoxStateChanged
986 
987  private void limitComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_limitComboBoxActionPerformed
988  validateFilters();
989  }//GEN-LAST:event_limitComboBoxActionPerformed
990 
996  final class DateControlState {
997 
998  private final LocalDate date;
999  private final boolean enabled;
1000 
1008  protected DateControlState(LocalDate date, boolean enabled) {
1009  this.date = date;
1010  this.enabled = enabled;
1011  }
1012 
1018  public LocalDate getDate() {
1019  return date;
1020  }
1021 
1027  public boolean isEnabled() {
1028  return enabled;
1029  }
1030 
1031  }
1032 
1033  // Variables declaration - do not modify//GEN-BEGIN:variables
1034  private final javax.swing.JPanel accountTypeListPane = new javax.swing.JPanel();
1035  private final javax.swing.JLabel accountTypeRequiredLabel = new javax.swing.JLabel();
1036  private final javax.swing.JLabel accountTypesLabel = new javax.swing.JLabel();
1037  private final javax.swing.JPanel accountTypesPane = new javax.swing.JPanel();
1038  private final javax.swing.JScrollPane accountTypesScrollPane = new javax.swing.JScrollPane();
1039  private final javax.swing.JButton applyFiltersButton = new javax.swing.JButton();
1040  private final javax.swing.JButton checkAllAccountTypesButton = new javax.swing.JButton();
1041  private final javax.swing.JButton checkAllDevicesButton = new javax.swing.JButton();
1042  private final javax.swing.JLabel dateRangeLabel = new javax.swing.JLabel();
1043  private final javax.swing.JPanel dateRangePane = new javax.swing.JPanel();
1044  private final javax.swing.JLabel deviceRequiredLabel = new javax.swing.JLabel();
1045  private final javax.swing.JLabel devicesLabel = new javax.swing.JLabel();
1046  private final javax.swing.JPanel devicesListPane = new javax.swing.JPanel();
1047  private final javax.swing.JPanel devicesPane = new javax.swing.JPanel();
1048  private final javax.swing.JScrollPane devicesScrollPane = new javax.swing.JScrollPane();
1049  private final javax.swing.JCheckBox endCheckBox = new javax.swing.JCheckBox();
1050  private final com.github.lgooddatepicker.components.DatePicker endDatePicker = new com.github.lgooddatepicker.components.DatePicker();
1051  private final javax.swing.JLabel filtersTitleLabel = new javax.swing.JLabel();
1052  private final javax.swing.JComboBox<String> limitComboBox = new javax.swing.JComboBox<>();
1053  private final javax.swing.JLabel limitErrorMsgLabel = new javax.swing.JLabel();
1054  private final javax.swing.JLabel limitHeaderLabel = new javax.swing.JLabel();
1055  private final javax.swing.JPanel limitPane = new javax.swing.JPanel();
1056  private final javax.swing.JPanel limitTitlePanel = new javax.swing.JPanel();
1057  private final javax.swing.JPanel mainPanel = new javax.swing.JPanel();
1058  private final javax.swing.JLabel mostRecentLabel = new javax.swing.JLabel();
1059  private final javax.swing.JLabel needsRefreshLabel = new javax.swing.JLabel();
1060  private final javax.swing.JButton refreshButton = new javax.swing.JButton();
1061  private final javax.swing.JScrollPane scrollPane = new javax.swing.JScrollPane();
1062  private final javax.swing.JCheckBox startCheckBox = new javax.swing.JCheckBox();
1063  private final com.github.lgooddatepicker.components.DatePicker startDatePicker = new com.github.lgooddatepicker.components.DatePicker();
1064  private final javax.swing.JPanel topPane = new javax.swing.JPanel();
1065  private final javax.swing.JButton unCheckAllAccountTypesButton = new javax.swing.JButton();
1066  private final javax.swing.JButton unCheckAllDevicesButton = new javax.swing.JButton();
1067  // End of variables declaration//GEN-END:variables
1068 
1074  final class CheckBoxIconPanel extends JPanel {
1075 
1076  private static final long serialVersionUID = 1L;
1077 
1078  private final JCheckBox checkbox;
1079  private final JLabel label;
1080 
1087  private CheckBoxIconPanel(String labelText, Icon image) {
1088  checkbox = new JCheckBox();
1089  label = new JLabel(labelText);
1090  label.setIcon(image);
1091  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
1092 
1093  add(checkbox);
1094  add(label);
1095  add(Box.createHorizontalGlue());
1096  }
1097 
1103  void setSelected(boolean selected) {
1104  checkbox.setSelected(selected);
1105  }
1106 
1107  @Override
1108  public void setEnabled(boolean enabled) {
1109  checkbox.setEnabled(enabled);
1110  }
1111 
1117  JCheckBox getCheckBox() {
1118  return checkbox;
1119  }
1120 
1126  void addItemListener(ItemListener l) {
1127  checkbox.addItemListener(l);
1128  }
1129  }
1130 
1136  final class FilterPanelRefresher extends CVTFilterRefresher {
1137 
1138  private final boolean selectNewOption;
1139  private final boolean refreshAfterUpdate;
1140 
1141  FilterPanelRefresher(boolean selectNewOptions, boolean refreshAfterUpdate) {
1142  this.selectNewOption = selectNewOptions;
1143  this.refreshAfterUpdate = refreshAfterUpdate;
1144  }
1145 
1146  @Override
1147  void updateFilterPanel(CVTFilterRefresher.FilterPanelData data) {
1148  updateDateTimePicker(data.getStartTime(), data.getEndTime());
1149  updateDeviceFilterPanel(data.getDataSourceMap(), selectNewOption);
1150  updateAccountTypeFilter(data.getAccountTypesInUse(), selectNewOption);
1151 
1152  FiltersPanel.this.repaint();
1153 
1154  if (refreshAfterUpdate) {
1155  applyFilters();
1156  }
1157 
1158  if (!isEnabled()) {
1159  setEnabled(true);
1160  }
1161 
1162  needsRefreshLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.needsRefreshLabel.text")); // NOI18N
1163 
1164  validateFilters();
1165 
1166  repaint();
1167  }
1168  }
1169 
1174  class DeviceCheckBoxComparator implements Comparator<JCheckBox> {
1175 
1176  @Override
1177  public int compare(JCheckBox e1, JCheckBox e2) {
1178  return e1.getText().toLowerCase().compareTo(e2.getText().toLowerCase());
1179  }
1180  }
1181 }
BlackboardArtifact.Type getBlackboardArtifactType()
void unCheckAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt)
void removeIngestModuleEventListener(final PropertyChangeListener listener)
void updateDeviceFilterPanel(Map< String, DataSource > dataSourceMap, boolean checkNewOnes)
void setEndDateControlState(DateControlState state)
static synchronized IngestManager getInstance()
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)
void addIngestJobEventListener(final PropertyChangeListener listener)
void setAccountTypeFilter(AccountTypeFilter typeFilter)
void setFilters(CommunicationsFilter commFilter)
void checkAllAccountTypesButtonActionPerformed(java.awt.event.ActionEvent evt)
void addIngestModuleEventListener(final PropertyChangeListener listener)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
Definition: Case.java:711
static void addChangeListener(PreferenceChangeListener listener)
void checkAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt)
static final String getIconFilePath(Account.Type type)
Definition: Utils.java:50
boolean updateAccountTypeFilter(List< Account.Type > accountTypesInUse, boolean checkNewOnes)
void updateDateTimePicker(Integer start, Integer end)

Copyright © 2012-2021 Basis Technology. Generated on: Thu Sep 30 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.