19 package org.sleuthkit.autopsy.filesearch;
21 import java.awt.event.ActionListener;
22 import org.openide.util.NbBundle;
29 class NameSearchFilter
extends AbstractFileSearchFilter<NameSearchPanel> {
31 private static final String EMPTY_NAME_MESSAGE = NbBundle
32 .getMessage(NameSearchFilter.class,
"NameSearchFilter.emptyNameMsg.text");
34 public NameSearchFilter() {
35 this(
new NameSearchPanel());
38 public NameSearchFilter(NameSearchPanel component) {
43 public boolean isEnabled() {
44 return this.getComponent().getNameCheckBox().isSelected();
48 public String getPredicate() throws FilterValidationException {
49 String keyword = this.getComponent().getSearchTextField().getText();
51 if (keyword.isEmpty()) {
52 throw new FilterValidationException(EMPTY_NAME_MESSAGE);
55 keyword.replace(
"'",
"''");
58 return "LOWER(name) LIKE LOWER('%" + keyword +
"%')";
62 public void addActionListener(ActionListener l) {
63 getComponent().addActionListener(l);
67 public boolean isValid() {
68 return !this.getComponent().getSearchTextField().getText().isEmpty();