/******************************************************************************************************************* * * Creates a default icon, calling the delegate if provided, otherwise returning an empty icon. * * @param type the icon type * @param size the icon size * @return the icon * ******************************************************************************************************************/ @Nonnull private Icon getDefaultIcon (final @Nonnegative int size) { return (defaultIconProvider != null) ? defaultIconProvider.getIcon(size) : EMPTY_ICON; } }
/******************************************************************************************************************* * * Creates a default icon, calling the delegate if provided, otherwise returning an empty icon. * * @param type the icon type * @param size the icon size * @return the icon * ******************************************************************************************************************/ @Nonnull private Image getDefaultIcon (final @Nonnull Type type, final @Nonnegative int size) { return (defaultIconProvider != null) ? defaultIconProvider.getIcon(type, size) : EMPTY_ICON; } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Nonnull private Image findIcon (final int size) { try { return ImageUtilities.icon2Image(find(object, IconProvider).getIcon(size)); } catch (NotFoundException e) { return EMPTY_ICON; } }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Nonnull private Image getIcon (final int sizeType, final @Nonnull Image fallBackImage) { final Node delegate = getOriginal(); // // If the delegate is not a NodePresentationModel, it is not using an IconProvider for its icon, thus it is directly // providing its own icon. It could even have an IconProvider in its Lookup as it could be a FilterNode; for // this reason there's this explicit check. // if (!(delegate instanceof NodePresentationModel) && !(delegate instanceof GenericFilterNode)) { return fallBackImage; } final IconProvider iconProvider = getLookup().lookup(IconProvider.class); final int size = (sizeType == BeanInfo.ICON_COLOR_16x16) ? 16 : 32; return (iconProvider != null) ? ImageUtilities.icon2Image(iconProvider.getIcon(size)) : fallBackImage; }