19 package org.sleuthkit.autopsy.corecomponents;
21 import java.awt.Image;
22 import java.lang.ref.SoftReference;
23 import org.openide.nodes.FilterNode;
24 import org.openide.nodes.Node;
32 class ThumbnailViewNode
extends FilterNode {
34 private SoftReference<Image> iconCache = null;
35 private int iconSize = ImageUtils.ICON_SIZE_MEDIUM;
41 ThumbnailViewNode(Node arg,
int iconSize) {
42 super(arg, Children.LEAF);
43 this.iconSize = iconSize;
47 public String getDisplayName() {
48 if (super.getDisplayName().length() > 15) {
49 return super.getDisplayName().substring(0, 15).concat(
"...");
51 return super.getDisplayName();
56 public Image getIcon(
int type) {
59 if (iconCache != null) {
60 icon = iconCache.get();
64 Content content = this.getLookup().lookup(Content.class);
66 if (content != null) {
67 icon = ImageUtils.getIcon(content, iconSize);
69 icon = ImageUtils.getDefaultIcon();
72 iconCache =
new SoftReference<>(icon);
78 public void setIconSize(
int iconSize) {
79 this.iconSize = iconSize;