Autopsy  3.1
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 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 
28 public class TextFilter extends AbstractFilter {
29 
30  public TextFilter() {
31  }
32 
33  public TextFilter(String text) {
34  this.text.set(text);
35  }
36 
37  private final SimpleStringProperty text = new SimpleStringProperty();
38 
39  synchronized public void setText(String text) {
40  this.text.set(text);
41  }
42 
43  @Override
44  public String getDisplayName() {
45  return NbBundle.getMessage(this.getClass(), "TextFilter.displayName.text");
46  }
47 
48  synchronized public String getText() {
49  return text.getValue();
50  }
51 
52  public Property<String> textProperty() {
53  return text;
54  }
55 
56  @Override
57  synchronized public TextFilter copyOf() {
58  TextFilter textFilter = new TextFilter(getText());
59  textFilter.setActive(isActive());
60  textFilter.setDisabled(isDisabled());
61  return textFilter;
62  }
63 
64  @Override
65  public String getHTMLReportString() {
66  return "text like \"" + StringUtils.defaultIfBlank(text.getValue(), "") + "\"" + getStringCheckBox(); // NON-NLS
67  }
68 
69  @Override
70  public boolean equals(Object obj) {
71  if (obj == null) {
72  return false;
73  }
74  if (getClass() != obj.getClass()) {
75  return false;
76  }
77  final TextFilter other = (TextFilter) obj;
78 
79  if (isActive() != other.isActive()) {
80  return false;
81  }
82  return Objects.equals(text.get(), other.text.get());
83  }
84 
85  @Override
86  public int hashCode() {
87  int hash = 5;
88  hash = 29 * hash + Objects.hashCode(this.text.get());
89  return hash;
90  }
91 
92 }

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.