wicket.extensions.markup.html.image.resource
Class ThumbnailImageResource

java.lang.Object
  extended bywicket.Resource
      extended bywicket.markup.html.WebResource
          extended bywicket.markup.html.DynamicWebResource
              extended bywicket.markup.html.image.resource.DynamicImageResource
                  extended bywicket.extensions.markup.html.image.resource.ThumbnailImageResource
All Implemented Interfaces:
wicket.IRequestListener, wicket.IResourceListener, java.io.Serializable

public class ThumbnailImageResource
extends wicket.markup.html.image.resource.DynamicImageResource

Image resource that dynamically scales the given original resource to a thumbnail. It is scaled either using the given maxSize as width or height, depending on its shape. If both the width and height are less than maxSize, no scaling is performed.

Author:
Eelco Hillenius
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class wicket.markup.html.DynamicWebResource
wicket.markup.html.DynamicWebResource.ResourceState
 
Field Summary
 
Fields inherited from interface wicket.IResourceListener
INTERFACE
 
Constructor Summary
ThumbnailImageResource(wicket.markup.html.WebResource unscaledImageResource, int maxSize)
          Construct.
 
Method Summary
protected  byte[] getImageData()
           
protected  java.awt.image.BufferedImage getScaledImageInstance()
          get resized image instance.
 void invalidate()
           
 void setScaleHints(int scaleHints)
          Sets hint(s) for the scale operation.
 
Methods inherited from class wicket.markup.html.image.resource.DynamicImageResource
getFormat, getResourceState, setFormat, setLastModifiedTime, toImageData
 
Methods inherited from class wicket.markup.html.DynamicWebResource
getLocale, getResourceStream
 
Methods inherited from class wicket.markup.html.WebResource
configureResponse, setHeaders
 
Methods inherited from class wicket.Resource
getParameters, isCacheable, onResourceRequested, setCacheable, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThumbnailImageResource

public ThumbnailImageResource(wicket.markup.html.WebResource unscaledImageResource,
                              int maxSize)
Construct.

Parameters:
unscaledImageResource - the unscaled, original image resource. Must be not null
maxSize - maximum size (width or height) for resize operation
Method Detail

getImageData

protected byte[] getImageData()
Returns:
The image data for this dynamic image

getScaledImageInstance

protected final java.awt.image.BufferedImage getScaledImageInstance()
get resized image instance.

Returns:
BufferedImage

setScaleHints

public final void setScaleHints(int scaleHints)
Sets hint(s) for the scale operation.

Parameters:
scaleHints - hint(s) for the scale operation

invalidate

public void invalidate()
See Also:
Resource.invalidate()


Copyright © 2004-2008 Wicket developers. All Rights Reserved.