Autopsy  4.16.0
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 
194  private void validateFilters() {
195  boolean someDevice = devicesMap.values().stream().anyMatch(JCheckBox::isSelected);
196  boolean someAccountType = accountTypeMap.values().stream().anyMatch(JCheckBox::isSelected);
197  boolean validLimit = validateLimitValue();
198 
199  deviceRequiredLabel.setVisible(someDevice == false);
200  accountTypeRequiredLabel.setVisible(someAccountType == false);
201  limitErrorMsgLabel.setVisible(!validLimit);
202 
203  applyFiltersButton.setEnabled(someDevice && someAccountType && validLimit);
204  refreshButton.setEnabled(someDevice && someAccountType && needsRefresh && validLimit);
205  needsRefreshLabel.setVisible(needsRefresh);
206  }
207 
208  private boolean validateLimitValue() {
209  String selectedValue = (String) limitComboBox.getSelectedItem();
210  if (selectedValue.trim().equalsIgnoreCase("all")) {
211  return true;
212  } else {
213  try {
214  int value = Integer.parseInt(selectedValue);
215  return value > 0;
216  } catch (NumberFormatException ex) {
217  return false;
218  }
219  }
220  }
221 
222  void initalizeFilters() {
223  Runnable runnable = new Runnable() {
224  @Override
225  public void run() {
226  new FilterPanelRefresher(true, true).refresh();
227  }
228  };
229  runnable.run();
230  }
231 
232  private void updateTimeZone() {
233  dateRangeLabel.setText("Date Range (" + Utils.getUserPreferredZoneId().toString() + "):");
234  }
235 
236  @Override
237  public void addNotify() {
238  super.addNotify();
239  refreshThrottler.registerForIngestModuleEvents();
240  IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, ingestListener);
241  IngestManager.getInstance().addIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, ingestJobListener);
242  Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> {
243  //clear the device filter widget when the case changes.
244  devicesMap.clear();
245  devicesListPane.removeAll();
246 
247  accountTypeMap.clear();
248  accountTypeListPane.removeAll();
249 
250  initalizeDeviceAccountType();
251  });
252  }
253 
254  @Override
255  public void removeNotify() {
256  super.removeNotify();
257  refreshThrottler.unregisterEventListener();
260  }
261 
262  private void initalizeDeviceAccountType() {
263  CheckBoxIconPanel panel = createAccoutTypeCheckBoxPanel(Account.Type.DEVICE, true);
264  accountTypeMap.put(Account.Type.DEVICE, panel.getCheckBox());
265  accountTypeListPane.add(panel);
266  }
267 
276  private boolean updateAccountTypeFilter(List<Account.Type> accountTypesInUse, boolean checkNewOnes) {
277  boolean newOneFound = false;
278 
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);
284 
285  newOneFound = true;
286  }
287  }
288 
289  if (newOneFound) {
290  accountTypeListPane.validate();
291  }
292 
293  return newOneFound;
294  }
295 
305  private CheckBoxIconPanel createAccoutTypeCheckBoxPanel(Account.Type type, boolean initalState) {
306  CheckBoxIconPanel panel = new CheckBoxIconPanel(
307  type.getDisplayName(),
308  new ImageIcon(FiltersPanel.class.getResource(Utils.getIconFilePath(type))));
309 
310  panel.setSelected(initalState);
311  panel.addItemListener(validationListener);
312  return panel;
313  }
314 
323  private void updateDeviceFilterPanel(Map<String, DataSource> dataSourceMap, boolean checkNewOnes) {
324  boolean newOneFound = false;
325  for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
326  if (devicesMap.containsKey(entry.getValue().getDeviceId())) {
327  continue;
328  }
329 
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);
335 
336  newOneFound = true;
337  }
338 
339  if (newOneFound) {
340  devicesListPane.removeAll();
341  List<JCheckBox> checkList = new ArrayList<>(devicesMap.values());
342  checkList.sort(new DeviceCheckBoxComparator());
343 
344  for (JCheckBox cb : checkList) {
345  devicesListPane.add(cb);
346  }
347 
348  devicesListPane.revalidate();
349  }
350  }
351 
352  private void updateDateTimePicker(Integer start, Integer end) {
353  if (start != null && start != 0) {
354  startDatePicker.setDate(LocalDateTime.ofInstant(Instant.ofEpochSecond(start), Utils.getUserPreferredZoneId()).toLocalDate());
355  }
356 
357  if (end != null && end != 0) {
358  endDatePicker.setDate(LocalDateTime.ofInstant(Instant.ofEpochSecond(end), Utils.getUserPreferredZoneId()).toLocalDate());
359  }
360  }
361 
368  public void setFilters(CommunicationsFilter commFilter) {
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);
377  }
378  });
379  }
380 
386  private void setDeviceFilter(DeviceFilter deviceFilter) {
387  Collection<String> deviceIDs = deviceFilter.getDevices();
388  devicesMap.forEach((type, cb) -> {
389  cb.setSelected(deviceIDs.contains(type));
390  });
391  }
392 
399  private void setAccountTypeFilter(AccountTypeFilter typeFilter) {
400 
401  accountTypeMap.forEach((type, cb) -> {
402  cb.setSelected(typeFilter.getAccountTypes().contains(type));
403  });
404  }
405 
412  private void setStartDateControlState(DateControlState state) {
413  startDatePicker.setDate(state.getDate());
414  startCheckBox.setSelected(state.isEnabled());
415  startDatePicker.setEnabled(state.isEnabled());
416  }
417 
424  private void setEndDateControlState(DateControlState state) {
425  endDatePicker.setDate(state.getDate());
426  endCheckBox.setSelected(state.isEnabled());
427  endDatePicker.setEnabled(state.isEnabled());
428  }
429 
436  private void setMostRecentFilter(MostRecentFilter filter) {
437  int limit = filter.getLimit();
438  if (limit > 0) {
439  limitComboBox.setSelectedItem(filter.getLimit());
440  } else {
441  limitComboBox.setSelectedItem("All");
442  }
443  }
444 
445  @Subscribe
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;
452  validateFilters();
453  }
454  }
455 
461  @SuppressWarnings("unchecked")
462  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
463  private void initComponents() {
464  java.awt.GridBagConstraints gridBagConstraints;
465 
466  setLayout(new java.awt.GridBagLayout());
467 
468  scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
469  scrollPane.setAutoscrolls(true);
470  scrollPane.setBorder(null);
471 
472  mainPanel.setLayout(new java.awt.GridBagLayout());
473 
474  limitPane.setLayout(new java.awt.GridBagLayout());
475 
476  mostRecentLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.mostRecentLabel.text")); // NOI18N
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);
483 
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);
489  }
490  });
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);
496 
497  limitTitlePanel.setLayout(new java.awt.GridBagLayout());
498 
499  limitHeaderLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.limitHeaderLabel.text")); // NOI18N
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);
506 
507  limitErrorMsgLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/error-icon-16.png"))); // NOI18N
508  limitErrorMsgLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.limitErrorMsgLabel.text")); // NOI18N
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);
516 
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);
526 
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);
536 
537  startDatePicker.setEnabled(false);
538 
539  dateRangeLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/calendar.png"))); // NOI18N
540  dateRangeLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.dateRangeLabel.text")); // NOI18N
541 
542  startCheckBox.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.startCheckBox.text")); // NOI18N
543  startCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
544  public void stateChanged(javax.swing.event.ChangeEvent evt) {
545  startCheckBoxStateChanged(evt);
546  }
547  });
548 
549  endCheckBox.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.endCheckBox.text")); // NOI18N
550  endCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
551  public void stateChanged(javax.swing.event.ChangeEvent evt) {
552  endCheckBoxStateChanged(evt);
553  }
554  });
555 
556  endDatePicker.setEnabled(false);
557 
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()
566  .addContainerGap()
567  .addGroup(dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
568  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, dateRangePaneLayout.createSequentialGroup()
569  .addComponent(endCheckBox)
570  .addGap(12, 12, 12)
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)
574  .addGap(12, 12, 12)
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))
577  );
578 
579  dateRangePaneLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {endCheckBox, startCheckBox});
580 
581  dateRangePaneLayout.setVerticalGroup(
582  dateRangePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
583  .addGroup(dateRangePaneLayout.createSequentialGroup()
584  .addComponent(dateRangeLabel)
585  .addGap(6, 6, 6)
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)))
593  );
594 
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);
603 
604  devicesPane.setPreferredSize(new java.awt.Dimension(300, 300));
605  devicesPane.setLayout(new java.awt.GridBagLayout());
606 
607  unCheckAllDevicesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.unCheckAllDevicesButton.text")); // NOI18N
608  unCheckAllDevicesButton.addActionListener(new java.awt.event.ActionListener() {
609  public void actionPerformed(java.awt.event.ActionEvent evt) {
610  unCheckAllDevicesButtonActionPerformed(evt);
611  }
612  });
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);
621 
622  devicesLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/image.png"))); // NOI18N
623  devicesLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.devicesLabel.text")); // NOI18N
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);
630 
631  checkAllDevicesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.checkAllDevicesButton.text")); // NOI18N
632  checkAllDevicesButton.addActionListener(new java.awt.event.ActionListener() {
633  public void actionPerformed(java.awt.event.ActionEvent evt) {
634  checkAllDevicesButtonActionPerformed(evt);
635  }
636  });
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);
643 
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));
647 
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);
651 
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);
661 
662  deviceRequiredLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/error-icon-16.png"))); // NOI18N
663  deviceRequiredLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.deviceRequiredLabel.text")); // NOI18N
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);
673 
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);
683 
684  accountTypesPane.setLayout(new java.awt.GridBagLayout());
685 
686  unCheckAllAccountTypesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.unCheckAllAccountTypesButton.text")); // NOI18N
687  unCheckAllAccountTypesButton.addActionListener(new java.awt.event.ActionListener() {
688  public void actionPerformed(java.awt.event.ActionEvent evt) {
689  unCheckAllAccountTypesButtonActionPerformed(evt);
690  }
691  });
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);
700 
701  accountTypesLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/accounts.png"))); // NOI18N
702  accountTypesLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.accountTypesLabel.text")); // NOI18N
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);
708 
709  checkAllAccountTypesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.checkAllAccountTypesButton.text")); // NOI18N
710  checkAllAccountTypesButton.addActionListener(new java.awt.event.ActionListener() {
711  public void actionPerformed(java.awt.event.ActionEvent evt) {
712  checkAllAccountTypesButtonActionPerformed(evt);
713  }
714  });
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);
721 
722  accountTypesScrollPane.setMaximumSize(new java.awt.Dimension(32767, 210));
723  accountTypesScrollPane.setMinimumSize(new java.awt.Dimension(20, 210));
724  accountTypesScrollPane.setName(""); // NOI18N
725  accountTypesScrollPane.setPreferredSize(new java.awt.Dimension(2, 210));
726 
727  accountTypeListPane.setLayout(new javax.swing.BoxLayout(accountTypeListPane, javax.swing.BoxLayout.PAGE_AXIS));
728  accountTypesScrollPane.setViewportView(accountTypeListPane);
729 
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);
740 
741  accountTypeRequiredLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/error-icon-16.png"))); // NOI18N
742  accountTypeRequiredLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.accountTypeRequiredLabel.text")); // NOI18N
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);
751 
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);
760 
761  topPane.setLayout(new java.awt.GridBagLayout());
762 
763  filtersTitleLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/funnel.png"))); // NOI18N
764  filtersTitleLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.filtersTitleLabel.text")); // NOI18N
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);
772 
773  refreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/arrow-circle-double-135.png"))); // NOI18N
774  refreshButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.refreshButton.text")); // NOI18N
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);
780 
781  applyFiltersButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/tick.png"))); // NOI18N
782  applyFiltersButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.applyFiltersButton.text")); // NOI18N
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);
790 
791  needsRefreshLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.needsRefreshLabel.text")); // NOI18N
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);
801 
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);
810 
811  scrollPane.setViewportView(mainPanel);
812 
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);
822  }// </editor-fold>//GEN-END:initComponents
823 
827  void applyFilters() {
828  needsRefresh = false;
829  validateFilters();
830  CVTEvents.getCVTEventBus().post(new CVTEvents.FilterChangeEvent(getFilter(), getStartControlState(), getEndControlState()));
831 
832  }
833 
839  private CommunicationsFilter getFilter() {
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());
847  return commsFilter;
848  }
849 
855  private DeviceFilter getDeviceFilter() {
856  DeviceFilter deviceFilter = new DeviceFilter(
857  devicesMap.entrySet().stream()
858  .filter(entry -> entry.getValue().isSelected())
859  .map(Entry::getKey)
860  .collect(Collectors.toSet()));
861  return deviceFilter;
862  }
863 
869  private AccountTypeFilter getAccountTypeFilter() {
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;
876  }
877 
883  private DateRangeFilter getDateRangeFilter() {
884  ZoneId zone = Utils.getUserPreferredZoneId();
885 
886  return new DateRangeFilter(startCheckBox.isSelected() ? startDatePicker.getDate().atStartOfDay(zone).toEpochSecond() : 0,
887  endCheckBox.isSelected() ? endDatePicker.getDate().atStartOfDay(zone).toEpochSecond() : 0);
888  }
889 
896  private MostRecentFilter getMostRecentFilter() {
897  String value = (String) limitComboBox.getSelectedItem();
898  if (value.trim().equalsIgnoreCase("all")) {
899  return new MostRecentFilter(-1);
900  } else {
901  try {
902  int count = Integer.parseInt(value);
903  return new MostRecentFilter(count);
904  } catch (NumberFormatException ex) {
905  return null;
906  }
907  }
908  }
909 
910  private DateControlState getStartControlState() {
911  return new DateControlState(startDatePicker.getDate(), startCheckBox.isSelected());
912  }
913 
914  private DateControlState getEndControlState() {
915  return new DateControlState(endDatePicker.getDate(), endCheckBox.isSelected());
916  }
917 
924  private void setAllAccountTypesSelected(boolean selected) {
925  setAllSelected(accountTypeMap, selected);
926  }
927 
934  private void setAllDevicesSelected(boolean selected) {
935  setAllSelected(devicesMap, selected);
936  }
937 
946  private void setAllSelected(Map<?, JCheckBox> map, boolean selected) {
947  map.values().forEach(box -> box.setSelected(selected));
948  }
949 
951  startDatePicker.setDate(LocalDate.now().minusWeeks(3));
952  endDatePicker.setDate(LocalDate.now());
953  }
954 
955  private void unCheckAllAccountTypesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unCheckAllAccountTypesButtonActionPerformed
956  setAllAccountTypesSelected(false);
957  }//GEN-LAST:event_unCheckAllAccountTypesButtonActionPerformed
958 
959  private void checkAllAccountTypesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAllAccountTypesButtonActionPerformed
960  setAllAccountTypesSelected(true);
961  }//GEN-LAST:event_checkAllAccountTypesButtonActionPerformed
962 
963  private void unCheckAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unCheckAllDevicesButtonActionPerformed
964  setAllDevicesSelected(false);
965  }//GEN-LAST:event_unCheckAllDevicesButtonActionPerformed
966 
967  private void checkAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAllDevicesButtonActionPerformed
968  setAllDevicesSelected(true);
969  }//GEN-LAST:event_checkAllDevicesButtonActionPerformed
970 
971  private void startCheckBoxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_startCheckBoxStateChanged
972  startDatePicker.setEnabled(startCheckBox.isSelected());
973  validateFilters();
974  }//GEN-LAST:event_startCheckBoxStateChanged
975 
976  private void endCheckBoxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_endCheckBoxStateChanged
977  endDatePicker.setEnabled(endCheckBox.isSelected());
978  validateFilters();
979  }//GEN-LAST:event_endCheckBoxStateChanged
980 
981  private void limitComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_limitComboBoxActionPerformed
982  validateFilters();
983  }//GEN-LAST:event_limitComboBoxActionPerformed
984 
990  final class DateControlState {
991 
992  private final LocalDate date;
993  private final boolean enabled;
994 
1002  protected DateControlState(LocalDate date, boolean enabled) {
1003  this.date = date;
1004  this.enabled = enabled;
1005  }
1006 
1012  public LocalDate getDate() {
1013  return date;
1014  }
1015 
1021  public boolean isEnabled() {
1022  return enabled;
1023  }
1024 
1025  }
1026 
1027  // Variables declaration - do not modify//GEN-BEGIN:variables
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();
1061  // End of variables declaration//GEN-END:variables
1062 
1068  final class CheckBoxIconPanel extends JPanel {
1069 
1070  private static final long serialVersionUID = 1L;
1071 
1072  private final JCheckBox checkbox;
1073  private final JLabel label;
1074 
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));
1086 
1087  add(checkbox);
1088  add(label);
1089  add(Box.createHorizontalGlue());
1090  }
1091 
1097  void setSelected(boolean selected) {
1098  checkbox.setSelected(selected);
1099  }
1100 
1101  @Override
1102  public void setEnabled(boolean enabled) {
1103  checkbox.setEnabled(enabled);
1104  }
1105 
1111  JCheckBox getCheckBox() {
1112  return checkbox;
1113  }
1114 
1120  void addItemListener(ItemListener l) {
1121  checkbox.addItemListener(l);
1122  }
1123  }
1124 
1130  final class FilterPanelRefresher extends CVTFilterRefresher {
1131 
1132  private final boolean selectNewOption;
1133  private final boolean refreshAfterUpdate;
1134 
1135  FilterPanelRefresher(boolean selectNewOptions, boolean refreshAfterUpdate) {
1136  this.selectNewOption = selectNewOptions;
1137  this.refreshAfterUpdate = refreshAfterUpdate;
1138  }
1139 
1140  @Override
1141  void updateFilterPanel(CVTFilterRefresher.FilterPanelData data) {
1142  updateDateTimePicker(data.getStartTime(), data.getEndTime());
1143  updateDeviceFilterPanel(data.getDataSourceMap(), selectNewOption);
1144  updateAccountTypeFilter(data.getAccountTypesInUse(), selectNewOption);
1145 
1146  FiltersPanel.this.repaint();
1147 
1148  if (refreshAfterUpdate) {
1149  applyFilters();
1150  }
1151 
1152  if (!isEnabled()) {
1153  setEnabled(true);
1154  }
1155 
1156  validateFilters();
1157 
1158  repaint();
1159  }
1160  }
1161 
1166  class DeviceCheckBoxComparator implements Comparator<JCheckBox> {
1167 
1168  @Override
1169  public int compare(JCheckBox e1, JCheckBox e2) {
1170  return e1.getText().toLowerCase().compareTo(e2.getText().toLowerCase());
1171  }
1172  }
1173 }
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:491
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-2020 Basis Technology. Generated on: Tue Sep 22 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.