org.springframework.richclient.image
Class AwtImageResource

java.lang.Object
  extended by org.springframework.core.io.AbstractResource
      extended by org.springframework.richclient.image.AwtImageResource
All Implemented Interfaces:
ImageObserver, InputStreamSource, Resource

public class AwtImageResource
extends AbstractResource
implements ImageObserver

A resource decorator that represents an underlying graphical AWT image, such as a GIF, JPEG, or PNG.

Author:
Keith Donald

Field Summary
static String RESOURCE_PREFIX
           
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AwtImageResource(Resource resource)
          Constructs a AwtImageResource for the following io.core.Resource.
 
Method Summary
 Resource createRelative(String relativePath)
           
 boolean equals(Object o)
           
 boolean exists()
           
 String getDescription()
           
 File getFile()
           
 String getFilename()
           
 Image getImage()
          Loads the image from the underlying core.io.Resource. This method does not cache.
 InputStream getInputStream()
           
 URL getURL()
           
 int hashCode()
           
 boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)
           
 boolean isOpen()
           
 
Methods inherited from class org.springframework.core.io.AbstractResource
getURI, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE_PREFIX

public static final String RESOURCE_PREFIX
See Also:
Constant Field Values
Constructor Detail

AwtImageResource

public AwtImageResource(Resource resource)
Constructs a AwtImageResource for the following io.core.Resource. This assumes the wrapped resource actually points to a underlying image.

Parameters:
resource - The wrapped resource.
Throws:
IllegalArgumentException, - if the resource is invalid.
Method Detail

getDescription

public String getDescription()
Specified by:
getDescription in interface Resource

createRelative

public Resource createRelative(String relativePath)
                        throws IOException
Specified by:
createRelative in interface Resource
Overrides:
createRelative in class AbstractResource
Throws:
IOException

exists

public boolean exists()
Specified by:
exists in interface Resource
Overrides:
exists in class AbstractResource

isOpen

public boolean isOpen()
Specified by:
isOpen in interface Resource
Overrides:
isOpen in class AbstractResource

getURL

public URL getURL()
           throws IOException
Specified by:
getURL in interface Resource
Overrides:
getURL in class AbstractResource
Throws:
IOException

getFile

public File getFile()
             throws IOException
Specified by:
getFile in interface Resource
Overrides:
getFile in class AbstractResource
Throws:
IOException

getFilename

public String getFilename()
                   throws IllegalStateException
Specified by:
getFilename in interface Resource
Overrides:
getFilename in class AbstractResource
Throws:
IllegalStateException

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface InputStreamSource
Throws:
IOException

getImage

public Image getImage()
               throws IOException
Loads the image from the underlying core.io.Resource. This method does not cache. Calling it successively will result in a new image being loaded each time.

Throws:
IOException - If an error occurred while reading from the resource input stream.

imageUpdate

public boolean imageUpdate(Image img,
                           int infoflags,
                           int x,
                           int y,
                           int w,
                           int h)
Specified by:
imageUpdate in interface ImageObserver

equals

public boolean equals(Object o)
Overrides:
equals in class AbstractResource

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractResource


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.