Autopsy  4.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
TextFilter.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-15 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.timeline.filters;
20 
21 import java.util.Objects;
22 import javafx.beans.property.Property;
23 import javafx.beans.property.SimpleStringProperty;
24 import org.apache.commons.lang3.StringUtils;
25 import org.openide.util.NbBundle;
26 
30 public class TextFilter extends AbstractFilter {
31 
32  public TextFilter() {
33  }
34 
35  public TextFilter(String text) {
36  this.text.set(text);
37  }
38 
39  private final SimpleStringProperty text = new SimpleStringProperty();
40 
41  synchronized public void setText(String text) {
42  this.text.set(text);
43  }
44 
45  @Override
46  @NbBundle.Messages("TextFilter.displayName.text=Text Filter")
47  public String getDisplayName() {
48  return Bundle.TextFilter_displayName_text();
49  }
50 
51  synchronized public String getText() {
52  return text.getValue();
53  }
54 
55  public Property<String> textProperty() {
56  return text;
57  }
58 
59  @Override
60  synchronized public TextFilter copyOf() {
61  TextFilter textFilter = new TextFilter(getText());
62  textFilter.setSelected(isSelected());
63  textFilter.setDisabled(isDisabled());
64  return textFilter;
65  }
66 
67  @Override
68  public String getHTMLReportString() {
69  return "LOWER(text) LIKE LOWER(\'" + StringUtils.defaultIfBlank(text.getValue(), "") + "\')" + getStringCheckBox(); // NON-NLS
70  }
71 
72  @Override
73  public boolean equals(Object obj) {
74  if (obj == null) {
75  return false;
76  }
77  if (getClass() != obj.getClass()) {
78  return false;
79  }
80  final TextFilter other = (TextFilter) obj;
81 
82  if (isSelected() != other.isSelected()) {
83  return false;
84  }
85  return Objects.equals(text.get(), other.text.get());
86  }
87 
88  @Override
89  public int hashCode() {
90  int hash = 5;
91  hash = 29 * hash + Objects.hashCode(this.text.get());
92  return hash;
93  }
94 }
synchronized void setText(String text)
Definition: TextFilter.java:41

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