20 package org.sleuthkit.autopsy.commonfilesearch;
22 import java.util.HashMap;
23 import java.util.Iterator;
24 import java.util.List;
26 import org.openide.nodes.ChildFactory;
27 import org.openide.nodes.Children;
28 import org.openide.nodes.Node;
29 import org.openide.nodes.Sheet;
30 import org.openide.util.NbBundle;
57 "InstanceCountNode.displayName=Files with %s instances (%s)"
60 super(Children.create(
new CommonAttributeValueNodeFactory(attributeValues.
getMetadataList()),
true));
65 this.setDisplayName(String.format(Bundle.InstanceCountNode_displayName(), Integer.toString(instanceCount), attributeValues.getCommonAttributeListSize()));
66 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/fileset-icon-16.png");
74 int getInstanceCount() {
82 void createChildren() {
84 setChildren(Children.create(
new CommonAttributeValueNodeFactory(attributeValues.
getMetadataList()),
true));
92 CommonAttributeValueList getAttributeValues() {
97 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
98 return visitor.visit(
this);
108 return getClass().getName();
111 @NbBundle.Messages({
"InstanceCountNode.createSheet.noDescription= "})
114 Sheet sheet =
new Sheet();
115 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
116 if (sheetSet == null) {
117 sheetSet = Sheet.createPropertiesSet();
121 final String NO_DESCR = Bundle.InstanceCountNode_createSheet_noDescription();
128 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_instancesColLbl(), Bundle.CommonFilesSearchResultsViewerTable_instancesColLbl(), NO_DESCR, this.getInstanceCount()));
129 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), NO_DESCR,
""));
130 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_caseColLbl(), Bundle.CommonFilesSearchResultsViewerTable_caseColLbl(), NO_DESCR,
""));
131 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), NO_DESCR,
""));
141 static class CommonAttributeValueNodeFactory
extends ChildFactory<String> {
148 private final Map<String, CommonAttributeValue> metadata;
150 CommonAttributeValueNodeFactory(List<CommonAttributeValue> attributeValues) {
151 this.metadata =
new HashMap<>();
153 Iterator<CommonAttributeValue> iterator = attributeValues.iterator();
154 while (iterator.hasNext()) {
156 this.metadata.put(attributeValue.
getValue(), attributeValue);
161 protected boolean createKeys(List<String> list) {
163 list.addAll(this.metadata.keySet());
168 protected Node createNodeForKey(String attributeValue) {
169 CommonAttributeValue md5Metadata = this.metadata.get(attributeValue);
170 return new CommonAttributeValueNode(md5Metadata);
List< CommonAttributeValue > getMetadataList()
InstanceCountNode(int instanceCount, CommonAttributeValueList attributeValues)
synchronized static Logger getLogger(String name)
static final Logger logger
static boolean hideCentralRepoCommentsAndOccurrences()
final CommonAttributeValueList attributeValues
void displayDelayedMetadata()