This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I found (2) SMALL issues with VisualizerNode: 1. VisualizerNode should be made a public class so users can better create custom renderers. For example, when using the ChoiceView, I need to be able to skip the drawing of the icon based on whether or not the Node.getImage() == null AND be able highlight the icon inconjunction with the text when the item is selected. Currently, NodeRenderer does not allow me to do this. Therefore, I created a custom renderer and used the Visualizer.findNode method. This works except that I can't make use of VisualizerNode's ability to cache icons. Therefore, I really need this class public. 2. VisualizerNode.getIcon() is slightly ineffecient because the following statement is always called: cachedIconType = newCacheType; when it should be part of the conditional statement (see: TODO comment below). Icon getIcon(boolean opened, boolean large) { int newCacheType = getCacheType(opened, large); if (cachedIconType != newCacheType) { int iconType = large ? BeanInfo.ICON_COLOR_32x32 : BeanInfo.ICON_COLOR_16x16; Image image = opened ? node.getOpenedIcon(iconType) : node.getIcon(iconType); // bugfix #28515, check if getIcon contract isn't broken if (image == null) { String method = opened ? "getOpenedIcon" : "getIcon"; // NOI18N LOG.warning( "Node \"" + node.getName() + "\" [" + node.getClass().getName() + "] cannot return null from " + method + "(). See Node." + method + " contract." ); // NOI18N icon = getDefaultIcon(); } else { icon = new ImageIcon(image); } } // TODO: Move the following statement inside the conditional statement above: cachedIconType = newCacheType; return icon; }
Please subclass NodeRenderer, override getListCellRendererComponent() call super and if necessary clean icon. That should do the trick, doesn't it?