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;
55 "InstanceCountNode.displayName=Files with %s instances (%s)"
58 super(Children.create(
new CommonAttributeValueNodeFactory(attributeValues.
getMetadataList()),
true));
63 this.setDisplayName(String.format(Bundle.InstanceCountNode_displayName(), Integer.toString(instanceCount), attributeValues.getCommonAttributeListSize()));
64 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/fileset-icon-16.png");
72 int getInstanceCount() {
83 setChildren(Children.create(
new CommonAttributeValueNodeFactory(attributeValues.
getMetadataList()),
true));
96 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
97 return visitor.visit(
this);
107 return getClass().getName();
110 @NbBundle.Messages({
"InstanceCountNode.createSheet.noDescription= "})
113 Sheet sheet =
new Sheet();
114 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
115 if (sheetSet == null) {
116 sheetSet = Sheet.createPropertiesSet();
120 final String NO_DESCR = Bundle.InstanceCountNode_createSheet_noDescription();
121 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_filesColLbl(), Bundle.CommonFilesSearchResultsViewerTable_filesColLbl(), NO_DESCR,
""));
122 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_instancesColLbl(), Bundle.CommonFilesSearchResultsViewerTable_instancesColLbl(), NO_DESCR, this.getInstanceCount()));
123 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), NO_DESCR,
""));
124 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_caseColLbl1(), Bundle.CommonFilesSearchResultsViewerTable_caseColLbl1(), NO_DESCR,
""));
125 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), NO_DESCR,
""));
126 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_hashsetHitsColLbl(), Bundle.CommonFilesSearchResultsViewerTable_hashsetHitsColLbl(), NO_DESCR,
""));
127 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_mimeTypeColLbl(), Bundle.CommonFilesSearchResultsViewerTable_mimeTypeColLbl(), NO_DESCR,
""));
128 sheetSet.put(
new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_tagsColLbl1(), Bundle.CommonFilesSearchResultsViewerTable_tagsColLbl1(), NO_DESCR,
""));
137 static class CommonAttributeValueNodeFactory
extends ChildFactory<String> {
144 private final Map<String, CommonAttributeValue> metadata;
146 CommonAttributeValueNodeFactory(List<CommonAttributeValue> attributeValues) {
147 this.metadata =
new HashMap<>();
149 Iterator<CommonAttributeValue> iterator = attributeValues.iterator();
150 while (iterator.hasNext()) {
152 this.metadata.put(attributeValue.
getValue(), attributeValue);
157 protected boolean createKeys(List<String> list) {
159 list.addAll(this.metadata.keySet());
164 protected Node createNodeForKey(String attributeValue) {
165 CommonAttributeValue md5Metadata = this.metadata.get(attributeValue);
166 return new CommonAttributeValueNode(md5Metadata);
List< CommonAttributeValue > getMetadataList()
InstanceCountNode(int instanceCount, CommonAttributeValueList attributeValues)
synchronized static Logger getLogger(String name)
static final Logger logger
final CommonAttributeValueList attributeValues
void displayDelayedMetadata()