com.aelitis.azureus.ui.swt.imageloader
Class ImageLoader

java.lang.Object
  extended by com.aelitis.azureus.ui.swt.imageloader.ImageLoader
All Implemented Interfaces:
AEDiagnosticsEvidenceGenerator

public class ImageLoader
extends Object
implements AEDiagnosticsEvidenceGenerator

Loads images from a skinProperty object.

Will look for special suffixes (over, down, disabled) and try to load resources using base key and suffix. ie. loadImage("foo-over") when foo=image.png, will load image-over.png

Will also create own disabled images if base image found and no disabled image found. Disabled opacity can be set via imageloader.disabled-opacity key

Author:
TuxPaper

Nested Class Summary
static interface ImageLoader.ImageDownloaderListener
           
 
Field Summary
static org.eclipse.swt.graphics.Image noImage
           
 
Constructor Summary
ImageLoader(org.eclipse.swt.widgets.Display display, SkinProperties skinProperties)
           
 
Method Summary
 void addImage(String key, org.eclipse.swt.graphics.Image image)
          Adds image to repository.
 void addImage(String key, org.eclipse.swt.graphics.Image[] images)
           
 void addImageNoDipose(String key, org.eclipse.swt.graphics.Image image)
           
 void addSkinProperties(SkinProperties skinProperties)
           
 void collectGarbage()
           
 void generate(IndentWriter writer)
           
 int getAnimationDelay(String sKey)
           
 org.eclipse.swt.graphics.Image getImage(String sKey)
           
protected  org.eclipse.swt.graphics.Image getImageFromMap(String sKey)
           
 org.eclipse.swt.graphics.Image[] getImages(String sKey)
           
protected  org.eclipse.swt.graphics.Image[] getImagesFromMap(String sKey)
           
static ImageLoader getInstance()
           
static org.eclipse.swt.graphics.Image getNoImage()
           
 SkinProperties[] getSkinProperties()
           
 org.eclipse.swt.graphics.Image getUrlImage(String url, ImageLoader.ImageDownloaderListener l)
          Get an Image from an url.
 boolean imageAdded_NoSWT(String name)
           
 boolean imageAdded(String name)
           
 boolean imageExists(String name)
           
static boolean isRealImage(org.eclipse.swt.graphics.Image image)
           
 long releaseImage(String sKey)
           
 void setBackgroundImage(org.eclipse.swt.widgets.Control control, String key)
           
 org.eclipse.swt.graphics.Image setButtonImage(org.eclipse.swt.widgets.Button btn, String key)
           
 void setLabelImage(org.eclipse.swt.widgets.Label label, String key)
           
 void unLoadImages()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

noImage

public static org.eclipse.swt.graphics.Image noImage
Constructor Detail

ImageLoader

public ImageLoader(org.eclipse.swt.widgets.Display display,
                   SkinProperties skinProperties)
Method Detail

getInstance

public static ImageLoader getInstance()

unLoadImages

public void unLoadImages()

getImageFromMap

protected org.eclipse.swt.graphics.Image getImageFromMap(String sKey)

getImagesFromMap

protected org.eclipse.swt.graphics.Image[] getImagesFromMap(String sKey)

getImages

public org.eclipse.swt.graphics.Image[] getImages(String sKey)

getImage

public org.eclipse.swt.graphics.Image getImage(String sKey)

releaseImage

public long releaseImage(String sKey)

addImage

public void addImage(String key,
                     org.eclipse.swt.graphics.Image image)
Adds image to repository. refcount will be 1, or if key already exists, refcount will increase.

Parameters:
key -
image -
Since:
4.0.0.5

addImage

public void addImage(String key,
                     org.eclipse.swt.graphics.Image[] images)

addImageNoDipose

public void addImageNoDipose(String key,
                             org.eclipse.swt.graphics.Image image)

getNoImage

public static org.eclipse.swt.graphics.Image getNoImage()

imageExists

public boolean imageExists(String name)

imageAdded_NoSWT

public boolean imageAdded_NoSWT(String name)

imageAdded

public boolean imageAdded(String name)

isRealImage

public static boolean isRealImage(org.eclipse.swt.graphics.Image image)

getAnimationDelay

public int getAnimationDelay(String sKey)

getUrlImage

public org.eclipse.swt.graphics.Image getUrlImage(String url,
                                                  ImageLoader.ImageDownloaderListener l)
Get an Image from an url. URL will be the key, which you can use later to releaseImage(String)


generate

public void generate(IndentWriter writer)
Specified by:
generate in interface AEDiagnosticsEvidenceGenerator

addSkinProperties

public void addSkinProperties(SkinProperties skinProperties)

collectGarbage

public void collectGarbage()
Since:
4.0.0.5

setLabelImage

public void setLabelImage(org.eclipse.swt.widgets.Label label,
                          String key)
Parameters:
label -
key -
Since:
4.0.0.5

setButtonImage

public org.eclipse.swt.graphics.Image setButtonImage(org.eclipse.swt.widgets.Button btn,
                                                     String key)

setBackgroundImage

public void setBackgroundImage(org.eclipse.swt.widgets.Control control,
                               String key)

getSkinProperties

public SkinProperties[] getSkinProperties()