Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
FileSearchPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy
3  *
4  * Copyright 2019-2020 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.filequery;
20 
21 import com.google.common.eventbus.Subscribe;
22 import java.awt.Cursor;
23 import java.awt.event.ActionEvent;
24 import java.awt.event.ActionListener;
25 import java.util.ArrayList;
26 import java.util.Collections;
27 import java.util.List;
28 import java.util.logging.Level;
29 import java.util.stream.Collectors;
30 import javax.swing.DefaultListCellRenderer;
31 import javax.swing.DefaultListModel;
32 import javax.swing.JCheckBox;
33 import javax.swing.JList;
34 import javax.swing.SwingUtilities;
35 import javax.swing.event.ListSelectionEvent;
36 import javax.swing.event.ListSelectionListener;
37 import org.openide.util.NbBundle;
49 import org.sleuthkit.datamodel.BlackboardArtifact;
50 import org.sleuthkit.datamodel.BlackboardAttribute;
51 import org.sleuthkit.datamodel.TskCoreException;
52 import org.sleuthkit.datamodel.DataSource;
53 import org.sleuthkit.datamodel.TagName;
55 
59 final class FileSearchPanel extends javax.swing.JPanel implements ActionListener {
60 
61  private static final long serialVersionUID = 1L;
62  private static final String[] DEFAULT_IGNORED_PATHS = {"/Windows/", "/Program Files/"}; //NON-NLS
63  private final static Logger logger = Logger.getLogger(FileSearchPanel.class.getName());
64  private FileType fileType = FileType.IMAGE;
65  private DefaultListModel<FileSearchFiltering.ParentSearchTerm> parentListModel;
66  private SearchWorker searchWorker = null;
67 
71  @NbBundle.Messages({"FileSearchPanel.dialogTitle.text=Test file search"})
72  FileSearchPanel() {
73  initComponents();
74  for (GroupSortingAlgorithm groupSortAlgorithm : GroupSortingAlgorithm.values()) {
75  groupSortingComboBox.addItem(groupSortAlgorithm);
76  }
77  parentListModel = (DefaultListModel<FileSearchFiltering.ParentSearchTerm>) parentList.getModel();
78  for (String ignorePath : DEFAULT_IGNORED_PATHS) {
79  parentListModel.add(parentListModel.size(), new ParentSearchTerm(ignorePath, false, false));
80  }
81  }
82 
96  private void dataSourceFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
97  dataSourceCheckbox.setVisible(visible);
98  dataSourceScrollPane.setVisible(visible);
99  dataSourceList.setVisible(visible);
100  dataSourceCheckbox.setEnabled(enabled);
101  dataSourceCheckbox.setSelected(selected);
102  if (dataSourceCheckbox.isEnabled() && dataSourceCheckbox.isSelected()) {
103  dataSourceScrollPane.setEnabled(true);
104  dataSourceList.setEnabled(true);
105  if (indicesSelected != null) {
106  dataSourceList.setSelectedIndices(indicesSelected);
107  }
108  } else {
109  dataSourceScrollPane.setEnabled(false);
110  dataSourceList.setEnabled(false);
111  }
112  }
113 
127  private void sizeFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
128  sizeCheckbox.setVisible(visible);
129  sizeScrollPane.setVisible(visible);
130  sizeList.setVisible(visible);
131  sizeCheckbox.setEnabled(enabled);
132  sizeCheckbox.setSelected(selected);
133  if (sizeCheckbox.isEnabled() && sizeCheckbox.isSelected()) {
134  sizeScrollPane.setEnabled(true);
135  sizeList.setEnabled(true);
136  if (indicesSelected != null) {
137  sizeList.setSelectedIndices(indicesSelected);
138  }
139  } else {
140  sizeScrollPane.setEnabled(false);
141  sizeList.setEnabled(false);
142  }
143  }
144 
158  private void crFrequencyFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
159  crFrequencyCheckbox.setVisible(visible);
160  crFrequencyScrollPane.setVisible(visible);
161  crFrequencyList.setVisible(visible);
162  crFrequencyCheckbox.setEnabled(enabled);
163  crFrequencyCheckbox.setSelected(selected);
164  if (crFrequencyCheckbox.isEnabled() && crFrequencyCheckbox.isSelected()) {
165  crFrequencyScrollPane.setEnabled(true);
166  crFrequencyList.setEnabled(true);
167  if (indicesSelected != null) {
168  crFrequencyList.setSelectedIndices(indicesSelected);
169  }
170  } else {
171  crFrequencyScrollPane.setEnabled(false);
172  crFrequencyList.setEnabled(false);
173  }
174  }
175 
189  private void objectsFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
190  objectsCheckbox.setVisible(visible);
191  objectsScrollPane.setVisible(visible);
192  objectsList.setVisible(visible);
193  boolean hasObjects = objectsList.getModel().getSize() > 0;
194  objectsCheckbox.setEnabled(enabled && hasObjects);
195  objectsCheckbox.setSelected(selected && hasObjects);
196  if (objectsCheckbox.isEnabled() && objectsCheckbox.isSelected()) {
197  objectsScrollPane.setEnabled(true);
198  objectsList.setEnabled(true);
199  if (indicesSelected != null) {
200  objectsList.setSelectedIndices(indicesSelected);
201  }
202  } else {
203  objectsScrollPane.setEnabled(false);
204  objectsList.setEnabled(false);
205  }
206  }
207 
221  private void hashSetFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
222  hashSetCheckbox.setVisible(visible);
223  hashSetScrollPane.setVisible(visible);
224  hashSetList.setVisible(visible);
225  boolean hasHashSets = hashSetList.getModel().getSize() > 0;
226  hashSetCheckbox.setEnabled(enabled && hasHashSets);
227  hashSetCheckbox.setSelected(selected && hasHashSets);
228  if (hashSetCheckbox.isEnabled() && hashSetCheckbox.isSelected()) {
229  hashSetScrollPane.setEnabled(true);
230  hashSetList.setEnabled(true);
231  if (indicesSelected != null) {
232  hashSetList.setSelectedIndices(indicesSelected);
233  }
234  } else {
235  hashSetScrollPane.setEnabled(false);
236  hashSetList.setEnabled(false);
237  }
238  }
239 
253  private void interestingItemsFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
254  interestingItemsCheckbox.setVisible(visible);
255  interestingItemsScrollPane.setVisible(visible);
256  interestingItemsList.setVisible(visible);
257  boolean hasInterestingItems = interestingItemsList.getModel().getSize() > 0;
258  interestingItemsCheckbox.setEnabled(enabled && hasInterestingItems);
259  interestingItemsCheckbox.setSelected(selected && hasInterestingItems);
260  if (interestingItemsCheckbox.isEnabled() && interestingItemsCheckbox.isSelected()) {
261  interestingItemsScrollPane.setEnabled(true);
262  interestingItemsList.setEnabled(true);
263  if (indicesSelected != null) {
264  interestingItemsList.setSelectedIndices(indicesSelected);
265  }
266  } else {
267  interestingItemsScrollPane.setEnabled(false);
268  interestingItemsList.setEnabled(false);
269  }
270  }
271 
285  private void scoreFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
286  scoreCheckbox.setVisible(visible);
287  scoreScrollPane.setVisible(visible);
288  scoreList.setVisible(visible);
289  scoreCheckbox.setEnabled(enabled);
290  scoreCheckbox.setSelected(selected);
291  if (scoreCheckbox.isEnabled() && scoreCheckbox.isSelected()) {
292  scoreScrollPane.setEnabled(true);
293  scoreList.setEnabled(true);
294  if (indicesSelected != null) {
295  scoreList.setSelectedIndices(indicesSelected);
296  }
297  } else {
298  scoreScrollPane.setEnabled(false);
299  scoreList.setEnabled(false);
300  }
301  }
302 
316  private void parentFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
317  parentCheckbox.setVisible(visible);
318  parentScrollPane.setVisible(visible);
319  parentList.setVisible(visible);
320  parentCheckbox.setEnabled(enabled);
321  parentCheckbox.setSelected(selected);
322  if (parentCheckbox.isEnabled() && parentCheckbox.isSelected()) {
323  parentScrollPane.setEnabled(true);
324  includeRadioButton.setEnabled(true);
325  excludeRadioButton.setEnabled(true);
326  fullRadioButton.setEnabled(true);
327  substringRadioButton.setEnabled(true);
328  addButton.setEnabled(true);
329  deleteButton.setEnabled(!parentListModel.isEmpty());
330  parentList.setEnabled(true);
331  parentTextField.setEnabled(true);
332  if (indicesSelected != null) {
333  parentList.setSelectedIndices(indicesSelected);
334  }
335  } else {
336  parentScrollPane.setEnabled(false);
337  parentList.setEnabled(false);
338  includeRadioButton.setEnabled(false);
339  excludeRadioButton.setEnabled(false);
340  fullRadioButton.setEnabled(false);
341  substringRadioButton.setEnabled(false);
342  addButton.setEnabled(false);
343  deleteButton.setEnabled(false);
344  parentTextField.setEnabled(false);
345  }
346  }
347 
361  private void tagsFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
362  tagsCheckbox.setVisible(visible);
363  tagsScrollPane.setVisible(visible);
364  tagsList.setVisible(visible);
365  tagsCheckbox.setEnabled(enabled);
366  tagsCheckbox.setSelected(selected);
367  if (tagsCheckbox.isEnabled() && tagsCheckbox.isSelected()) {
368  tagsScrollPane.setEnabled(true);
369  tagsList.setEnabled(true);
370  if (indicesSelected != null) {
371  tagsList.setSelectedIndices(indicesSelected);
372  }
373  } else {
374  tagsScrollPane.setEnabled(false);
375  tagsList.setEnabled(false);
376  }
377  }
378 
392  private void keywordFilterSettings(boolean visible, boolean enabled, boolean selected, int[] indicesSelected) {
393  keywordCheckbox.setVisible(visible);
394  keywordScrollPane.setVisible(visible);
395  keywordList.setVisible(visible);
396  keywordCheckbox.setEnabled(enabled);
397  keywordCheckbox.setSelected(selected);
398  if (keywordCheckbox.isEnabled() && keywordCheckbox.isSelected()) {
399  keywordScrollPane.setEnabled(true);
400  keywordList.setEnabled(true);
401  if (indicesSelected != null) {
402  keywordList.setSelectedIndices(indicesSelected);
403  }
404  } else {
405  keywordScrollPane.setEnabled(false);
406  keywordList.setEnabled(false);
407  }
408  }
409 
417  private void userCreatedFilterSettings(boolean visible, boolean enabled, boolean selected) {
418  userCreatedCheckbox.setVisible(visible);
419  userCreatedCheckbox.setEnabled(enabled);
420  userCreatedCheckbox.setSelected(selected);
421  }
422 
430  private void knownFilesFilterSettings(boolean visible, boolean enabled, boolean selected) {
431  knownFilesCheckbox.setVisible(visible);
432  knownFilesCheckbox.setEnabled(enabled);
433  knownFilesCheckbox.setSelected(selected);
434  }
435 
443  private void notableFilterSettings(boolean visible, boolean enabled, boolean selected) {
444  notableCheckbox.setVisible(visible);
445  notableCheckbox.setEnabled(enabled);
446  notableCheckbox.setSelected(selected);
447  }
448 
459  @NbBundle.Messages({"FileSearchPanel.steptwo.images=Step 2: Filter which images to show"})
460  private void imagesSelected(boolean enabled, boolean resetSelected) {
461  stepTwoLabel.setText(Bundle.FileSearchPanel_steptwo_images());
462  dataSourceFilterSettings(true, enabled, !resetSelected && dataSourceCheckbox.isSelected(), null);
463  int[] selectedSizeIndices = {1, 2, 3, 4, 5};
464  sizeFilterSettings(true, enabled, resetSelected || sizeCheckbox.isSelected(), resetSelected == true ? selectedSizeIndices : null);
465  int[] selectedFrequencyIndices;
466  if (!CentralRepository.isEnabled()) {
467  selectedFrequencyIndices = new int[]{0};
468  } else {
469  selectedFrequencyIndices = new int[]{1, 2, 3, 4, 5, 6, 7};
470  }
471  crFrequencyFilterSettings(true, enabled, resetSelected || crFrequencyCheckbox.isSelected(), resetSelected == true ? selectedFrequencyIndices : null);
472  userCreatedFilterSettings(true, enabled, !resetSelected && userCreatedCheckbox.isSelected());
473  objectsFilterSettings(true, enabled, !resetSelected && objectsCheckbox.isSelected(), null);
474  hashSetFilterSettings(true, enabled, !resetSelected && hashSetCheckbox.isSelected(), null);
475  interestingItemsFilterSettings(true, enabled, !resetSelected && interestingItemsCheckbox.isSelected(), null);
476  parentFilterSettings(true, enabled, !resetSelected && parentCheckbox.isSelected(), null);
477  scoreFilterSettings(false, false, false, null);
478  tagsFilterSettings(false, false, false, null);
479  keywordFilterSettings(false, false, false, null);
480  knownFilesFilterSettings(false, false, false);
481  notableFilterSettings(false, false, false);
482  }
483 
494  @NbBundle.Messages({"FileSearchPanel.steptwo.videos=Step 2: Filter which videos to show"})
495  private void videosSelected(boolean enabled, boolean resetSelected) {
496  stepTwoLabel.setText(Bundle.FileSearchPanel_steptwo_videos());
497  dataSourceFilterSettings(true, enabled, !resetSelected && dataSourceCheckbox.isSelected(), null);
498  sizeFilterSettings(true, enabled, !resetSelected && sizeCheckbox.isSelected(), null);
499  int[] selectedFrequencyIndices;
500  if (!CentralRepository.isEnabled()) {
501  selectedFrequencyIndices = new int[]{0};
502  } else {
503  selectedFrequencyIndices = new int[]{1, 2, 3, 4, 5, 6, 7};
504  }
505  crFrequencyFilterSettings(true, enabled, resetSelected || crFrequencyCheckbox.isSelected(), resetSelected == true ? selectedFrequencyIndices : null);
506  userCreatedFilterSettings(true, enabled, !resetSelected && userCreatedCheckbox.isSelected());
507  objectsFilterSettings(true, enabled, !resetSelected && objectsCheckbox.isSelected(), null);
508  hashSetFilterSettings(true, enabled, !resetSelected && hashSetCheckbox.isSelected(), null);
509  interestingItemsFilterSettings(true, enabled, !resetSelected && interestingItemsCheckbox.isSelected(), null);
510  parentFilterSettings(true, enabled, !resetSelected && parentCheckbox.isSelected(), null);
511  scoreFilterSettings(false, false, false, null);
512  tagsFilterSettings(false, false, false, null);
513  keywordFilterSettings(false, false, false, null);
514  knownFilesFilterSettings(false, false, false);
515  notableFilterSettings(false, false, false);
516  }
517 
528  @NbBundle.Messages({"FileSearchPanel.steptwo.documents=Step 2: Filter which documents to show"})
529  private void documentsSelected(boolean enabled, boolean resetSelected) {
530  stepTwoLabel.setText(Bundle.FileSearchPanel_steptwo_documents());
531  dataSourceFilterSettings(true, enabled, !resetSelected && dataSourceCheckbox.isSelected(), null);
532  sizeFilterSettings(true, enabled, !resetSelected && sizeCheckbox.isSelected(), null);
533  int[] selectedFrequencyIndices;
534  if (!CentralRepository.isEnabled()) {
535  selectedFrequencyIndices = new int[]{0};
536  } else {
537  selectedFrequencyIndices = new int[]{1, 2, 3, 4, 5, 6, 7};
538  }
539  crFrequencyFilterSettings(true, enabled, resetSelected || crFrequencyCheckbox.isSelected(), resetSelected == true ? selectedFrequencyIndices : null);
540  userCreatedFilterSettings(false, false, false);
541  objectsFilterSettings(false, false, false, null);
542  hashSetFilterSettings(true, enabled, !resetSelected && hashSetCheckbox.isSelected(), null);
543  interestingItemsFilterSettings(true, enabled, !resetSelected && interestingItemsCheckbox.isSelected(), null);
544  parentFilterSettings(true, enabled, !resetSelected && parentCheckbox.isSelected(), null);
545  scoreFilterSettings(false, false, false, null);
546  tagsFilterSettings(false, false, false, null);
547  keywordFilterSettings(false, false, false, null);
548  knownFilesFilterSettings(false, false, false);
549  notableFilterSettings(false, false, false);
550  }
551 
557  void setSelectedType(FileType type) {
558  fileType = type;
559  setUpSizeFilter();
560  if (null != fileType) {
561  switch (fileType) {
562  case IMAGE:
563  imagesSelected(true, true);
564  break;
565  case VIDEO:
566  videosSelected(true, true);
567  break;
568  case DOCUMENTS:
569  documentsSelected(true, true);
570  break;
571  default:
572  break;
573  }
574  }
575  validateFields();
576  }
577 
578  FileType getSelectedType() {
579  return fileType;
580  }
581 
585  void resetPanel() {
586 
587  searchButton.setEnabled(false);
588 
589  // Set up the filters
590  setUpDataSourceFilter();
591  setUpFrequencyFilter();
592  setUpSizeFilter();
593  setUpKWFilter();
594  setUpParentPathFilter();
595  setUpHashFilter();
596  setUpInterestingItemsFilter();
597  setUpTagsFilter();
598  setUpObjectFilter();
599  setUpScoreFilter();
600 
601  groupByCombobox.removeAllItems();
602  // Set up the grouping attributes
603  for (FileSearch.GroupingAttributeType type : FileSearch.GroupingAttributeType.getOptionsForGrouping()) {
604  if ((type != GroupingAttributeType.FREQUENCY || CentralRepository.isEnabled())
605  && (type != GroupingAttributeType.OBJECT_DETECTED || objectsList.getModel().getSize() > 0)
606  && (type != GroupingAttributeType.INTERESTING_ITEM_SET || interestingItemsList.getModel().getSize() > 0)
607  && (type != GroupingAttributeType.HASH_LIST_NAME || hashSetList.getModel().getSize() > 0)) {
608  groupByCombobox.addItem(type);
609  }
610  }
611 
612  orderByCombobox.removeAllItems();
613  // Set up the file order list
614  for (FileSorter.SortingMethod method : FileSorter.SortingMethod.getOptionsForOrdering()) {
615  if (method != SortingMethod.BY_FREQUENCY || CentralRepository.isEnabled()) {
616  orderByCombobox.addItem(method);
617  }
618  }
619 
620  groupSortingComboBox.setSelectedIndex(0);
621  setSelectedType(FileType.IMAGE);
622  validateFields();
623  }
624 
632  private void addListeners(JCheckBox checkBox, JList<?> list) {
633  if (checkBox != null) {
634  checkBox.addActionListener(this);
635  }
636  if (list != null) {
637  list.addListSelectionListener(new ListSelectionListener() {
638  @Override
639  public void valueChanged(ListSelectionEvent evt) {
640  if (!evt.getValueIsAdjusting()) {
641  validateFields();
642  }
643  }
644  });
645  }
646  }
647 
651  private void setUpDataSourceFilter() {
652  int count = 0;
653  try {
654  DefaultListModel<DataSourceItem> dsListModel = (DefaultListModel<DataSourceItem>) dataSourceList.getModel();
655  dsListModel.removeAllElements();
656  for (DataSource ds : Case.getCurrentCase().getSleuthkitCase().getDataSources()) {
657  dsListModel.add(count, new DataSourceItem(ds));
658  }
659  } catch (TskCoreException ex) {
660  logger.log(Level.SEVERE, "Error loading data sources", ex);
661  dataSourceCheckbox.setEnabled(false);
662  dataSourceList.setEnabled(false);
663  }
664  addListeners(dataSourceCheckbox, dataSourceList);
665  }
666 
670  private void setUpFrequencyFilter() {
671  int count = 0;
672  DefaultListModel<FileSearchData.Frequency> frequencyListModel = (DefaultListModel<FileSearchData.Frequency>) crFrequencyList.getModel();
673  frequencyListModel.removeAllElements();
674  if (!CentralRepository.isEnabled()) {
675  for (FileSearchData.Frequency freq : FileSearchData.Frequency.getOptionsForFilteringWithoutCr()) {
676  frequencyListModel.add(count, freq);
677  }
678  } else {
679  for (FileSearchData.Frequency freq : FileSearchData.Frequency.getOptionsForFilteringWithCr()) {
680  frequencyListModel.add(count, freq);
681  }
682  }
683  addListeners(crFrequencyCheckbox, crFrequencyList);
684  }
685 
689  private void setUpSizeFilter() {
690  int count = 0;
691  DefaultListModel<FileSearchData.FileSize> sizeListModel = (DefaultListModel<FileSearchData.FileSize>) sizeList.getModel();
692  sizeListModel.removeAllElements();
693  if (null == fileType) {
694  for (FileSearchData.FileSize size : FileSearchData.FileSize.values()) {
695  sizeListModel.add(count, size);
696  }
697  } else {
698  List<FileSearchData.FileSize> sizes;
699  switch (fileType) {
700  case VIDEO:
701  sizes = FileSearchData.FileSize.getOptionsForVideos();
702  break;
703  case IMAGE:
704  sizes = FileSearchData.FileSize.getOptionsForImages();
705  break;
706  case DOCUMENTS:
707  sizes = FileSearchData.FileSize.getOptionsForImages();
708  break;
709  default:
710  sizes = new ArrayList<>();
711  break;
712  }
713  for (FileSearchData.FileSize size : sizes) {
714  sizeListModel.add(count, size);
715  }
716  }
717  addListeners(sizeCheckbox, sizeList);
718  }
719 
723  private void setUpKWFilter() {
724  int count = 0;
725  try {
726  DefaultListModel<String> kwListModel = (DefaultListModel<String>) keywordList.getModel();
727  kwListModel.removeAllElements();
728  List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT,
729  BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME);
730  for (String name : setNames) {
731  kwListModel.add(count, name);
732  }
733  } catch (TskCoreException ex) {
734  logger.log(Level.SEVERE, "Error loading keyword list names", ex);
735  keywordCheckbox.setEnabled(false);
736  keywordList.setEnabled(false);
737  }
738  addListeners(keywordCheckbox, keywordList);
739  }
740 
744  private void setUpHashFilter() {
745  int count = 0;
746  try {
747  DefaultListModel<String> hashListModel = (DefaultListModel<String>) hashSetList.getModel();
748  hashListModel.removeAllElements();
749  List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT,
750  BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME);
751  for (String name : setNames) {
752  hashListModel.add(count, name);
753  count++;
754  }
755  } catch (TskCoreException ex) {
756  logger.log(Level.SEVERE, "Error loading hash set names", ex);
757  hashSetCheckbox.setEnabled(false);
758  hashSetList.setEnabled(false);
759  }
760  addListeners(hashSetCheckbox, hashSetList);
761  }
762 
766  private void setUpInterestingItemsFilter() {
767  int count = 0;
768  try {
769  DefaultListModel<String> intListModel = (DefaultListModel<String>) interestingItemsList.getModel();
770  intListModel.removeAllElements();
771  List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT,
772  BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME);
773  for (String name : setNames) {
774  intListModel.add(count, name);
775  count++;
776  }
777  } catch (TskCoreException ex) {
778  logger.log(Level.SEVERE, "Error loading interesting file set names", ex);
779  interestingItemsCheckbox.setEnabled(false);
780  interestingItemsList.setEnabled(false);
781  }
782  addListeners(interestingItemsCheckbox, interestingItemsList);
783  }
784 
788  private void setUpTagsFilter() {
789  int count = 0;
790  try {
791  DefaultListModel<TagName> tagsListModel = (DefaultListModel<TagName>) tagsList.getModel();
792  tagsListModel.removeAllElements();
793  List<TagName> tagNames = Case.getCurrentCase().getSleuthkitCase().getTagNamesInUse();
794  for (TagName name : tagNames) {
795  tagsListModel.add(count, name);
796  count++;
797  }
798  tagsList.setCellRenderer(new TagsListCellRenderer());
799  } catch (TskCoreException ex) {
800  logger.log(Level.SEVERE, "Error loading tag names", ex);
801  tagsCheckbox.setEnabled(false);
802  tagsList.setEnabled(false);
803  }
804  addListeners(tagsCheckbox, tagsList);
805  }
806 
810  private class TagsListCellRenderer extends DefaultListCellRenderer {
811 
812  private static final long serialVersionUID = 1L;
813 
814  @Override
815  public java.awt.Component getListCellRendererComponent(
816  JList<?> list,
817  Object value,
818  int index,
819  boolean isSelected,
820  boolean cellHasFocus) {
821  Object newValue = value;
822  if (value instanceof TagName) {
823  newValue = ((TagName) value).getDisplayName();
824  }
825  super.getListCellRendererComponent(list, newValue, index, isSelected, cellHasFocus);
826  return this;
827  }
828  }
829 
833  private void setUpObjectFilter() {
834  int count = 0;
835  try {
836  DefaultListModel<String> objListModel = (DefaultListModel<String>) objectsList.getModel();
837  objListModel.removeAllElements();
838  List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_OBJECT_DETECTED, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DESCRIPTION);
839  for (String name : setNames) {
840  objListModel.add(count, name);
841  count++;
842  }
843  } catch (TskCoreException ex) {
844  logger.log(Level.SEVERE, "Error loading object detected set names", ex);
845  objectsCheckbox.setEnabled(false);
846  objectsList.setEnabled(false);
847  }
848  addListeners(objectsCheckbox, objectsList);
849  }
850 
854  private void setUpScoreFilter() {
855 
856  int count = 0;
857  DefaultListModel<Score> scoreListModel = (DefaultListModel<Score>) scoreList.getModel();
858  scoreListModel.removeAllElements();
859  for (Score score : Score.getOptionsForFiltering()) {
860  scoreListModel.add(count, score);
861  }
862  addListeners(scoreCheckbox, scoreList);
863  }
864 
877  private List<String> getSetNames(BlackboardArtifact.ARTIFACT_TYPE artifactType, BlackboardAttribute.ATTRIBUTE_TYPE setNameAttribute) throws TskCoreException {
878  List<BlackboardArtifact> arts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifacts(artifactType);
879  List<String> setNames = new ArrayList<>();
880  for (BlackboardArtifact art : arts) {
881  for (BlackboardAttribute attr : art.getAttributes()) {
882  if (attr.getAttributeType().getTypeID() == setNameAttribute.getTypeID()) {
883  String setName = attr.getValueString();
884  if (!setNames.contains(setName)) {
885  setNames.add(setName);
886  }
887  }
888  }
889  }
890  Collections.sort(setNames);
891  return setNames;
892  }
893 
897  private void setUpParentPathFilter() {
898  fullRadioButton.setSelected(true);
899  includeRadioButton.setSelected(true);
900  parentListModel = (DefaultListModel<FileSearchFiltering.ParentSearchTerm>) parentList.getModel();
901  addListeners(parentCheckbox, parentList);
902  }
903 
909  List<FileSearchFiltering.FileFilter> getFilters() {
910  List<FileSearchFiltering.FileFilter> filters = new ArrayList<>();
911  filters.add(new FileSearchFiltering.FileTypeFilter(fileType));
912  if (parentCheckbox.isSelected()) {
913  // For the parent paths, everything in the box is used (not just the selected entries)
914  filters.add(new FileSearchFiltering.ParentFilter(getParentPaths()));
915  }
916 
917  if (dataSourceCheckbox.isSelected()) {
918  List<DataSource> dataSources = dataSourceList.getSelectedValuesList().stream().map(t -> t.getDataSource()).collect(Collectors.toList());
919  filters.add(new FileSearchFiltering.DataSourceFilter(dataSources));
920  }
921 
922  if (crFrequencyCheckbox.isSelected()) {
923  filters.add(new FileSearchFiltering.FrequencyFilter(crFrequencyList.getSelectedValuesList()));
924  }
925 
926  if (sizeCheckbox.isSelected()) {
927  filters.add(new FileSearchFiltering.SizeFilter(sizeList.getSelectedValuesList()));
928  }
929 
930  if (keywordCheckbox.isSelected()) {
931  filters.add(new FileSearchFiltering.KeywordListFilter(keywordList.getSelectedValuesList()));
932  }
933 
934  if (hashSetCheckbox.isSelected()) {
935  filters.add(new FileSearchFiltering.HashSetFilter(hashSetList.getSelectedValuesList()));
936  }
937 
938  if (interestingItemsCheckbox.isSelected()) {
939  filters.add(new FileSearchFiltering.InterestingFileSetFilter(interestingItemsList.getSelectedValuesList()));
940  }
941 
942  if (objectsCheckbox.isSelected()) {
943  filters.add(new FileSearchFiltering.ObjectDetectionFilter(objectsList.getSelectedValuesList()));
944  }
945 
946  if (tagsCheckbox.isSelected()) {
947  filters.add(new FileSearchFiltering.TagsFilter(tagsList.getSelectedValuesList()));
948  }
949 
950  if (userCreatedCheckbox.isSelected()) {
951  filters.add(new FileSearchFiltering.UserCreatedFilter());
952  }
953 
954  if (notableCheckbox.isSelected()) {
955  filters.add(new FileSearchFiltering.NotableFilter());
956  }
957 
958  if (knownFilesCheckbox.isSelected()) {
959  filters.add(new FileSearchFiltering.KnownFilter());
960  }
961 
962  if (scoreCheckbox.isSelected()) {
963  filters.add(new FileSearchFiltering.ScoreFilter(scoreList.getSelectedValuesList()));
964  }
965 
966  return filters;
967  }
968 
974  private List<FileSearchFiltering.ParentSearchTerm> getParentPaths() {
975  List<FileSearchFiltering.ParentSearchTerm> results = new ArrayList<>();
976  for (int i = 0; i < parentListModel.getSize(); i++) {
977  results.add(parentListModel.get(i));
978  }
979  return results;
980  }
981 
987  FileSearch.AttributeType getGroupingAttribute() {
988  return groupByCombobox.getItemAt(groupByCombobox.getSelectedIndex()).getAttributeType();
989  }
990 
996  FileGroup.GroupSortingAlgorithm getGroupSortingMethod() {
997  return groupSortingComboBox.getItemAt(groupSortingComboBox.getSelectedIndex());
998 
999  }
1000 
1006  FileSorter.SortingMethod getFileSortingMethod() {
1007  return (FileSorter.SortingMethod) orderByCombobox.getSelectedItem();
1008  }
1009 
1010  @Override
1011  public void actionPerformed(ActionEvent e) {
1012  validateFields();
1013  }
1014 
1019  private class DataSourceItem {
1020 
1021  private final DataSource ds;
1022 
1023  DataSourceItem(DataSource ds) {
1024  this.ds = ds;
1025  }
1026 
1027  DataSource getDataSource() {
1028  return ds;
1029  }
1030 
1031  @Override
1032  public String toString() {
1033  return ds.getName() + " (ID: " + ds.getId() + ")";
1034  }
1035  }
1036 
1041  private void validateFields() {
1042  // There will be a file type selected.
1043  if (fileType == null) {
1044  setInvalid("At least one file type must be selected");
1045  return;
1046  }
1047  // For most enabled filters, there should be something selected
1048  if (dataSourceCheckbox.isSelected() && dataSourceList.getSelectedValuesList().isEmpty()) {
1049  setInvalid("At least one data source must be selected");
1050  return;
1051  }
1052  if (crFrequencyCheckbox.isSelected() && crFrequencyList.getSelectedValuesList().isEmpty()) {
1053  setInvalid("At least one CR frequency must be selected");
1054  return;
1055  }
1056  if (sizeCheckbox.isSelected() && sizeList.getSelectedValuesList().isEmpty()) {
1057  setInvalid("At least one size must be selected");
1058  return;
1059  }
1060  if (keywordCheckbox.isSelected() && keywordList.getSelectedValuesList().isEmpty()) {
1061  setInvalid("At least one keyword list name must be selected");
1062  return;
1063  }
1064 
1065  // Parent uses everything in the box
1066  if (parentCheckbox.isSelected() && getParentPaths().isEmpty()) {
1067  setInvalid("At least one parent path must be entered");
1068  return;
1069  }
1070 
1071  if (hashSetCheckbox.isSelected() && hashSetList.getSelectedValuesList().isEmpty()) {
1072  setInvalid("At least one hash set name must be selected");
1073  return;
1074  }
1075 
1076  if (interestingItemsCheckbox.isSelected() && interestingItemsList.getSelectedValuesList().isEmpty()) {
1077  setInvalid("At least one interesting file set name must be selected");
1078  return;
1079  }
1080 
1081  if (objectsCheckbox.isSelected() && objectsList.getSelectedValuesList().isEmpty()) {
1082  setInvalid("At least one object type name must be selected");
1083  return;
1084  }
1085 
1086  if (tagsCheckbox.isSelected() && tagsList.getSelectedValuesList().isEmpty()) {
1087  setInvalid("At least one tag name must be selected");
1088  return;
1089  }
1090 
1091  if (scoreCheckbox.isSelected() && scoreList.getSelectedValuesList().isEmpty()) {
1092  setInvalid("At least one score must be selected");
1093  return;
1094  }
1095  setValid();
1096  }
1097 
1101  private void setValid() {
1102  errorLabel.setText("");
1103  searchButton.setEnabled(true);
1104  }
1105 
1112  private void setInvalid(String error) {
1113  errorLabel.setText(error);
1114  searchButton.setEnabled(false);
1115  }
1116 
1122  @SuppressWarnings("unchecked")
1123  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
1124  private void initComponents() {
1125  java.awt.GridBagConstraints gridBagConstraints;
1126 
1127  javax.swing.ButtonGroup parentPathButtonGroup = new javax.swing.ButtonGroup();
1128  javax.swing.ButtonGroup parentIncludeButtonGroup = new javax.swing.ButtonGroup();
1129  javax.swing.JScrollPane filtersScrollPane = new javax.swing.JScrollPane();
1130  javax.swing.JPanel filtersPanel = new javax.swing.JPanel();
1131  sizeCheckbox = new javax.swing.JCheckBox();
1132  dataSourceCheckbox = new javax.swing.JCheckBox();
1133  crFrequencyCheckbox = new javax.swing.JCheckBox();
1134  keywordCheckbox = new javax.swing.JCheckBox();
1135  parentCheckbox = new javax.swing.JCheckBox();
1136  dataSourceScrollPane = new javax.swing.JScrollPane();
1137  dataSourceList = new javax.swing.JList<>();
1138  substringRadioButton = new javax.swing.JRadioButton();
1139  addButton = new javax.swing.JButton();
1140  deleteButton = new javax.swing.JButton();
1141  sizeScrollPane = new javax.swing.JScrollPane();
1142  sizeList = new javax.swing.JList<>();
1143  crFrequencyScrollPane = new javax.swing.JScrollPane();
1144  crFrequencyList = new javax.swing.JList<>();
1145  keywordScrollPane = new javax.swing.JScrollPane();
1146  keywordList = new javax.swing.JList<>();
1147  javax.swing.JLabel parentLabel = new javax.swing.JLabel();
1148  parentScrollPane = new javax.swing.JScrollPane();
1149  parentList = new javax.swing.JList<>();
1150  hashSetCheckbox = new javax.swing.JCheckBox();
1151  hashSetScrollPane = new javax.swing.JScrollPane();
1152  hashSetList = new javax.swing.JList<>();
1153  objectsCheckbox = new javax.swing.JCheckBox();
1154  tagsCheckbox = new javax.swing.JCheckBox();
1155  interestingItemsCheckbox = new javax.swing.JCheckBox();
1156  scoreCheckbox = new javax.swing.JCheckBox();
1157  userCreatedCheckbox = new javax.swing.JCheckBox();
1158  notableCheckbox = new javax.swing.JCheckBox();
1159  objectsScrollPane = new javax.swing.JScrollPane();
1160  objectsList = new javax.swing.JList<>();
1161  tagsScrollPane = new javax.swing.JScrollPane();
1162  tagsList = new javax.swing.JList<>();
1163  interestingItemsScrollPane = new javax.swing.JScrollPane();
1164  interestingItemsList = new javax.swing.JList<>();
1165  scoreScrollPane = new javax.swing.JScrollPane();
1166  scoreList = new javax.swing.JList<>();
1167  excludeRadioButton = new javax.swing.JRadioButton();
1168  knownFilesCheckbox = new javax.swing.JCheckBox();
1169  javax.swing.JPanel fullRadioPanel = new javax.swing.JPanel();
1170  fullRadioButton = new javax.swing.JRadioButton();
1171  javax.swing.JPanel includeRadioPanel = new javax.swing.JPanel();
1172  javax.swing.Box.Filler filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767));
1173  includeRadioButton = new javax.swing.JRadioButton();
1174  javax.swing.JPanel parentTextPanel = new javax.swing.JPanel();
1175  parentTextField = new javax.swing.JTextField();
1176  searchButton = new javax.swing.JButton();
1177  javax.swing.JPanel sortingPanel = new javax.swing.JPanel();
1178  groupByCombobox = new javax.swing.JComboBox<>();
1179  orderByCombobox = new javax.swing.JComboBox<>();
1180  javax.swing.JLabel orderGroupsByLabel = new javax.swing.JLabel();
1181  javax.swing.JLabel orderByLabel = new javax.swing.JLabel();
1182  javax.swing.JLabel groupByLabel = new javax.swing.JLabel();
1183  groupSortingComboBox = new javax.swing.JComboBox<>();
1184  errorLabel = new javax.swing.JLabel();
1185  cancelButton = new javax.swing.JButton();
1186  stepTwoLabel = new javax.swing.JLabel();
1187  javax.swing.JLabel stepThreeLabel = new javax.swing.JLabel();
1188 
1189  setMinimumSize(new java.awt.Dimension(10, 0));
1190  setPreferredSize(new java.awt.Dimension(321, 400));
1191 
1192  filtersScrollPane.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.filtersScrollPane.border.title"))); // NOI18N
1193  filtersScrollPane.setPreferredSize(new java.awt.Dimension(309, 400));
1194 
1195  filtersPanel.setMinimumSize(new java.awt.Dimension(280, 500));
1196  filtersPanel.setPreferredSize(new java.awt.Dimension(280, 540));
1197  filtersPanel.setLayout(new java.awt.GridBagLayout());
1198 
1199  org.openide.awt.Mnemonics.setLocalizedText(sizeCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.sizeCheckbox.text")); // NOI18N
1200  sizeCheckbox.addActionListener(new java.awt.event.ActionListener() {
1201  public void actionPerformed(java.awt.event.ActionEvent evt) {
1202  sizeCheckboxActionPerformed(evt);
1203  }
1204  });
1205  gridBagConstraints = new java.awt.GridBagConstraints();
1206  gridBagConstraints.gridx = 0;
1207  gridBagConstraints.gridy = 0;
1208  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1209  gridBagConstraints.insets = new java.awt.Insets(6, 6, 4, 0);
1210  filtersPanel.add(sizeCheckbox, gridBagConstraints);
1211 
1212  org.openide.awt.Mnemonics.setLocalizedText(dataSourceCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.dataSourceCheckbox.text")); // NOI18N
1213  dataSourceCheckbox.addActionListener(new java.awt.event.ActionListener() {
1214  public void actionPerformed(java.awt.event.ActionEvent evt) {
1215  dataSourceCheckboxActionPerformed(evt);
1216  }
1217  });
1218  gridBagConstraints = new java.awt.GridBagConstraints();
1219  gridBagConstraints.gridx = 0;
1220  gridBagConstraints.gridy = 1;
1221  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1222  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1223  filtersPanel.add(dataSourceCheckbox, gridBagConstraints);
1224 
1225  org.openide.awt.Mnemonics.setLocalizedText(crFrequencyCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.crFrequencyCheckbox.text")); // NOI18N
1226  crFrequencyCheckbox.addActionListener(new java.awt.event.ActionListener() {
1227  public void actionPerformed(java.awt.event.ActionEvent evt) {
1228  crFrequencyCheckboxActionPerformed(evt);
1229  }
1230  });
1231  gridBagConstraints = new java.awt.GridBagConstraints();
1232  gridBagConstraints.gridx = 0;
1233  gridBagConstraints.gridy = 2;
1234  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1235  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1236  filtersPanel.add(crFrequencyCheckbox, gridBagConstraints);
1237 
1238  org.openide.awt.Mnemonics.setLocalizedText(keywordCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.keywordCheckbox.text")); // NOI18N
1239  keywordCheckbox.addActionListener(new java.awt.event.ActionListener() {
1240  public void actionPerformed(java.awt.event.ActionEvent evt) {
1241  keywordCheckboxActionPerformed(evt);
1242  }
1243  });
1244  gridBagConstraints = new java.awt.GridBagConstraints();
1245  gridBagConstraints.gridx = 0;
1246  gridBagConstraints.gridy = 12;
1247  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1248  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1249  filtersPanel.add(keywordCheckbox, gridBagConstraints);
1250 
1251  org.openide.awt.Mnemonics.setLocalizedText(parentCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.parentCheckbox.text")); // NOI18N
1252  parentCheckbox.addActionListener(new java.awt.event.ActionListener() {
1253  public void actionPerformed(java.awt.event.ActionEvent evt) {
1254  parentCheckboxActionPerformed(evt);
1255  }
1256  });
1257  gridBagConstraints = new java.awt.GridBagConstraints();
1258  gridBagConstraints.gridx = 0;
1259  gridBagConstraints.gridy = 7;
1260  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1261  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1262  filtersPanel.add(parentCheckbox, gridBagConstraints);
1263 
1264  dataSourceList.setModel(new DefaultListModel<DataSourceItem>());
1265  dataSourceList.setEnabled(false);
1266  dataSourceList.setVisibleRowCount(5);
1267  dataSourceScrollPane.setViewportView(dataSourceList);
1268 
1269  gridBagConstraints = new java.awt.GridBagConstraints();
1270  gridBagConstraints.gridx = 1;
1271  gridBagConstraints.gridy = 1;
1272  gridBagConstraints.gridwidth = 3;
1273  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1274  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1275  gridBagConstraints.weightx = 0.5;
1276  gridBagConstraints.weighty = 0.1;
1277  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
1278  filtersPanel.add(dataSourceScrollPane, gridBagConstraints);
1279 
1280  parentPathButtonGroup.add(substringRadioButton);
1281  org.openide.awt.Mnemonics.setLocalizedText(substringRadioButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.substringRadioButton.text")); // NOI18N
1282  substringRadioButton.setEnabled(false);
1283  gridBagConstraints = new java.awt.GridBagConstraints();
1284  gridBagConstraints.gridx = 2;
1285  gridBagConstraints.gridy = 9;
1286  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1287  gridBagConstraints.weightx = 0.1;
1288  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0);
1289  filtersPanel.add(substringRadioButton, gridBagConstraints);
1290 
1291  org.openide.awt.Mnemonics.setLocalizedText(addButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.addButton.text")); // NOI18N
1292  addButton.setEnabled(false);
1293  addButton.setMaximumSize(new java.awt.Dimension(70, 23));
1294  addButton.setMinimumSize(new java.awt.Dimension(70, 23));
1295  addButton.setPreferredSize(new java.awt.Dimension(70, 23));
1296  addButton.addActionListener(new java.awt.event.ActionListener() {
1297  public void actionPerformed(java.awt.event.ActionEvent evt) {
1298  addButtonActionPerformed(evt);
1299  }
1300  });
1301  gridBagConstraints = new java.awt.GridBagConstraints();
1302  gridBagConstraints.gridx = 3;
1303  gridBagConstraints.gridy = 11;
1304  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_END;
1305  gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 6);
1306  filtersPanel.add(addButton, gridBagConstraints);
1307 
1308  org.openide.awt.Mnemonics.setLocalizedText(deleteButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.deleteButton.text")); // NOI18N
1309  deleteButton.setEnabled(false);
1310  deleteButton.setMaximumSize(new java.awt.Dimension(70, 23));
1311  deleteButton.setMinimumSize(new java.awt.Dimension(70, 23));
1312  deleteButton.setPreferredSize(new java.awt.Dimension(70, 23));
1313  deleteButton.addActionListener(new java.awt.event.ActionListener() {
1314  public void actionPerformed(java.awt.event.ActionEvent evt) {
1315  deleteButtonActionPerformed(evt);
1316  }
1317  });
1318  gridBagConstraints = new java.awt.GridBagConstraints();
1319  gridBagConstraints.gridx = 3;
1320  gridBagConstraints.gridy = 10;
1321  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_END;
1322  gridBagConstraints.insets = new java.awt.Insets(0, 10, 4, 6);
1323  filtersPanel.add(deleteButton, gridBagConstraints);
1324 
1325  sizeList.setModel(new DefaultListModel<FileSize>());
1326  sizeList.setEnabled(false);
1327  sizeList.setVisibleRowCount(5);
1328  sizeScrollPane.setViewportView(sizeList);
1329 
1330  gridBagConstraints = new java.awt.GridBagConstraints();
1331  gridBagConstraints.gridx = 1;
1332  gridBagConstraints.gridy = 0;
1333  gridBagConstraints.gridwidth = 3;
1334  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1335  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1336  gridBagConstraints.weightx = 0.5;
1337  gridBagConstraints.weighty = 0.1;
1338  gridBagConstraints.insets = new java.awt.Insets(6, 4, 4, 6);
1339  filtersPanel.add(sizeScrollPane, gridBagConstraints);
1340 
1341  crFrequencyList.setModel(new DefaultListModel<Frequency>());
1342  crFrequencyList.setEnabled(false);
1343  crFrequencyList.setVisibleRowCount(5);
1344  crFrequencyScrollPane.setViewportView(crFrequencyList);
1345 
1346  gridBagConstraints = new java.awt.GridBagConstraints();
1347  gridBagConstraints.gridx = 1;
1348  gridBagConstraints.gridy = 2;
1349  gridBagConstraints.gridwidth = 3;
1350  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1351  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1352  gridBagConstraints.weightx = 0.5;
1353  gridBagConstraints.weighty = 0.1;
1354  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
1355  filtersPanel.add(crFrequencyScrollPane, gridBagConstraints);
1356 
1357  keywordList.setModel(new DefaultListModel<String>());
1358  keywordList.setEnabled(false);
1359  keywordList.setVisibleRowCount(3);
1360  keywordScrollPane.setViewportView(keywordList);
1361 
1362  gridBagConstraints = new java.awt.GridBagConstraints();
1363  gridBagConstraints.gridx = 1;
1364  gridBagConstraints.gridy = 12;
1365  gridBagConstraints.gridwidth = 3;
1366  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1367  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1368  gridBagConstraints.weightx = 0.5;
1369  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
1370  filtersPanel.add(keywordScrollPane, gridBagConstraints);
1371 
1372  org.openide.awt.Mnemonics.setLocalizedText(parentLabel, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.parentLabel.text")); // NOI18N
1373  gridBagConstraints = new java.awt.GridBagConstraints();
1374  gridBagConstraints.gridx = 0;
1375  gridBagConstraints.gridy = 8;
1376  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1377  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1378  filtersPanel.add(parentLabel, gridBagConstraints);
1379 
1380  parentList.setModel(new DefaultListModel<ParentSearchTerm>());
1381  parentList.setEnabled(false);
1382  parentList.setVisibleRowCount(4);
1383  parentList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
1384  public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
1385  parentListValueChanged(evt);
1386  }
1387  });
1388  parentScrollPane.setViewportView(parentList);
1389 
1390  gridBagConstraints = new java.awt.GridBagConstraints();
1391  gridBagConstraints.gridx = 1;
1392  gridBagConstraints.gridy = 7;
1393  gridBagConstraints.gridwidth = 3;
1394  gridBagConstraints.gridheight = 2;
1395  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1396  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1397  gridBagConstraints.weightx = 0.5;
1398  gridBagConstraints.weighty = 0.05;
1399  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
1400  filtersPanel.add(parentScrollPane, gridBagConstraints);
1401 
1402  org.openide.awt.Mnemonics.setLocalizedText(hashSetCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.hashSetCheckbox.text")); // NOI18N
1403  hashSetCheckbox.addActionListener(new java.awt.event.ActionListener() {
1404  public void actionPerformed(java.awt.event.ActionEvent evt) {
1405  hashSetCheckboxActionPerformed(evt);
1406  }
1407  });
1408  gridBagConstraints = new java.awt.GridBagConstraints();
1409  gridBagConstraints.gridx = 0;
1410  gridBagConstraints.gridy = 4;
1411  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1412  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1413  filtersPanel.add(hashSetCheckbox, gridBagConstraints);
1414 
1415  hashSetList.setModel(new DefaultListModel<String>());
1416  hashSetList.setEnabled(false);
1417  hashSetList.setVisibleRowCount(3);
1418  hashSetScrollPane.setViewportView(hashSetList);
1419 
1420  gridBagConstraints = new java.awt.GridBagConstraints();
1421  gridBagConstraints.gridx = 1;
1422  gridBagConstraints.gridy = 4;
1423  gridBagConstraints.gridwidth = 3;
1424  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1425  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1426  gridBagConstraints.weightx = 0.5;
1427  gridBagConstraints.weighty = 0.05;
1428  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
1429  filtersPanel.add(hashSetScrollPane, gridBagConstraints);
1430 
1431  org.openide.awt.Mnemonics.setLocalizedText(objectsCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.objectsCheckbox.text")); // NOI18N
1432  objectsCheckbox.addActionListener(new java.awt.event.ActionListener() {
1433  public void actionPerformed(java.awt.event.ActionEvent evt) {
1434  objectsCheckboxActionPerformed(evt);
1435  }
1436  });
1437  gridBagConstraints = new java.awt.GridBagConstraints();
1438  gridBagConstraints.gridx = 0;
1439  gridBagConstraints.gridy = 6;
1440  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1441  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1442  filtersPanel.add(objectsCheckbox, gridBagConstraints);
1443 
1444  org.openide.awt.Mnemonics.setLocalizedText(tagsCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.tagsCheckbox.text")); // NOI18N
1445  tagsCheckbox.addActionListener(new java.awt.event.ActionListener() {
1446  public void actionPerformed(java.awt.event.ActionEvent evt) {
1447  tagsCheckboxActionPerformed(evt);
1448  }
1449  });
1450  gridBagConstraints = new java.awt.GridBagConstraints();
1451  gridBagConstraints.gridx = 0;
1452  gridBagConstraints.gridy = 13;
1453  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1454  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1455  filtersPanel.add(tagsCheckbox, gridBagConstraints);
1456 
1457  org.openide.awt.Mnemonics.setLocalizedText(interestingItemsCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.interestingItemsCheckbox.text")); // NOI18N
1458  interestingItemsCheckbox.addActionListener(new java.awt.event.ActionListener() {
1459  public void actionPerformed(java.awt.event.ActionEvent evt) {
1460  interestingItemsCheckboxActionPerformed(evt);
1461  }
1462  });
1463  gridBagConstraints = new java.awt.GridBagConstraints();
1464  gridBagConstraints.gridx = 0;
1465  gridBagConstraints.gridy = 5;
1466  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1467  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1468  filtersPanel.add(interestingItemsCheckbox, gridBagConstraints);
1469 
1470  org.openide.awt.Mnemonics.setLocalizedText(scoreCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.scoreCheckbox.text")); // NOI18N
1471  scoreCheckbox.addActionListener(new java.awt.event.ActionListener() {
1472  public void actionPerformed(java.awt.event.ActionEvent evt) {
1473  scoreCheckboxActionPerformed(evt);
1474  }
1475  });
1476  gridBagConstraints = new java.awt.GridBagConstraints();
1477  gridBagConstraints.gridx = 0;
1478  gridBagConstraints.gridy = 14;
1479  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1480  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
1481  filtersPanel.add(scoreCheckbox, gridBagConstraints);
1482 
1483  org.openide.awt.Mnemonics.setLocalizedText(userCreatedCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.userCreatedCheckbox.text")); // NOI18N
1484  gridBagConstraints = new java.awt.GridBagConstraints();
1485  gridBagConstraints.gridx = 0;
1486  gridBagConstraints.gridy = 3;
1487  gridBagConstraints.gridwidth = 4;
1488  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1489  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 6);
1490  filtersPanel.add(userCreatedCheckbox, gridBagConstraints);
1491 
1492  org.openide.awt.Mnemonics.setLocalizedText(notableCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.notableCheckbox.text")); // NOI18N
1493  gridBagConstraints = new java.awt.GridBagConstraints();
1494  gridBagConstraints.gridx = 0;
1495  gridBagConstraints.gridy = 15;
1496  gridBagConstraints.gridwidth = 4;
1497  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1498  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 6);
1499  filtersPanel.add(notableCheckbox, gridBagConstraints);
1500 
1501  objectsList.setModel(new DefaultListModel<String>());
1502  objectsList.setEnabled(false);
1503  objectsList.setVisibleRowCount(2);
1504  objectsScrollPane.setViewportView(objectsList);
1505 
1506  gridBagConstraints = new java.awt.GridBagConstraints();
1507  gridBagConstraints.gridx = 1;
1508  gridBagConstraints.gridy = 6;
1509  gridBagConstraints.gridwidth = 3;
1510  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1511  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1512  gridBagConstraints.weightx = 0.5;
1513  gridBagConstraints.weighty = 0.05;
1514  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
1515  filtersPanel.add(objectsScrollPane, gridBagConstraints);
1516 
1517  tagsList.setModel(new DefaultListModel<TagName>());
1518  tagsList.setEnabled(false);
1519  tagsList.setVisibleRowCount(3);
1520  tagsScrollPane.setViewportView(tagsList);
1521 
1522  gridBagConstraints = new java.awt.GridBagConstraints();
1523  gridBagConstraints.gridx = 1;
1524  gridBagConstraints.gridy = 13;
1525  gridBagConstraints.gridwidth = 3;
1526  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1527  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1528  gridBagConstraints.weightx = 0.5;
1529  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
1530  filtersPanel.add(tagsScrollPane, gridBagConstraints);
1531 
1532  interestingItemsList.setModel(new DefaultListModel<String>());
1533  interestingItemsList.setEnabled(false);
1534  interestingItemsList.setVisibleRowCount(2);
1535  interestingItemsScrollPane.setViewportView(interestingItemsList);
1536 
1537  gridBagConstraints = new java.awt.GridBagConstraints();
1538  gridBagConstraints.gridx = 1;
1539  gridBagConstraints.gridy = 5;
1540  gridBagConstraints.gridwidth = 3;
1541  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1542  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1543  gridBagConstraints.weightx = 0.5;
1544  gridBagConstraints.weighty = 0.05;
1545  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
1546  filtersPanel.add(interestingItemsScrollPane, gridBagConstraints);
1547 
1548  scoreList.setModel(new DefaultListModel<Score>());
1549  scoreList.setEnabled(false);
1550  scoreList.setVisibleRowCount(3);
1551  scoreScrollPane.setViewportView(scoreList);
1552 
1553  gridBagConstraints = new java.awt.GridBagConstraints();
1554  gridBagConstraints.gridx = 1;
1555  gridBagConstraints.gridy = 14;
1556  gridBagConstraints.gridwidth = 3;
1557  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1558  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1559  gridBagConstraints.weightx = 0.5;
1560  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
1561  filtersPanel.add(scoreScrollPane, gridBagConstraints);
1562 
1563  parentIncludeButtonGroup.add(excludeRadioButton);
1564  org.openide.awt.Mnemonics.setLocalizedText(excludeRadioButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.excludeRadioButton.text")); // NOI18N
1565  excludeRadioButton.setEnabled(false);
1566  gridBagConstraints = new java.awt.GridBagConstraints();
1567  gridBagConstraints.gridx = 2;
1568  gridBagConstraints.gridy = 10;
1569  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1570  gridBagConstraints.weightx = 0.1;
1571  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0);
1572  filtersPanel.add(excludeRadioButton, gridBagConstraints);
1573 
1574  org.openide.awt.Mnemonics.setLocalizedText(knownFilesCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.knownFilesCheckbox.text")); // NOI18N
1575  knownFilesCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.knownFilesCheckbox.toolTipText")); // NOI18N
1576  gridBagConstraints = new java.awt.GridBagConstraints();
1577  gridBagConstraints.gridx = 0;
1578  gridBagConstraints.gridy = 16;
1579  gridBagConstraints.gridwidth = 4;
1580  gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
1581  gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 6);
1582  filtersPanel.add(knownFilesCheckbox, gridBagConstraints);
1583 
1584  parentPathButtonGroup.add(fullRadioButton);
1585  fullRadioButton.setSelected(true);
1586  org.openide.awt.Mnemonics.setLocalizedText(fullRadioButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.fullRadioButton.text")); // NOI18N
1587  fullRadioButton.setEnabled(false);
1588 
1589  javax.swing.GroupLayout fullRadioPanelLayout = new javax.swing.GroupLayout(fullRadioPanel);
1590  fullRadioPanel.setLayout(fullRadioPanelLayout);
1591  fullRadioPanelLayout.setHorizontalGroup(
1592  fullRadioPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1593  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, fullRadioPanelLayout.createSequentialGroup()
1594  .addContainerGap(58, Short.MAX_VALUE)
1595  .addComponent(fullRadioButton)
1596  .addGap(20, 20, 20))
1597  );
1598  fullRadioPanelLayout.setVerticalGroup(
1599  fullRadioPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1600  .addGroup(fullRadioPanelLayout.createSequentialGroup()
1601  .addComponent(fullRadioButton)
1602  .addGap(0, 4, Short.MAX_VALUE))
1603  );
1604 
1605  gridBagConstraints = new java.awt.GridBagConstraints();
1606  gridBagConstraints.gridx = 0;
1607  gridBagConstraints.gridy = 9;
1608  gridBagConstraints.gridwidth = 2;
1609  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1610  gridBagConstraints.weightx = 1.0;
1611  filtersPanel.add(fullRadioPanel, gridBagConstraints);
1612 
1613  parentIncludeButtonGroup.add(includeRadioButton);
1614  includeRadioButton.setSelected(true);
1615  org.openide.awt.Mnemonics.setLocalizedText(includeRadioButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.includeRadioButton.text")); // NOI18N
1616  includeRadioButton.setEnabled(false);
1617 
1618  javax.swing.GroupLayout includeRadioPanelLayout = new javax.swing.GroupLayout(includeRadioPanel);
1619  includeRadioPanel.setLayout(includeRadioPanelLayout);
1620  includeRadioPanelLayout.setHorizontalGroup(
1621  includeRadioPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1622  .addGroup(includeRadioPanelLayout.createSequentialGroup()
1623  .addComponent(filler2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1624  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 58, Short.MAX_VALUE)
1625  .addComponent(includeRadioButton))
1626  );
1627  includeRadioPanelLayout.setVerticalGroup(
1628  includeRadioPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1629  .addComponent(filler2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1630  .addComponent(includeRadioButton)
1631  );
1632 
1633  gridBagConstraints = new java.awt.GridBagConstraints();
1634  gridBagConstraints.gridx = 0;
1635  gridBagConstraints.gridy = 10;
1636  gridBagConstraints.gridwidth = 2;
1637  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1638  gridBagConstraints.weightx = 1.0;
1639  filtersPanel.add(includeRadioPanel, gridBagConstraints);
1640 
1641  parentTextField.setEnabled(false);
1642 
1643  javax.swing.GroupLayout parentTextPanelLayout = new javax.swing.GroupLayout(parentTextPanel);
1644  parentTextPanel.setLayout(parentTextPanelLayout);
1645  parentTextPanelLayout.setHorizontalGroup(
1646  parentTextPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1647  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, parentTextPanelLayout.createSequentialGroup()
1648  .addGap(0, 0, 0)
1649  .addComponent(parentTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE))
1650  );
1651  parentTextPanelLayout.setVerticalGroup(
1652  parentTextPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1653  .addComponent(parentTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1654  );
1655 
1656  gridBagConstraints = new java.awt.GridBagConstraints();
1657  gridBagConstraints.gridx = 1;
1658  gridBagConstraints.gridy = 11;
1659  gridBagConstraints.gridwidth = 2;
1660  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1661  gridBagConstraints.weightx = 1.5;
1662  gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0);
1663  filtersPanel.add(parentTextPanel, gridBagConstraints);
1664 
1665  filtersScrollPane.setViewportView(filtersPanel);
1666 
1667  org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.searchButton.text")); // NOI18N
1668  searchButton.addActionListener(new java.awt.event.ActionListener() {
1669  public void actionPerformed(java.awt.event.ActionEvent evt) {
1670  searchButtonActionPerformed(evt);
1671  }
1672  });
1673 
1674  sortingPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.sortingPanel.border.title"))); // NOI18N
1675  sortingPanel.setPreferredSize(new java.awt.Dimension(345, 112));
1676 
1677  org.openide.awt.Mnemonics.setLocalizedText(orderGroupsByLabel, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.orderGroupsByLabel.text")); // NOI18N
1678 
1679  org.openide.awt.Mnemonics.setLocalizedText(orderByLabel, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.orderByLabel.text")); // NOI18N
1680 
1681  org.openide.awt.Mnemonics.setLocalizedText(groupByLabel, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.groupByLabel.text")); // NOI18N
1682 
1683  javax.swing.GroupLayout sortingPanelLayout = new javax.swing.GroupLayout(sortingPanel);
1684  sortingPanel.setLayout(sortingPanelLayout);
1685  sortingPanelLayout.setHorizontalGroup(
1686  sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1687  .addGroup(sortingPanelLayout.createSequentialGroup()
1688  .addContainerGap()
1689  .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1690  .addComponent(orderGroupsByLabel)
1691  .addGroup(sortingPanelLayout.createSequentialGroup()
1692  .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1693  .addComponent(groupByLabel)
1694  .addComponent(orderByLabel))
1695  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1696  .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1697  .addComponent(groupSortingComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1698  .addComponent(orderByCombobox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1699  .addComponent(groupByCombobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
1700  .addContainerGap())
1701  );
1702  sortingPanelLayout.setVerticalGroup(
1703  sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1704  .addGroup(sortingPanelLayout.createSequentialGroup()
1705  .addGap(6, 6, 6)
1706  .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1707  .addComponent(groupByCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1708  .addComponent(groupByLabel))
1709  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1710  .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1711  .addComponent(groupSortingComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1712  .addComponent(orderGroupsByLabel))
1713  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1714  .addGroup(sortingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1715  .addComponent(orderByCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1716  .addComponent(orderByLabel))
1717  .addContainerGap())
1718  );
1719 
1720  errorLabel.setForeground(new java.awt.Color(255, 0, 0));
1721 
1722  org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.cancelButton.text")); // NOI18N
1723  cancelButton.setEnabled(false);
1724  cancelButton.addActionListener(new java.awt.event.ActionListener() {
1725  public void actionPerformed(java.awt.event.ActionEvent evt) {
1726  cancelButtonActionPerformed(evt);
1727  }
1728  });
1729 
1730  org.openide.awt.Mnemonics.setLocalizedText(stepThreeLabel, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.stepThreeLabel.text")); // NOI18N
1731 
1732  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
1733  this.setLayout(layout);
1734  layout.setHorizontalGroup(
1735  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1736  .addGroup(layout.createSequentialGroup()
1737  .addGap(6, 6, 6)
1738  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1739  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1740  .addComponent(stepTwoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1741  .addContainerGap())
1742  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1743  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1744  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
1745  .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1746  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1747  .addComponent(cancelButton)
1748  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1749  .addComponent(searchButton))
1750  .addComponent(stepThreeLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1751  .addComponent(filtersScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1752  .addComponent(sortingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE))
1753  .addGap(6, 6, 6))))
1754  );
1755 
1756  layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, searchButton});
1757 
1758  layout.setVerticalGroup(
1759  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1760  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1761  .addGap(6, 6, 6)
1762  .addComponent(stepTwoLabel)
1763  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1764  .addComponent(filtersScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE)
1765  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1766  .addComponent(stepThreeLabel)
1767  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1768  .addComponent(sortingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1769  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1770  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1771  .addComponent(errorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
1772  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1773  .addComponent(cancelButton)
1774  .addComponent(searchButton)))
1775  .addGap(6, 6, 6))
1776  );
1777  }// </editor-fold>//GEN-END:initComponents
1778 
1779  private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed
1780  // Get the selected filters
1781  List<FileSearchFiltering.FileFilter> filters = getFilters();
1782  enableSearch(false);
1783  DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.SearchStartedEvent(fileType));
1784 
1785  // Get the grouping attribute and group sorting method
1786  FileSearch.AttributeType groupingAttr = getGroupingAttribute();
1787  FileGroup.GroupSortingAlgorithm groupSortAlgorithm = getGroupSortingMethod();
1788 
1789  // Get the file sorting method
1790  FileSorter.SortingMethod fileSort = getFileSortingMethod();
1791  CentralRepository centralRepoDb = null;
1792  if (CentralRepository.isEnabled()) {
1793  try {
1794  centralRepoDb = CentralRepository.getInstance();
1795  } catch (CentralRepoException ex) {
1796  centralRepoDb = null;
1797  logger.log(Level.SEVERE, "Error loading central repository database, no central repository options will be available for File Discovery", ex);
1798  }
1799  }
1800  searchWorker = new SearchWorker(centralRepoDb, filters, groupingAttr, groupSortAlgorithm, fileSort);
1801  searchWorker.execute();
1802  }//GEN-LAST:event_searchButtonActionPerformed
1803 
1811  private void enableSearch(boolean enabled) {
1812  if (enabled) {
1813  DiscoveryTopComponent.getTopComponent().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
1814  } else {
1815  DiscoveryTopComponent.getTopComponent().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
1816  }
1817  if (null != fileType) {
1818  switch (fileType) {
1819  case IMAGE:
1820  imagesSelected(enabled, false);
1821  break;
1822  case VIDEO:
1823  videosSelected(enabled, false);
1824  break;
1825  case DOCUMENTS:
1826  documentsSelected(enabled, false);
1827  break;
1828  default:
1829  break;
1830  }
1831  }
1832  searchButton.setEnabled(enabled);
1833  cancelButton.setEnabled(!enabled);
1834  orderByCombobox.setEnabled(enabled);
1835  groupByCombobox.setEnabled(enabled);
1836  groupSortingComboBox.setEnabled(enabled);
1837  }
1838 
1844  @Subscribe
1845  void handleSearchCancelledEvent(DiscoveryEventUtils.SearchCancelledEvent searchCancelledEvent) {
1846  SwingUtilities.invokeLater(() -> {
1847  enableSearch(true);
1848  });
1849  }
1850 
1856  @Subscribe
1857  void handleSearchCompleteEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompleteEvent) {
1858  SwingUtilities.invokeLater(() -> {
1859  enableSearch(true);
1860  });
1861  }
1862 
1863  private void parentCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_parentCheckboxActionPerformed
1864  parentFilterSettings(true, true, parentCheckbox.isSelected(), null);
1865  }//GEN-LAST:event_parentCheckboxActionPerformed
1866 
1867  private void keywordCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keywordCheckboxActionPerformed
1868  keywordList.setEnabled(keywordCheckbox.isSelected());
1869  }//GEN-LAST:event_keywordCheckboxActionPerformed
1870 
1871  private void sizeCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sizeCheckboxActionPerformed
1872  sizeList.setEnabled(sizeCheckbox.isSelected());
1873  }//GEN-LAST:event_sizeCheckboxActionPerformed
1874 
1875  private void crFrequencyCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_crFrequencyCheckboxActionPerformed
1876  crFrequencyList.setEnabled(crFrequencyCheckbox.isSelected());
1877  }//GEN-LAST:event_crFrequencyCheckboxActionPerformed
1878 
1879  private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
1880  if (!parentTextField.getText().isEmpty()) {
1881  ParentSearchTerm searchTerm;
1882  searchTerm = new ParentSearchTerm(parentTextField.getText(), fullRadioButton.isSelected(), includeRadioButton.isSelected());
1883  parentListModel.add(parentListModel.size(), searchTerm);
1884  validateFields();
1885  parentTextField.setText("");
1886  }
1887  }//GEN-LAST:event_addButtonActionPerformed
1888 
1892  void cancelSearch() {
1893  if (searchWorker != null) {
1894  searchWorker.cancel(true);
1895  }
1896  }
1897 
1898  private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
1899  int index = parentList.getSelectedIndex();
1900  if (index >= 0) {
1901  parentListModel.remove(index);
1902  }
1903  validateFields();
1904  }//GEN-LAST:event_deleteButtonActionPerformed
1905 
1906  private void parentListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_parentListValueChanged
1907  if (parentList.getSelectedValuesList().isEmpty()) {
1908  deleteButton.setEnabled(false);
1909  } else {
1910  deleteButton.setEnabled(true);
1911  }
1912  }//GEN-LAST:event_parentListValueChanged
1913 
1914  private void dataSourceCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourceCheckboxActionPerformed
1915  dataSourceList.setEnabled(dataSourceCheckbox.isSelected());
1916  }//GEN-LAST:event_dataSourceCheckboxActionPerformed
1917 
1918  private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
1919  cancelSearch();
1920  }//GEN-LAST:event_cancelButtonActionPerformed
1921 
1922  private void hashSetCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hashSetCheckboxActionPerformed
1923  hashSetList.setEnabled(hashSetCheckbox.isSelected());
1924  }//GEN-LAST:event_hashSetCheckboxActionPerformed
1925 
1926  private void objectsCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_objectsCheckboxActionPerformed
1927  objectsList.setEnabled(objectsCheckbox.isSelected());
1928  }//GEN-LAST:event_objectsCheckboxActionPerformed
1929 
1930  private void tagsCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tagsCheckboxActionPerformed
1931  tagsList.setEnabled(tagsCheckbox.isSelected());
1932  }//GEN-LAST:event_tagsCheckboxActionPerformed
1933 
1934  private void interestingItemsCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_interestingItemsCheckboxActionPerformed
1935  interestingItemsList.setEnabled(interestingItemsCheckbox.isSelected());
1936  }//GEN-LAST:event_interestingItemsCheckboxActionPerformed
1937 
1938  private void scoreCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_scoreCheckboxActionPerformed
1939  scoreList.setEnabled(scoreCheckbox.isSelected());
1940  }//GEN-LAST:event_scoreCheckboxActionPerformed
1941 
1942 
1943  // Variables declaration - do not modify//GEN-BEGIN:variables
1944  private javax.swing.JButton addButton;
1945  private javax.swing.JButton cancelButton;
1946  private javax.swing.JCheckBox crFrequencyCheckbox;
1947  private javax.swing.JList<Frequency> crFrequencyList;
1948  private javax.swing.JScrollPane crFrequencyScrollPane;
1949  private javax.swing.JCheckBox dataSourceCheckbox;
1950  private javax.swing.JList<DataSourceItem> dataSourceList;
1951  private javax.swing.JScrollPane dataSourceScrollPane;
1952  private javax.swing.JButton deleteButton;
1953  private javax.swing.JLabel errorLabel;
1954  private javax.swing.JRadioButton excludeRadioButton;
1955  private javax.swing.JRadioButton fullRadioButton;
1956  private javax.swing.JComboBox<GroupingAttributeType> groupByCombobox;
1957  private javax.swing.JComboBox<GroupSortingAlgorithm> groupSortingComboBox;
1958  private javax.swing.JCheckBox hashSetCheckbox;
1959  private javax.swing.JList<String> hashSetList;
1960  private javax.swing.JScrollPane hashSetScrollPane;
1961  private javax.swing.JRadioButton includeRadioButton;
1962  private javax.swing.JCheckBox interestingItemsCheckbox;
1963  private javax.swing.JList<String> interestingItemsList;
1964  private javax.swing.JScrollPane interestingItemsScrollPane;
1965  private javax.swing.JCheckBox keywordCheckbox;
1966  private javax.swing.JList<String> keywordList;
1967  private javax.swing.JScrollPane keywordScrollPane;
1968  private javax.swing.JCheckBox knownFilesCheckbox;
1969  private javax.swing.JCheckBox notableCheckbox;
1970  private javax.swing.JCheckBox objectsCheckbox;
1971  private javax.swing.JList<String> objectsList;
1972  private javax.swing.JScrollPane objectsScrollPane;
1973  private javax.swing.JComboBox<SortingMethod> orderByCombobox;
1974  private javax.swing.JCheckBox parentCheckbox;
1975  private javax.swing.JList<ParentSearchTerm> parentList;
1976  private javax.swing.JScrollPane parentScrollPane;
1977  private javax.swing.JTextField parentTextField;
1978  private javax.swing.JCheckBox scoreCheckbox;
1979  private javax.swing.JList<Score> scoreList;
1980  private javax.swing.JScrollPane scoreScrollPane;
1981  private javax.swing.JButton searchButton;
1982  private javax.swing.JCheckBox sizeCheckbox;
1983  private javax.swing.JList<FileSize> sizeList;
1984  private javax.swing.JScrollPane sizeScrollPane;
1985  private javax.swing.JLabel stepTwoLabel;
1986  private javax.swing.JRadioButton substringRadioButton;
1987  private javax.swing.JCheckBox tagsCheckbox;
1988  private javax.swing.JList<TagName> tagsList;
1989  private javax.swing.JScrollPane tagsScrollPane;
1990  private javax.swing.JCheckBox userCreatedCheckbox;
1991  // End of variables declaration//GEN-END:variables
1992 
1993 }
java.awt.Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus)

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.