Autopsy  4.18.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
RecentFilesFilterNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2014 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.datamodel;
20 
21 import java.util.Calendar;
22 import java.util.Locale;
23 import org.openide.util.NbBundle;
25 import org.openide.nodes.Children;
26 import org.openide.nodes.Sheet;
27 import org.openide.util.lookup.Lookups;
29 import org.sleuthkit.datamodel.SleuthkitCase;
30 
35 
36  SleuthkitCase skCase;
37  RecentFilesFilter filter;
38  private final static Logger logger = Logger.getLogger(RecentFilesFilterNode.class.getName());
39 
40  RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, Calendar lastDay) {
41  super(Children.create(new RecentFilesFilterChildren(filter, skCase, lastDay), true), Lookups.singleton(filter.getDisplayName()));
42  super.setName(filter.getName());
43  this.skCase = skCase;
44  this.filter = filter;
45  Calendar prevDay = (Calendar) lastDay.clone();
46  prevDay.add(Calendar.DATE, -filter.getDurationDays());
47  String tooltip = prevDay.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH) + " "
48  + prevDay.get(Calendar.DATE) + ", "
49  + prevDay.get(Calendar.YEAR);
50  this.setShortDescription(tooltip);
51  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png"); //NON-NLS
52 
53  //get count of children without preloading all children nodes
54  final long count = new RecentFilesFilterChildren(filter, skCase, lastDay).calculateItems();
55  super.setDisplayName(filter.getDisplayName() + " (" + count + ")");
56  }
57 
58  @Override
59  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
60  return visitor.visit(this);
61  }
62 
63  @Override
64  protected Sheet createSheet() {
65  Sheet sheet = super.createSheet();
66  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
67  if (sheetSet == null) {
68  sheetSet = Sheet.createPropertiesSet();
69  sheet.put(sheetSet);
70  }
71 
72  sheetSet.put(new NodeProperty<>(
73  NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.name"),
74  NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.displayName"),
75  NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.desc"),
76  filter.getDisplayName()));
77 
78  return sheet;
79  }
80 
81  @Override
82  public boolean isLeafTypeNode() {
83  return true;
84  }
85 
86  @Override
87  public String getItemType() {
88  if (filter == null) {
89  return getClass().getName();
90  } else {
91  return getClass().getName() + filter.getName();
92  }
93  }
94 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2021 Basis Technology. Generated on: Thu Jul 8 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.