19 package org.sleuthkit.autopsy.discovery.ui;
21 import java.util.Arrays;
22 import java.util.HashSet;
23 import java.util.List;
25 import java.util.TreeSet;
26 import org.openide.nodes.Children;
27 import org.openide.nodes.Node;
28 import org.openide.nodes.Sheet;
29 import org.openide.util.NbBundle;
39 class DiscoveryThumbnailChildren
extends Children.Keys<AbstractFile> {
41 private final List<AbstractFile> files;
46 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
47 DiscoveryThumbnailChildren(List<AbstractFile> files) {
52 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
54 protected Node[] createNodes(AbstractFile t) {
55 return new Node[]{
new ThumbnailNode(t)};
58 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
60 protected void addNotify() {
62 Set<AbstractFile> thumbnails =
new TreeSet<>((AbstractFile file1, AbstractFile file2) -> {
63 int result = Long.compare(file1.getSize(), file2.getSize());
65 result = file1.getName().compareTo(file2.getName());
69 thumbnails.addAll(files);
76 static class ThumbnailNode
extends FileNode {
78 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
79 ThumbnailNode(AbstractFile file) {
83 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
85 protected Sheet createSheet() {
86 Sheet sheet = super.createSheet();
87 Set<String> keepProps =
new HashSet<>(Arrays.asList(
88 NbBundle.getMessage(AbstractAbstractFileNode.class,
"AbstractAbstractFileNode.nameColLbl"),
89 NbBundle.getMessage(AbstractAbstractFileNode.class,
"AbstractAbstractFileNode.createSheet.score.name"),
90 NbBundle.getMessage(AbstractAbstractFileNode.class,
"AbstractAbstractFileNode.createSheet.comment.name"),
91 NbBundle.getMessage(AbstractAbstractFileNode.class,
"AbstractAbstractFileNode.createSheet.count.name"),
92 NbBundle.getMessage(AbstractAbstractFileNode.class,
"AbstractAbstractFileNode.sizeColLbl"),
93 NbBundle.getMessage(AbstractAbstractFileNode.class,
"AbstractAbstractFileNode.mimeType"),
94 NbBundle.getMessage(AbstractAbstractFileNode.class,
"AbstractAbstractFileNode.knownColLbl")));
97 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
98 for (Node.Property<?> p : sheetSet.getProperties()) {
99 if (!keepProps.contains(p.getName())) {
100 sheetSet.remove(p.getName());