public interface ProjectIconAnnotator
@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(); } }
ProjectInformation.getIcon()
,
LogicalViewProvider.createLogicalView
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener listener)
Adds a listener to changes in badging.
|
Image |
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.
|
Image annotateIcon(Project p, Image original, boolean openedNode)
original
if you do not intend to change the original icon at this time.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 wayvoid addChangeListener(ChangeListener listener)
listener
- a listener to addvoid removeChangeListener(ChangeListener listener)
listener
- a listener to remove