|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.lucidviews.util.image.BaseImageObserver
public abstract class BaseImageObserver
A base class for ImageObserver
s that observe (react to) a
specific image.
To prevent confusion between the imageUpdate
method of the
ImageObserver
interface and the observedImageUpdate
method of this class, the former has been made final
.
Sub classes should implement the observedImageUpdate
method in
exactly the same way they would implement the imageUpdate
method. When making the switch from implements ImageObserver
to
extends BaseImageObserver
you should only need to change the
name of your processing method from imageUpdate
to
observedImageUpdate
.
This base class also implements functionality to make image observers
compatible with JRE 1.5.0_06 (see keepObserverAlive
).
keepObserverAlive()
,
ImageObserver
,
Image
Nested Class Summary | |
---|---|
protected static class |
BaseImageObserver.RespawnTimerTask
A task that respawns an observer. |
Field Summary | |
---|---|
protected Image |
_image
The specific image being monitored by this observer. |
private boolean |
_needMoreData
Flag indicating if this observer is still waiting for more data to load into the image. |
private TimerTask |
_respawnTask
The current re-spawn task running on the respawn timer. |
private Timer |
_respawnTimer
A timer used to run a re-spawn task. |
protected static long |
FORCE_RESPAWN_DELAY
The amount of time, in mill-seconds, an observer can go un |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
BaseImageObserver()
Create an observer that is monitoring no specific image. |
|
BaseImageObserver(Image image)
Create an observer that is monitoring the specified image. |
Method Summary | |
---|---|
private void |
cancelRespawn()
Cancel the respawn task, if such a task is active. |
boolean |
imageUpdate(Image img,
int infoflags,
int x,
int y,
int width,
int height)
|
private void |
keepObserverAlive()
Ensure this observer is kept alive until the image it is monitoring has been loaded completely. |
protected abstract 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. |
private void |
respawn()
This method should be called when it is thought the observer has been 'lost' in the system. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final long FORCE_RESPAWN_DELAY
protected Image _image
null
if not monitoring a particular image.
private Timer _respawnTimer
keepObserverAlive()
private TimerTask _respawnTask
_respawnTimer
private boolean _needMoreData
Constructor Detail |
---|
public BaseImageObserver()
public BaseImageObserver(Image image)
image
- the image that is to be monitoredMethod Detail |
---|
protected abstract boolean observedImageUpdate(Image img, int infoflags, int x, int y, int width, int height)
infoflags
argument should be the bitwise inclusive
OR of the following flags: WIDTH
,
HEIGHT
, PROPERTIES
, SOMEBITS
,
FRAMEBITS
, ALLBITS
, ERROR
,
ABORT
.
img
- the image being observedinfoflags
- the bitwise inclusive OR of the following
flags: WIDTH
, HEIGHT
,
PROPERTIES
, SOMEBITS
,
FRAMEBITS
, ALLBITS
,
ERROR
, ABORT
x
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the height
false
if the infoflags indicate that the
image is completely loaded; true
otherwisepublic final boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height)
imageUpdate
in interface ImageObserver
private void keepObserverAlive()
imageUpdate
method whenever the observer is still waiting
for more data.
private void cancelRespawn()
private void respawn()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |