/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public String getHtmlDisplayName() { return getLookup().lookup(HtmlDisplayName) != null ? getDisplayName() : null; }
/******************************************************************************************************************* * * ******************************************************************************************************************/ private void installIconChangeListener() { final MutableIconProvider iconProvider = getLookup().lookup(MutableIconProvider.class); // FIXME: weak listener? Is the IconProvider allowed to change? if (iconProvider != null) { iconProvider.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange (final @Nonnull PropertyChangeEvent event) { fireIconChange(); } }); } } }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Nonnull private String getName (final @Nonnull String fallBackName) { final Node delegate = getOriginal(); // // If the delegate is not a NodePresentationModel, it is not using a Displayable for its icon, thus it is directly // providing its own icon. It could even have an Displayable 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 fallBackName; } final Displayable displayable = getLookup().lookup(Displayable); return (displayable != null) ? displayable.getDisplayName() : fallBackName; }
/******************************************************************************************************************* * * {@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; }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @CheckForNull public Action[] getActions (final boolean context) { final Node delegate = getOriginal(); // // If the delegate is not a NodePresentationModel, it is not using an ActionProvider, thus it is directly // providing its own actions. It could even have an ActionProvider 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 super.getActions(); } final ActionProvider actionProvider = getLookup().lookup(ActionProvider); return (actionProvider != null) ? actionProvider.getActions().toArray(new Action[0]) : super.getActions(); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public String getShortDescription() { final Node delegate = getOriginal(); // // If the delegate is not a GenericNode, it is not using a Displayable for its icon, thus it is directly // providing its own icon. It could even have an Displayable 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 super.getShortDescription(); } final Describable describable = getLookup().lookup(Describable); return (describable != null) ? describable.getDescription() : super.getShortDescription(); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @CheckForNull public Action getPreferredAction() { final Node delegate = getOriginal(); // // If the delegate is not a NodePresentationModel, it is not using an ActionProvider, thus it is directly // providing its own actions. It could even have an ActionProvider 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 super.getPreferredAction(); } try { final ActionProvider actionProvider = getLookup().lookup(ActionProvider); return (actionProvider != null) ? actionProvider.getPreferredAction() : super.getPreferredAction(); } catch (NotFoundException e) { return super.getPreferredAction(); } }