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) {
131 if (! type.getDbTableName().contains(
"os_account") && ! type.getDbTableName().contains(
"installed_program")) {
136 }
catch (CentralRepoException ex) {
137 logger.log(Level.WARNING,
"Error getting correlation types", ex);
147 @SuppressWarnings(
"unchecked")
170 public void actionPerformed(java.awt.event.ActionEvent evt) {
184 public void actionPerformed(java.awt.event.ActionEvent evt) {
195 public void actionPerformed(java.awt.event.ActionEvent evt) {
204 public void actionPerformed(java.awt.event.ActionEvent evt) {
213 public void actionPerformed(java.awt.event.ActionEvent evt) {
220 public void actionPerformed(java.awt.event.ActionEvent evt) {
225 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
226 this.setLayout(layout);
227 layout.setHorizontalGroup(
228 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
230 .addGroup(layout.createSequentialGroup()
232 .addGap(0, 0, Short.MAX_VALUE))
233 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
234 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
235 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
236 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
238 .addGroup(layout.createSequentialGroup()
240 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
243 .addGroup(layout.createSequentialGroup()
245 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
248 .addGap(0, 0, Short.MAX_VALUE))
249 .addGroup(layout.createSequentialGroup()
251 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
252 .addComponent(
caseComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
256 layout.setVerticalGroup(
257 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
258 .addGroup(layout.createSequentialGroup()
261 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
262 .addComponent(
caseComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
263 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
265 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
266 .addComponent(
correlationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
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)
275 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
287 fileTypeFilterObservable.notifyObservers();
295 fileTypeFilterObservable.notifyObservers();
319 fileTypeFilterObservable.notifyObservers();
324 fileTypeFilterObservable.notifyObservers();
347 Map<Integer, String> getCaseMap() {
348 return Collections.unmodifiableMap(this.caseMap);
358 this.casesList = dataSourceComboBoxModel;
359 this.caseComboBox.setModel(dataSourceComboBoxModel);
367 void setCaseMap(Map<Integer, String> caseMap) {
368 this.caseMap.clear();
369 this.caseMap.putAll(caseMap);
378 boolean centralRepoHasMultipleCases() {
379 return this.caseMap.size() >= 2;
388 Integer getSelectedCaseId() {
390 for (Entry<Integer, String> entry : this.caseMap.entrySet()) {
391 if (entry.getValue().equals(this.caseComboBox.getSelectedItem())) {
392 return entry.getKey();
405 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