20 package org.sleuthkit.autopsy.commonpropertiessearch;
23 import java.util.Collections;
24 import java.util.Comparator;
25 import java.util.HashMap;
26 import java.util.List;
28 import java.util.Map.Entry;
29 import java.util.Observable;
30 import java.util.Observer;
31 import java.util.logging.Level;
32 import javax.swing.ComboBoxModel;
47 static final int NO_CASE_SELECTED = -1;
51 private final Map<Integer, String>
caseMap;
60 this.caseMap =
new HashMap<>();
61 fileTypeFilterObservable =
new Observable() {
63 public void notifyObservers() {
67 super.notifyObservers();
78 void addObserver(Observer observer) {
79 fileTypeFilterObservable.addObserver(observer);
89 boolean fileCategoriesButtonIsSelected() {
100 boolean pictureVideoCheckboxIsSelected() {
111 boolean documentsCheckboxIsSelected() {
119 void setupCorrelationTypeFilter() {
122 List<CorrelationAttributeInstance.Type> types = CentralRepository.getInstance().getDefinedCorrelationTypes();
123 Collections.sort(types,
new Comparator<CorrelationAttributeInstance.Type>() {
126 public int compare(CorrelationAttributeInstance.Type type1, CorrelationAttributeInstance.Type type2) {
127 return Integer.compare(type1.getId(), type2.getId());
130 for (CorrelationAttributeInstance.Type type : types) {
134 }
catch (CentralRepoException ex) {
135 logger.log(Level.WARNING,
"Error getting correlation types", ex);
145 @SuppressWarnings(
"unchecked")
168 public void actionPerformed(java.awt.event.ActionEvent evt) {
182 public void actionPerformed(java.awt.event.ActionEvent evt) {
193 public void actionPerformed(java.awt.event.ActionEvent evt) {
202 public void actionPerformed(java.awt.event.ActionEvent evt) {
211 public void actionPerformed(java.awt.event.ActionEvent evt) {
218 public void actionPerformed(java.awt.event.ActionEvent evt) {
223 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
224 this.setLayout(layout);
225 layout.setHorizontalGroup(
226 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
228 .addGroup(layout.createSequentialGroup()
230 .addGap(0, 0, Short.MAX_VALUE))
231 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
232 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
233 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
234 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
236 .addGroup(layout.createSequentialGroup()
238 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
241 .addGroup(layout.createSequentialGroup()
243 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
246 .addGap(0, 0, Short.MAX_VALUE))
247 .addGroup(layout.createSequentialGroup()
249 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
250 .addComponent(
caseComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
254 layout.setVerticalGroup(
255 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
256 .addGroup(layout.createSequentialGroup()
259 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
260 .addComponent(
caseComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
261 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
263 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
264 .addComponent(
correlationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
265 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
267 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
269 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
271 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
273 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
285 fileTypeFilterObservable.notifyObservers();
293 fileTypeFilterObservable.notifyObservers();
317 fileTypeFilterObservable.notifyObservers();
322 fileTypeFilterObservable.notifyObservers();
345 Map<Integer, String> getCaseMap() {
346 return Collections.unmodifiableMap(this.caseMap);
356 this.casesList = dataSourceComboBoxModel;
357 this.caseComboBox.setModel(dataSourceComboBoxModel);
365 void setCaseMap(Map<Integer, String> caseMap) {
366 this.caseMap.clear();
367 this.caseMap.putAll(caseMap);
376 boolean centralRepoHasMultipleCases() {
377 return this.caseMap.size() >= 2;
386 Integer getSelectedCaseId() {
388 for (Entry<Integer, String> entry : this.caseMap.entrySet()) {
389 if (entry.getValue().equals(this.caseComboBox.getSelectedItem())) {
390 return entry.getKey();
403 CorrelationAttributeInstance.Type getSelectedCorrelationType() {
javax.swing.JComboBox< String > correlationTypeComboBox
void documentsCheckboxActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JComboBox< String > caseComboBox
void allFileCategoriesRadioButtonActionPerformed(java.awt.event.ActionEvent evt)
Map< String, CorrelationAttributeInstance.Type > correlationTypeFilters
void pictureVideoCheckboxActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JLabel correlationComboBoxLabel
final Observable fileTypeFilterObservable
javax.swing.JCheckBox documentsCheckbox
javax.swing.JCheckBox pictureVideoCheckbox
javax.swing.JRadioButton selectedFileCategoriesButton
static final long serialVersionUID
void specificCentralRepoCaseCheckboxActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JLabel categoriesLabel
void selectedFileCategoriesButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.ButtonGroup buttonGroup
void correlationTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt)
ComboBoxModel< String > casesList
final Map< Integer, String > caseMap
javax.swing.JCheckBox specificCentralRepoCaseCheckbox
synchronized static Logger getLogger(String name)
javax.swing.JRadioButton allFileCategoriesRadioButton
static final Logger logger