Autopsy  3.1
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;
30 
35 public class ImageNode extends AbstractContentNode<Image> {
36 
44  static String nameForImage(Image i) {
45  return i.getName();
46  }
47 
51  public ImageNode(Image img) {
52  super(img);
53 
54  // set name, display name, and icon
55  String imgName = nameForImage(img);
56  this.setDisplayName(imgName);
57  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/hard-drive-icon.jpg"); //NON-NLS
58  }
59 
66  @Override
67  public Action[] getActions(boolean context) {
68  List<Action> actionsList = new ArrayList<Action>();
69 
70  actionsList.add(new NewWindowViewAction(
71  NbBundle.getMessage(this.getClass(), "ImageNode.getActions.viewInNewWin.text"), this));
72  actionsList.add(new FileSearchAction(
73  NbBundle.getMessage(this.getClass(), "ImageNode.getActions.openFileSearchByAttr.text")));
74  actionsList.addAll(ExplorerNodeActionVisitor.getActions(content));
75 
76  return actionsList.toArray(new Action[0]);
77  }
78 
79  @Override
80  protected Sheet createSheet() {
81  Sheet s = super.createSheet();
82  Sheet.Set ss = s.get(Sheet.PROPERTIES);
83  if (ss == null) {
84  ss = Sheet.createPropertiesSet();
85  s.put(ss);
86  }
87 
88  ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.name"),
89  NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.displayName"),
90  NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.desc"),
91  getDisplayName()));
92 
93  return s;
94  }
95 
96  @Override
97  public <T> T accept(ContentNodeVisitor<T> v) {
98  return v.visit(this);
99  }
100 
101  @Override
102  public boolean isLeafTypeNode() {
103  return false;
104  }
105 
106  @Override
107  public <T> T accept(DisplayableItemNodeVisitor<T> v) {
108  return v.visit(this);
109  }
110 }
Action[] getActions(boolean context)
Definition: ImageNode.java:67

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.