Interface ProjectIconAnnotator
public interface ProjectIconAnnotator
Permits third parties to alter a project's icon.
You can use it for example to add a badge to the project's icon.
Implementations should be registered in global lookup. Example:
@ServiceProvider(service=ProjectIconAnnotator.class) public class SampleProjectIconAnnotator implements ProjectIconAnnotator { private final ChangeSupport pcs = new ChangeSupport(this); private boolean enabled; public @Override Image annotateIcon(Project p, Image orig, boolean openedNode) { return enabled ? ImageUtilities.mergeImages(ImageUtilities.addToolTipToImage(orig, "Annotated!"), ImageUtilities.loadImage(".../badge.png"), 16, 0) : original; } public @Override void addChangeListener(ChangeListener listener) { pcs.addChangeListener(listener); } public @Override void removeChangeListener(ChangeListener listener) { pcs.removeChangeListener(listener); } void setEnabled(boolean enabled) { this.enabled = enabled; pcs.fireChange(); } }
- Since:
- 1.33
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(ChangeListener listener) Adds a listener to changes in badging.annotateIcon
(Project p, Image original, boolean openedNode) Makes any changes to a project's icon.void
removeChangeListener
(ChangeListener listener) Removes a listener to changes in badging.
-
Method Details
-
annotateIcon
Makes any changes to a project's icon. Returnoriginal
if you do not intend to change the original icon at this time.- Parameters:
p
- project whose icon is to be annotatedoriginal
- the original icon (might have been processed by an earlier annotator)openedNode
- true for an expanded node; false for a collapsed node or icon used in another way- Returns:
- annotated project icon
-
addChangeListener
Adds a listener to changes in badging.- Parameters:
listener
- a listener to add
-
removeChangeListener
Removes a listener to changes in badging.- Parameters:
listener
- a listener to remove
-