Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
AbstractFsContentNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011 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;
26 import org.sleuthkit.datamodel.AbstractFile;
27 
33 public abstract class AbstractFsContentNode<T extends AbstractFile> extends AbstractAbstractFileNode<T> {
34 
35  private static Logger logger = Logger.getLogger(AbstractFsContentNode.class.getName());
36 
37  private boolean directoryBrowseMode;
38  public static final String HIDE_PARENT = "hide_parent"; //NON-NLS
39 
40  AbstractFsContentNode(T fsContent) {
41  this(fsContent, true);
42  }
43 
53  AbstractFsContentNode(T content, boolean directoryBrowseMode) {
54  super(content);
55  this.setDisplayName(AbstractAbstractFileNode.getContentDisplayName(content));
56  this.directoryBrowseMode = directoryBrowseMode;
57  }
58 
59  public boolean getDirectoryBrowseMode() {
60  return directoryBrowseMode;
61  }
62 
63  @Override
64  protected Sheet createSheet() {
65  Sheet s = super.createSheet();
66  Sheet.Set ss = s.get(Sheet.PROPERTIES);
67  if (ss == null) {
68  ss = Sheet.createPropertiesSet();
69  s.put(ss);
70  }
71 
72  Map<String, Object> map = new LinkedHashMap<String, Object>();
74 
75  AbstractFilePropertyType[] fsTypes = AbstractFilePropertyType.values();
76  final int FS_PROPS_LEN = fsTypes.length;
77  final String NO_DESCR = NbBundle.getMessage(this.getClass(), "AbstractFsContentNode.noDesc.text");
78  for (int i = 0; i < FS_PROPS_LEN; ++i) {
79  final AbstractFilePropertyType propType = AbstractFilePropertyType.values()[i];
80  final String propString = propType.toString();
81  ss.put(new NodeProperty<>(propString, propString, NO_DESCR, map.get(propString)));
82  }
83  if (directoryBrowseMode) {
84  ss.put(new NodeProperty<>(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT));
85  }
86 
87  return s;
88  }
89 
90 }
static void fillPropertyMap(Map< String, Object > map, AbstractFile content)
synchronized static Logger getLogger(String name)
Definition: Logger.java:161

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