Autopsy  4.19.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
PoolNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019-2021 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;
26 import org.sleuthkit.datamodel.Pool;
27 import org.sleuthkit.datamodel.Tag;
28 
32 public class PoolNode extends AbstractContentNode<Pool> {
33 
42  static String nameForPool(Pool pool) {
43  return pool.getType().getName();
44  }
45 
50  public PoolNode(Pool pool) {
51  super(pool);
52 
53  // set name, display name, and icon
54  String poolName = nameForPool(pool);
55  this.setDisplayName(poolName);
56 
57  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/pool-icon.png"); //NON-NLS
58  }
59 
67  @Override
68  public Action[] getActions(boolean popup) {
69  List<Action> actionsList = new ArrayList<>();
70 
71  for (Action a : super.getActions(true)) {
72  actionsList.add(a);
73  }
74 
75  return actionsList.toArray(new Action[actionsList.size()]);
76 
77  }
78 
79  @NbBundle.Messages({
80  "PoolNode.createSheet.name.name=Name",
81  "PoolNode.createSheet.name.displayName=Name",
82  "PoolNode.createSheet.name.desc=no description",
83  "PoolNode.createSheet.type.name=Type",
84  "PoolNode.createSheet.type.displayName=Type",
85  "PoolNode.createSheet.type.desc=no description",
86  })
87  @Override
88  protected Sheet createSheet() {
89  Sheet sheet = super.createSheet();
90  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
91  if (sheetSet == null) {
92  sheetSet = Sheet.createPropertiesSet();
93  sheet.put(sheetSet);
94  }
95 
96  Pool pool = this.getContent();
97  sheetSet.put(new NodeProperty<>(Bundle.PoolNode_createSheet_name_name(),
98  Bundle.PoolNode_createSheet_name_displayName(),
99  Bundle.PoolNode_createSheet_name_desc(),
100  this.getDisplayName()));
101  sheetSet.put(new NodeProperty<>(Bundle.PoolNode_createSheet_type_name(),
102  Bundle.PoolNode_createSheet_type_displayName(),
103  Bundle.PoolNode_createSheet_type_desc(),
104  pool.getType().getName()));
105 
106  return sheet;
107  }
108 
109  @Override
110  public <T> T accept(ContentNodeVisitor<T> visitor) {
111  return visitor.visit(this);
112  }
113 
114  @Override
115  public boolean isLeafTypeNode() {
116  return false;
117  }
118 
119  @Override
120  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
121  return visitor.visit(this);
122  }
123 
124  @Override
125  public String getItemType() {
126  return getClass().getName();
127  }
128 
136  @Override
137  protected List<Tag> getAllTagsFromDatabase() {
138  return new ArrayList<>();
139  }
140 }
Action[] getActions(boolean popup)
Definition: PoolNode.java:68

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