Autopsy  4.5.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
LocalDirectoryNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2017 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.LinkedHashMap;
22 import java.util.Map;
23 import org.openide.nodes.Sheet;
24 import org.openide.util.NbBundle;
25 import org.sleuthkit.datamodel.LocalDirectory;
26 
31 
32  public static String nameForLocalDir(LocalDirectory ld) {
33  return ld.getName();
34  }
35 
36  public LocalDirectoryNode(LocalDirectory ld) {
37  super(ld);
38 
39  this.setDisplayName(nameForLocalDir(ld));
40  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); //NON-NLS
41 
42  }
43 
44  @Override
45  @NbBundle.Messages({
46  "LocalDirectoryNode.createSheet.name.name=Name",
47  "LocalDirectoryNode.createSheet.name.displayName=Name",
48  "LocalDirectoryNode.createSheet.name.desc=no description",
49  "LocalDirectoryNode.createSheet.noDesc=no description"})
50  protected Sheet createSheet() {
51  Sheet s = super.createSheet();
52  Sheet.Set ss = s.get(Sheet.PROPERTIES);
53  if (ss == null) {
54  ss = Sheet.createPropertiesSet();
55  s.put(ss);
56  }
57 
58  ss.put(new NodeProperty<>(Bundle.LocalDirectoryNode_createSheet_name_name(),
59  Bundle.LocalDirectoryNode_createSheet_name_displayName(),
60  Bundle.LocalDirectoryNode_createSheet_name_desc(),
61  getName()));
62 
63  // At present, a LocalDirectory will never be a datasource - the top level of a logical
64  // file set is a VirtualDirectory
65  Map<String, Object> map = new LinkedHashMap<>();
66  fillPropertyMap(map, getContent());
67 
68  final String NO_DESCR = Bundle.LocalDirectoryNode_createSheet_noDesc();
69  for (Map.Entry<String, Object> entry : map.entrySet()) {
70  ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
71  }
72  addTagProperty(ss);
73 
74  return s;
75  }
76 
77  @Override
78  public <T> T accept(ContentNodeVisitor<T> v) {
79  return v.visit(this);
80  }
81 
82  @Override
83  public <T> T accept(DisplayableItemNodeVisitor<T> v) {
84  return v.visit(this);
85  }
86 }
static void fillPropertyMap(Map< String, Object > map, AbstractFile content)

Copyright © 2012-2016 Basis Technology. Generated on: Tue Feb 20 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.