19 package org.sleuthkit.autopsy.filesearch;
21 import java.awt.event.ActionListener;
22 import org.openide.util.NbBundle;
28 class HashSearchFilter
extends AbstractFileSearchFilter<HashSearchPanel> {
30 private static final String EMPTY_HASH_MESSAGE = NbBundle
31 .getMessage(HashSearchFilter.class,
"HashSearchPanel.emptyHashMsg.text");
33 public HashSearchFilter() {
34 this(
new HashSearchPanel());
37 public HashSearchFilter(HashSearchPanel component) {
42 public boolean isEnabled() {
43 return this.getComponent().getHashCheckBox().isSelected();
47 public String getPredicate() throws FilterValidationException {
48 String md5Hash = this.getComponent().getSearchTextField().getText();
50 if (md5Hash.isEmpty()) {
51 throw new FilterValidationException(EMPTY_HASH_MESSAGE);
54 return "md5 = '" + md5Hash.toLowerCase() +
"'";
58 public void addActionListener(ActionListener l) {
59 getComponent().addActionListener(l);
63 public boolean isValid() {
64 return !this.getComponent().getSearchTextField().getText().isEmpty();