19 package org.sleuthkit.autopsy.filesearch;
21 import java.awt.event.ActionListener;
23 import org.openide.util.NbBundle;
30 class NameSearchFilter
extends AbstractFileSearchFilter<NameSearchPanel> {
32 private static final String EMPTY_NAME_MESSAGE = NbBundle
33 .getMessage(NameSearchFilter.class,
"NameSearchFilter.emptyNameMsg.text");
35 public NameSearchFilter() {
36 this(
new NameSearchPanel());
39 public NameSearchFilter(NameSearchPanel component) {
44 public boolean isEnabled() {
45 return this.getComponent().getNameCheckBox().isSelected();
49 public String getPredicate() throws FilterValidationException {
50 String keyword = this.getComponent().getSearchTextField().getText();
52 if (keyword.isEmpty()) {
53 throw new FilterValidationException(EMPTY_NAME_MESSAGE);
56 keyword.replace(
"'",
"''");
59 return "LOWER(name) LIKE LOWER('%" + keyword +
"%')";
63 public void addActionListener(ActionListener l) {
64 getComponent().addActionListener(l);