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 java.lang.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(java.lang.String key, org.eclipse.swt.graphics.Image image)
          Adds image to repository.
 void addImage(java.lang.String key, org.eclipse.swt.graphics.Image[] images)
           
 void addImageNoDipose(java.lang.String key, org.eclipse.swt.graphics.Image image)
           
 void addSkinProperties(SkinProperties skinProperties)
           
 void collectGarbage()
           
 void generate(IndentWriter writer)
           
 int getAnimationDelay(java.lang.String sKey)
           
 org.eclipse.swt.graphics.Image getImage(java.lang.String sKey)
           
protected  org.eclipse.swt.graphics.Image getImageFromMap(java.lang.String sKey)
           
 org.eclipse.swt.graphics.Image[] getImages(java.lang.String sKey)
           
protected  org.eclipse.swt.graphics.Image[] getImagesFromMap(java.lang.String sKey)
           
static ImageLoader getInstance()
           
static org.eclipse.swt.graphics.Image getNoImage()
           
 SkinProperties[] getSkinProperties()
           
 org.eclipse.swt.graphics.Image getUrlImage(java.lang.String url, ImageLoader.ImageDownloaderListener l)
           
 org.eclipse.swt.graphics.Image getUrlImage(java.lang.String url, org.eclipse.swt.graphics.Point maxSize, ImageLoader.ImageDownloaderListener l)
          Get an Image from an url.
 boolean imageAdded_NoSWT(java.lang.String name)
           
 boolean imageAdded(java.lang.String name)
           
 boolean imageExists(java.lang.String name)
           
static boolean isRealImage(org.eclipse.swt.graphics.Image image)
           
 long releaseImage(java.lang.String sKey)
           
 void setBackgroundImage(org.eclipse.swt.widgets.Control control, java.lang.String key)
           
 org.eclipse.swt.graphics.Image setButtonImage(org.eclipse.swt.widgets.Button btn, java.lang.String key)
           
 void setLabelImage(org.eclipse.swt.widgets.Label label, java.lang.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(java.lang.String sKey)

getImagesFromMap

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

getImages

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

getImage

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

releaseImage

public long releaseImage(java.lang.String sKey)

addImage

public void addImage(java.lang.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(java.lang.String key,
                     org.eclipse.swt.graphics.Image[] images)

addImageNoDipose

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

getNoImage

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

imageExists

public boolean imageExists(java.lang.String name)

imageAdded_NoSWT

public boolean imageAdded_NoSWT(java.lang.String name)

imageAdded

public boolean imageAdded(java.lang.String name)

isRealImage

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

getAnimationDelay

public int getAnimationDelay(java.lang.String sKey)

getUrlImage

public org.eclipse.swt.graphics.Image getUrlImage(java.lang.String url,
                                                  ImageLoader.ImageDownloaderListener l)

getUrlImage

public org.eclipse.swt.graphics.Image getUrlImage(java.lang.String url,
                                                  org.eclipse.swt.graphics.Point maxSize,
                                                  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,
                          java.lang.String key)
Parameters:
label -
key -
Since:
4.0.0.5

setButtonImage

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

setBackgroundImage

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

getSkinProperties

public SkinProperties[] getSkinProperties()