Autopsy  4.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ImageNode.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.ArrayList;
22 import java.util.List;
23 import javax.swing.Action;
24 import org.openide.nodes.Sheet;
25 import org.openide.util.NbBundle;
29 import org.sleuthkit.datamodel.Image;
30 
35 public class ImageNode extends AbstractContentNode<Image> {
36 
45  static String nameForImage(Image i) {
46  return i.getName();
47  }
48 
52  public ImageNode(Image img) {
53  super(img);
54 
55  // set name, display name, and icon
56  String imgName = nameForImage(img);
57  this.setDisplayName(imgName);
58  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/hard-drive-icon.jpg"); //NON-NLS
59  }
60 
68  @Override
69  public Action[] getActions(boolean context) {
70  List<Action> actionsList = new ArrayList<Action>();
71 
72  actionsList.add(new NewWindowViewAction(
73  NbBundle.getMessage(this.getClass(), "ImageNode.getActions.viewInNewWin.text"), this));
74  actionsList.add(new FileSearchAction(
75  NbBundle.getMessage(this.getClass(), "ImageNode.getActions.openFileSearchByAttr.text")));
76  actionsList.addAll(ExplorerNodeActionVisitor.getActions(content));
77 
78  return actionsList.toArray(new Action[0]);
79  }
80 
81  @Override
82  protected Sheet createSheet() {
83  Sheet s = super.createSheet();
84  Sheet.Set ss = s.get(Sheet.PROPERTIES);
85  if (ss == null) {
86  ss = Sheet.createPropertiesSet();
87  s.put(ss);
88  }
89 
90  ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.name"),
91  NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.displayName"),
92  NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.desc"),
93  getDisplayName()));
94 
95  return s;
96  }
97 
98  @Override
99  public <T> T accept(ContentNodeVisitor<T> v) {
100  return v.visit(this);
101  }
102 
103  @Override
104  public boolean isLeafTypeNode() {
105  return false;
106  }
107 
108  @Override
109  public <T> T accept(DisplayableItemNodeVisitor<T> v) {
110  return v.visit(this);
111  }
112 
113  /*
114  * TODO (AUT-1849): Correct or remove peristent column reordering code
115  *
116  * Added to support this feature.
117  */
118 // @Override
119 // public String getItemType() {
120 // return "Image"; //NON-NLS
121 // }
122 }
Action[] getActions(boolean context)
Definition: ImageNode.java:69

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.