wicket.markup.html.image
Class Image

java.lang.Object
  extended by wicket.Component
      extended by wicket.markup.html.WebComponent
          extended by wicket.markup.html.image.Image
All Implemented Interfaces:
java.io.Serializable, IRequestListener, IResourceListener
Direct Known Subclasses:
NonCachingImage

public class Image
extends WebComponent
implements IResourceListener

An Image component displays a localizable image resource.

For details of how Images load, generate and manage images, see LocalizedImageResource.

Author:
Jonathan Locke
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.Component
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER
 
Fields inherited from interface wicket.IResourceListener
INTERFACE
 
Constructor Summary
Image(java.lang.String id)
          This constructor can be used if you have a img tag that has a src that points to a PackageResource (which will be created and bind to the shared resources) Or if you have a value attribute in your tag for which the image factory can make an image.
Image(java.lang.String id, IModel model)
           
Image(java.lang.String id, Resource imageResource)
          Constructs an image directly from an image resource.
Image(java.lang.String id, ResourceReference resourceReference)
          Constructs an image from an image resourcereference.
Image(java.lang.String id, ResourceReference resourceReference, ValueMap resourceParameters)
          Constructs an image from an image resourcereference.
Image(java.lang.String id, java.lang.String string)
           
 
Method Summary
protected  Resource getImageResource()
           
protected  ResourceReference getImageResourceReference()
           
protected  IModel initModel()
          Called when a null model is about to be retrieved in order to allow a subclass to provide an initial model.
protected  void onComponentTag(ComponentTag tag)
          Processes the component tag.
protected  void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
          Processes the body.
 void onResourceRequested()
          Called when a resource is requested.
 void setImageResource(Resource imageResource)
           
 void setImageResourceReference(ResourceReference resourceReference)
           
 void setImageResourceReference(ResourceReference resourceReference, ValueMap parameters)
           
 
Methods inherited from class wicket.markup.html.WebComponent
onRender
 
Methods inherited from class wicket.Component
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, internalAttach, internalDetach, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isEnabled, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onDetach, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, renderHead, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkupStream, setMetaData, setModel, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, toString, toString, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Image

public Image(java.lang.String id)
This constructor can be used if you have a img tag that has a src that points to a PackageResource (which will be created and bind to the shared resources) Or if you have a value attribute in your tag for which the image factory can make an image.

See Also:
Component.Component(String)

Image

public Image(java.lang.String id,
             ResourceReference resourceReference)
Constructs an image from an image resourcereference. That resource reference will bind its resource to the current SharedResources. If you are using non sticky session clustering and the resource reference is pointing to a Resource that isn't guaranteed to be on every server, for example a dynamic image or resources that aren't added with a IInitializer at application startup. Then if only that resource is requested from another server, without the rendering of the page, the image won't be there and will result in a broken link.

Parameters:
id - See Component
resourceReference - The shared image resource

Image

public Image(java.lang.String id,
             ResourceReference resourceReference,
             ValueMap resourceParameters)
Constructs an image from an image resourcereference. That resource reference will bind its resource to the current SharedResources. If you are using non sticky session clustering and the resource reference is pointing to a Resource that isn't guaranteed to be on every server, for example a dynamic image or resources that aren't added with a IInitializer at application startup. Then if only that resource is requested from another server, without the rendering of the page, the image won't be there and will result in a broken link.

Parameters:
id - See Component
resourceReference - The shared image resource
resourceParameters - The resource parameters

Image

public Image(java.lang.String id,
             Resource imageResource)
Constructs an image directly from an image resource. This one doesn't have the 'non sticky session clustering' problem that the ResourceReference constructor has. But this will result in a non 'stable' url and the url will have request parameters.

Parameters:
id - See Component
imageResource - The image resource

Image

public Image(java.lang.String id,
             IModel model)
See Also:
Component.Component(String, IModel)

Image

public Image(java.lang.String id,
             java.lang.String string)
Parameters:
id - See Component
string - Name of image
See Also:
Component.Component(String, IModel)
Method Detail

onResourceRequested

public void onResourceRequested()
Description copied from interface: IResourceListener
Called when a resource is requested.

Specified by:
onResourceRequested in interface IResourceListener
See Also:
IResourceListener.onResourceRequested()

setImageResource

public void setImageResource(Resource imageResource)
Parameters:
imageResource - The new ImageResource to set.

setImageResourceReference

public void setImageResourceReference(ResourceReference resourceReference)
Parameters:
resourceReference - The shared ImageResource to set.

setImageResourceReference

public void setImageResourceReference(ResourceReference resourceReference,
                                      ValueMap parameters)
Parameters:
resourceReference - The shared ImageResource to set.
parameters - Set the resource parameters for the resource.

getImageResource

protected Resource getImageResource()
Returns:
Resource returned from subclass

getImageResourceReference

protected ResourceReference getImageResourceReference()
Returns:
ResourceReference returned from subclass

initModel

protected IModel initModel()
Description copied from class: Component
Called when a null model is about to be retrieved in order to allow a subclass to provide an initial model. This gives FormComponent, for example, an opportunity to instantiate a model on the fly using the containing Form's model.

Overrides:
initModel in class Component
Returns:
The model
See Also:
Component.initModel()

onComponentTag

protected void onComponentTag(ComponentTag tag)
Description copied from class: Component
Processes the component tag.

Overrides:
onComponentTag in class Component
Parameters:
tag - Tag to modify
See Also:
Component.onComponentTag(ComponentTag)

onComponentTagBody

protected void onComponentTagBody(MarkupStream markupStream,
                                  ComponentTag openTag)
Description copied from class: Component
Processes the body.

Overrides:
onComponentTagBody in class Component
Parameters:
markupStream - The markup stream
openTag - The open tag for the body
See Also:
Component.onComponentTagBody(MarkupStream, ComponentTag)


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