20 package org.sleuthkit.autopsy.commonfilesearch;
23 import java.util.Collections;
24 import java.util.HashMap;
25 import java.util.List;
27 import java.util.Map.Entry;
28 import java.util.Observable;
29 import java.util.Observer;
30 import javax.swing.ComboBoxModel;
31 import org.openide.util.Exceptions;
43 static final int NO_CASE_SELECTED = -1;
47 private final Map<Integer, String>
caseMap;
56 this.caseMap =
new HashMap<>();
57 fileTypeFilterObservable =
new Observable() {
59 public void notifyObservers() {
63 super.notifyObservers();
74 void addObserver(Observer observer) {
75 fileTypeFilterObservable.addObserver(observer);
85 boolean fileCategoriesButtonIsSelected() {
96 boolean pictureVideoCheckboxIsSelected() {
107 boolean documentsCheckboxIsSelected() {
115 void setupCorrelationTypeFilter() {
118 List<CorrelationAttributeInstance.Type> types = CorrelationAttributeInstance.getDefaultCorrelationTypes();
119 for (CorrelationAttributeInstance.Type type : types) {
123 }
catch (EamDbException ex) {
124 Exceptions.printStackTrace(ex);
134 @SuppressWarnings(
"unchecked")
157 public void actionPerformed(java.awt.event.ActionEvent evt) {
172 public void actionPerformed(java.awt.event.ActionEvent evt) {
182 public void actionPerformed(java.awt.event.ActionEvent evt) {
191 public void actionPerformed(java.awt.event.ActionEvent evt) {
200 public void actionPerformed(java.awt.event.ActionEvent evt) {
207 public void actionPerformed(java.awt.event.ActionEvent evt) {
212 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
213 this.setLayout(layout);
214 layout.setHorizontalGroup(
215 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
217 .addGroup(layout.createSequentialGroup()
219 .addGap(0, 0, Short.MAX_VALUE))
220 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
221 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
222 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
223 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
225 .addGroup(layout.createSequentialGroup()
227 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
230 .addGroup(layout.createSequentialGroup()
232 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
235 .addGap(0, 0, Short.MAX_VALUE))
236 .addGroup(layout.createSequentialGroup()
238 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
239 .addComponent(
caseComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
243 layout.setVerticalGroup(
244 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
245 .addGroup(layout.createSequentialGroup()
248 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
249 .addComponent(
caseComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
250 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
252 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
253 .addComponent(
correlationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
254 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
256 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
258 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
260 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
262 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
274 fileTypeFilterObservable.notifyObservers();
282 fileTypeFilterObservable.notifyObservers();
306 fileTypeFilterObservable.notifyObservers();
311 fileTypeFilterObservable.notifyObservers();
334 Map<Integer, String> getCaseMap() {
335 return Collections.unmodifiableMap(this.caseMap);
345 this.casesList = dataSourceComboBoxModel;
346 this.caseComboBox.setModel(dataSourceComboBoxModel);
354 void setCaseMap(Map<Integer, String> caseMap) {
355 this.caseMap.clear();
356 this.caseMap.putAll(caseMap);
365 boolean centralRepoHasMultipleCases() {
366 return this.caseMap.size() >= 2;
375 Integer getSelectedCaseId() {
377 for (Entry<Integer, String> entry : this.caseMap.entrySet()) {
378 if (entry.getValue().equals(this.caseComboBox.getSelectedItem())) {
379 return entry.getKey();
392 CorrelationAttributeInstance.Type getSelectedCorrelationType() {
void allFileCategoriesRadioButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JRadioButton allFileCategoriesRadioButton
ComboBoxModel< String > casesList
void documentsCheckboxActionPerformed(java.awt.event.ActionEvent evt)
void correlationTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.ButtonGroup buttonGroup
final Observable fileTypeFilterObservable
javax.swing.JCheckBox pictureVideoCheckbox
javax.swing.JCheckBox documentsCheckbox
javax.swing.JComboBox< String > correlationTypeComboBox
javax.swing.JLabel categoriesLabel
javax.swing.JCheckBox specificCentralRepoCaseCheckbox
void pictureVideoCheckboxActionPerformed(java.awt.event.ActionEvent evt)
void selectedFileCategoriesButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JRadioButton selectedFileCategoriesButton
static final long serialVersionUID
javax.swing.JLabel correlationComboBoxLabel
Map< String, CorrelationAttributeInstance.Type > correlationTypeFilters
void specificCentralRepoCaseCheckboxActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JComboBox< String > caseComboBox
final Map< Integer, String > caseMap