19 package org.sleuthkit.autopsy.filesearch;
21 import java.awt.event.ActionListener;
22 import org.openide.util.NbBundle;
23 import org.openide.util.NbBundle.Messages;
29 class KnownStatusSearchFilter
extends AbstractFileSearchFilter<KnownStatusSearchPanel> {
31 private static final String NONE_SELECTED_MESSAGE = NbBundle
32 .getMessage(KnownStatusSearchFilter.class,
"KnownStatusSearchFilter.noneSelectedMsg.text");
34 KnownStatusSearchFilter(KnownStatusSearchPanel panel) {
38 KnownStatusSearchFilter() {
39 this(
new KnownStatusSearchPanel());
43 public boolean isEnabled() {
44 return this.getComponent().getKnownCheckBox().isSelected();
49 public String getPredicate() throws FilterValidationException {
50 KnownStatusSearchPanel panel = this.getComponent();
52 boolean unknown = panel.getUnknownOptionCheckBox().isSelected();
53 boolean known = panel.getKnownOptionCheckBox().isSelected();
54 boolean knownBad = panel.getKnownBadOptionCheckBox().isSelected();
56 if (!(unknown || known || knownBad)) {
57 throw new FilterValidationException(NONE_SELECTED_MESSAGE);
62 expr +=
" OR " + predicateHelper(FileKnown.UNKNOWN);
65 expr +=
" OR " + predicateHelper(FileKnown.KNOWN);
68 expr +=
" OR " + predicateHelper(FileKnown.BAD);
80 private String predicateHelper(FileKnown knownStatus) {
81 return "known = " + knownStatus.getFileKnownValue();
85 public void addActionListener(ActionListener l) {
90 "KnownStatusSearchFilter.errorMessage.noKnownStatusCheckboxSelected=At least one known status checkbox must be selected."
92 public boolean isValid() {
93 if (!this.getComponent().isValidSearch()) {
94 setLastError(Bundle.KnownStatusSearchFilter_errorMessage_noKnownStatusCheckboxSelected());