org.nakedobjects.runtime.imageloader.awt
Class TemplateImageLoaderAwt

java.lang.Object
  extended by org.nakedobjects.runtime.imageloader.awt.TemplateImageLoaderAwt
All Implemented Interfaces:
ApplicationScopedComponent, Component, TemplateImageLoader

public class TemplateImageLoaderAwt
extends java.lang.Object
implements TemplateImageLoader

This class loads up file based images as resources (part of the classpath) or from the file system. Images of type PNG, GIF and JPEG will be used. The default directory is images.


Field Summary
protected  java.awt.MediaTracker mt
           
 
Constructor Summary
TemplateImageLoaderAwt(NakedObjectConfiguration configuration)
           
 
Method Summary
 TemplateImage getTemplateImage(java.lang.String name)
          Returns an image template for the specified image (as specified by a path to a file or resource).
 void init()
           
protected  java.awt.Image loadAsResource(java.lang.String path)
          Get an Image object from the jar/zip file that this class was loaded from.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mt

protected final java.awt.MediaTracker mt
Constructor Detail

TemplateImageLoaderAwt

public TemplateImageLoaderAwt(NakedObjectConfiguration configuration)
Method Detail

init

public void init()
Specified by:
init in interface ApplicationScopedComponent

shutdown

public void shutdown()
Specified by:
shutdown in interface ApplicationScopedComponent

getTemplateImage

public TemplateImage getTemplateImage(java.lang.String name)
Returns an image template for the specified image (as specified by a path to a file or resource).

If the path has no extension (.gif, .png etc) then all valid extensions are searched for.

This method attempts to load the image from the jar/zip file this class was loaded from ie, your application, and then from the file system as a file if can't be found as a resource. If neither method works the default image is returned.

Specified by:
getTemplateImage in interface TemplateImageLoader
Returns:
returns a TemplateImage for the specified image file, or null if none found.

loadAsResource

protected java.awt.Image loadAsResource(java.lang.String path)
Get an Image object from the jar/zip file that this class was loaded from.



Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.