20 package org.sleuthkit.autopsy.commonfilesearch;
22 import java.util.Collections;
23 import java.util.HashMap;
24 import java.util.List;
26 import java.util.Map.Entry;
27 import java.util.Observable;
28 import java.util.Observer;
29 import javax.swing.ComboBoxModel;
30 import org.openide.util.Exceptions;
42 static final int NO_CASE_SELECTED = -1;
46 private final Map<Integer, String>
caseMap;
55 this.caseMap =
new HashMap<>();
56 fileTypeFilterObservable =
new Observable() {
58 public void notifyObservers() {
62 super.notifyObservers();
73 void addObserver(Observer observer) {
74 fileTypeFilterObservable.addObserver(observer);
84 boolean fileCategoriesButtonIsSelected() {
95 boolean pictureVideoCheckboxIsSelected() {
106 boolean documentsCheckboxIsSelected() {
114 void setupCorrelationTypeFilter() {
117 List<CorrelationAttributeInstance.Type> types = CorrelationAttributeInstance.getDefaultCorrelationTypes();
118 for (CorrelationAttributeInstance.Type type : types) {
122 }
catch (EamDbException ex) {
123 Exceptions.printStackTrace(ex);
133 @SuppressWarnings(
"unchecked")
156 public void actionPerformed(java.awt.event.ActionEvent evt) {
171 public void actionPerformed(java.awt.event.ActionEvent evt) {
181 public void actionPerformed(java.awt.event.ActionEvent evt) {
190 public void actionPerformed(java.awt.event.ActionEvent evt) {
199 public void actionPerformed(java.awt.event.ActionEvent evt) {
206 public void actionPerformed(java.awt.event.ActionEvent evt) {
211 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
212 this.setLayout(layout);
213 layout.setHorizontalGroup(
214 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
216 .addGroup(layout.createSequentialGroup()
218 .addGap(0, 0, Short.MAX_VALUE))
219 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
220 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
221 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
222 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
224 .addGroup(layout.createSequentialGroup()
226 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
229 .addGroup(layout.createSequentialGroup()
231 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
234 .addGap(0, 0, Short.MAX_VALUE))
235 .addGroup(layout.createSequentialGroup()
237 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
238 .addComponent(
caseComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
242 layout.setVerticalGroup(
243 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
244 .addGroup(layout.createSequentialGroup()
247 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
248 .addComponent(
caseComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
249 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
251 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
252 .addComponent(
correlationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
253 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
255 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
257 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
259 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
261 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
273 fileTypeFilterObservable.notifyObservers();
281 fileTypeFilterObservable.notifyObservers();
295 boolean enableFileTypesFilter =
false;
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