org.netbeans.modules.projectapi/1 1.36.1

org.netbeans.spi.project
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:
ProjectInformation.getIcon(), LogicalViewProvider.createLogicalView

Method Summary
 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.
 

Method Detail

annotateIcon

Image annotateIcon(Project p,
                   Image original,
                   boolean openedNode)
Makes any changes to a project's icon. Return original if you do not intend to change the original icon at this time.

Parameters:
p - project whose icon is to be annotated
original - 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

void addChangeListener(ChangeListener listener)
Adds a listener to changes in badging.

Parameters:
listener - a listener to add

removeChangeListener

void removeChangeListener(ChangeListener listener)
Removes a listener to changes in badging.

Parameters:
listener - a listener to remove

org.netbeans.modules.projectapi/1 1.36.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.