net.refractions.udig.ui
Class DecoratorOverlayIcon

java.lang.Object
  extended by CompositeImageDescriptor
      extended by net.refractions.udig.ui.DecoratorOverlayIcon

public class DecoratorOverlayIcon
extends CompositeImageDescriptor

An DecoratorOverlayIcon consists of a main icon and several adornments.

Eclipse has many implementations of this class - all of them are internal. This one is based on org.eclipse.ui.internal.decorators.DecoratorOverlayIcon and has the advantage of having an equals and hashcode impemenation. This allows the use of the resulting ImageDescriptors to be cached using weak references.

Overlays are of course 7x8 icons with a white keyline around them.

Example use:


 new DecoratorOverlayIcon(base,
                 new ImageDescriptor[][]={
                     null,     // TOP_LEFT     unsure if we will use this
                     modified, // TOP_RIGHT    indicate content modified (w/ *) 
                     status,   // BOTTOM_LEFT  called the auxiliary overlay warn, error, success
                     cached,   // BOTTOM_RIGHT not yet defined, recommened cache status...  
                     null,     // UNDERLAY     not sure if we will use this
                 }
 );
 


Field Summary
static int BOTTOM_LEFT
           
static int BOTTOM_RIGHT
           
static int TOP_LEFT
           
static int TOP_RIGHT
           
static int UNDERLAY
           
 
Constructor Summary
DecoratorOverlayIcon(Image baseImage, ImageDescriptor[] overlaysArray)
          OverlayIcon constructor defaults to size of base image.
DecoratorOverlayIcon(Image baseImage, ImageDescriptor[] overlaysArray, Point sizeValue)
          OverlayIcon constructor allowing explicit size.
 
Method Summary
protected  void drawCompositeImage(int width, int height)
           
protected  void drawOverlays(ImageDescriptor[] overlaysArray)
          Draw the overlays for the reciever.
 boolean equals(java.lang.Object o)
          Note this can only be equal to another DecoratorOverlayIcon.
protected  Point getSize()
           
 int hashCode()
          Hascode for a base with no overlays will be the same as for a base.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOP_LEFT

public static final int TOP_LEFT
See Also:
Constant Field Values

TOP_RIGHT

public static final int TOP_RIGHT
See Also:
Constant Field Values

BOTTOM_LEFT

public static final int BOTTOM_LEFT
See Also:
Constant Field Values

BOTTOM_RIGHT

public static final int BOTTOM_RIGHT
See Also:
Constant Field Values

UNDERLAY

public static final int UNDERLAY
See Also:
Constant Field Values
Constructor Detail

DecoratorOverlayIcon

public DecoratorOverlayIcon(Image baseImage,
                            ImageDescriptor[] overlaysArray)
OverlayIcon constructor defaults to size of base image.

Overlays are of course 7x8 icons with a white keyline around them.

Example use:


 new DecoratorOverlayIcon(base,
                 new ImageDescriptor[][]={
                     null,     // TOP_LEFT     unsure if we will use this
                     modified, // TOP_RIGHT    indicate content modified (w/ *) 
                     status,   // BOTTOM_LEFT  called the auxiliary overlay warn, error, success
                     cached,   // BOTTOM_RIGHT not yet defined, recommened cache status...  
                     null,     // UNDERLAY     not sure if we will use this
                 }
 );
 

Parameters:
base - the base image
overlays - the overlay images

DecoratorOverlayIcon

public DecoratorOverlayIcon(Image baseImage,
                            ImageDescriptor[] overlaysArray,
                            Point sizeValue)
OverlayIcon constructor allowing explicit size.

Overlays are of course 7x8 icons with a white keyline around them.

Example use:


 new DecoratorOverlayIcon(base,
                 new ImageDescriptor[][]={
                     null,     // TOP_LEFT     unsure if we will use this
                     modified, // TOP_RIGHT    indicate content modified (w/ *) 
                     status,   // BOTTOM_LEFT  called the auxiliary overlay warn, error, success
                     cached,   // BOTTOM_RIGHT not yet defined, recommened cache status...  
                     null,     // UNDERLAY     not sure if we will use this
                 },
                 new Point(22,16)
 );
 

Parameters:
base - the base image
overlays - the overlay images
size - the size, 22x16 if null
Method Detail

drawOverlays

protected void drawOverlays(ImageDescriptor[] overlaysArray)
Draw the overlays for the reciever.


equals

public boolean equals(java.lang.Object o)
Note this can only be equal to another DecoratorOverlayIcon.


hashCode

public int hashCode()
Hascode for a base with no overlays will be the same as for a base.


drawCompositeImage

protected void drawCompositeImage(int width,
                                  int height)

getSize

protected Point getSize()