net.lucidviews.util.image
Class DimensionImageObserver

java.lang.Object
  extended by net.lucidviews.util.image.BaseImageObserver
      extended by net.lucidviews.util.image.DimensionImageObserver
All Implemented Interfaces:
ImageObserver

public class DimensionImageObserver
extends BaseImageObserver

An ImageObserver that notifies a listener when the dimension information for a given image has loaded.

Since:
1.0
Version:
$Revision: 1.2 $
Author:
Stephen Battey

Nested Class Summary
static interface DimensionImageObserver.Listener
          This interface should be implemented by classes that want to be told the image's width and height when that information has become available.
 
Nested classes/interfaces inherited from class net.lucidviews.util.image.BaseImageObserver
BaseImageObserver.RespawnTimerTask
 
Field Summary
protected  DimensionImageObserver.Listener _listener
          The listener that wants to be told of the image's dimension.
 
Fields inherited from class net.lucidviews.util.image.BaseImageObserver
_image, FORCE_RESPAWN_DELAY
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DimensionImageObserver(DimensionImageObserver.Listener listener)
          Create an observer that informs the listener of the image's dimension.
DimensionImageObserver(DimensionImageObserver.Listener listener, Image image)
          Create an observer that informs the listener of the specified image's dimension.
 
Method Summary
 boolean observedImageUpdate(Image img, int infoflags, int x, int y, int width, int height)
          This method is called when information about the image that is being observed, and was previously requested using an asynchronous interface, becomes available.
 
Methods inherited from class net.lucidviews.util.image.BaseImageObserver
imageUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_listener

protected DimensionImageObserver.Listener _listener
The listener that wants to be told of the image's dimension.

Constructor Detail

DimensionImageObserver

public DimensionImageObserver(DimensionImageObserver.Listener listener)
Create an observer that informs the listener of the image's dimension.

Parameters:
listener - the listener waiting for the dimension height information

DimensionImageObserver

public DimensionImageObserver(DimensionImageObserver.Listener listener,
                              Image image)
Create an observer that informs the listener of the specified image's dimension.
The extra image parameter restricts this observer such that it only informs the listener when the specified image has loaded and not any other image it has been assigned to observe.

Parameters:
listener - the listener waiting for the dimension height information
image - the image that is to be monitored
Method Detail

observedImageUpdate

public boolean observedImageUpdate(Image img,
                                   int infoflags,
                                   int x,
                                   int y,
                                   int width,
                                   int height)
Description copied from class: BaseImageObserver
This method is called when information about the image that is being observed, and was previously requested using an asynchronous interface, becomes available.

This method should return true if further updates are needed or false if the required information has been acquired. The image which was being tracked is passed in using the img argument. Various constants are combined to form the infoflags argument which indicates what information about the image is now available. The interpretation of the x, y, width, and height arguments depends on the contents of the infoflags argument.

The infoflags argument should be the bitwise inclusive OR of the following flags: WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT.

Specified by:
observedImageUpdate in class BaseImageObserver
Parameters:
img - the image being observed
infoflags - the bitwise inclusive OR of the following flags: WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT
x - the x coordinate
y - the y coordinate
width - the width
height - the height
Returns:
false if the infoflags indicate that the image is completely loaded; true otherwise