Hi,
What do you think of the following? Will you consider adding it to core?
/**
* A DynamicImageResource for images streamed from an expensive source
* (such as a database connection or socket). When a
StreamedImageResource
* is serialized, the image state is transient, which means it will
disappear
* when the resource is sent over the wire and then will be recreated
when
* required.
*
* Use this class when the image's dimensions are not known in
advance and
* re-rendering is an expensive operation.
*
* @author Gili Tzabari
*/
public abstract class StreamedImageResource extends DynamicImageResource
{
/**
* Create a new StreamedImageResource.
*/
public StreamedImageResource()
{}
/**
* Cached image data.
*/
private transient byte[] imageData;
/**
* [EMAIL PROTECTED]
*/
protected byte[] getImageData()
{
if (imageData==null)
imageData = render();
return imageData;
}
/**
* [EMAIL PROTECTED]
*/
public void invalidate()
{
super.invalidate();
imageData = null;
}
/**
* Renders this image.
*/
protected abstract byte[] render();
}
Gili
--
http://www.desktopbeautifier.com/
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop