|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Component org.apache.wicket.markup.html.WebComponent org.apache.wicket.markup.html.image.Image
public class Image
An Image component displays a localizable image resource.
For details of how Images load, generate and manage images, see LocalizedImageResource
.
NonCachingImage
,
Serialized FormField Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
Fields inherited from interface org.apache.wicket.IResourceListener |
---|
INTERFACE |
Constructor Summary | |
---|---|
protected |
Image(String id)
This constructor can be used if you override getImageResourceReference() or
getImageResource() |
|
Image(String id,
IModel<?> model)
|
|
Image(String id,
IResource imageResource)
Constructs an image directly from an image resource. |
|
Image(String id,
ResourceReference resourceReference)
Constructs an image from an image resourcereference. |
|
Image(String id,
ResourceReference resourceReference,
PageParameters resourceParameters)
Constructs an image from an image resourcereference. |
|
Image(String id,
String string)
|
Method Summary | |
---|---|
protected void |
addAntiCacheParameter(ComponentTag tag)
Adds random noise to the url every request to prevent the browser from caching the image. |
boolean |
canCallListenerInterface(Method method)
Checks whether or not a listener method can be invoked on this component. |
protected IResource |
getImageResource()
|
protected ResourceReference |
getImageResourceReference()
|
protected boolean |
getStatelessHint()
Returns whether the component can be stateless. |
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. |
void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Processes the body. |
void |
onResourceRequested()
Called when a resource is requested. |
Component |
setDefaultModel(IModel<?> model)
Sets the given model. |
void |
setImageResource(IResource imageResource)
|
void |
setImageResourceReference(ResourceReference resourceReference)
|
void |
setImageResourceReference(ResourceReference resourceReference,
PageParameters parameters)
|
protected boolean |
shouldAddAntiCacheParameter()
Adding an image to AjaxRequestTarget most of the times mean that the image has
changes and must be re-rendered. |
Methods inherited from class org.apache.wicket.markup.html.WebComponent |
---|
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession, onRender |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Image(String id)
getImageResourceReference()
or
getImageResource()
id
- public Image(String id, ResourceReference resourceReference)
id
- See ComponentresourceReference
- The shared image resourcepublic Image(String id, ResourceReference resourceReference, PageParameters resourceParameters)
id
- See ComponentresourceReference
- The shared image resourceresourceParameters
- The resource parameterspublic Image(String id, IResource imageResource)
id
- See ComponentimageResource
- The image resourcepublic Image(String id, IModel<?> model)
Component.Component(String, IModel)
public Image(String id, String string)
id
- See Componentstring
- Name of imageComponent.Component(String, IModel)
Method Detail |
---|
public void onResourceRequested()
IResourceListener
onResourceRequested
in interface IResourceListener
IResourceListener.onResourceRequested()
public void setImageResource(IResource imageResource)
imageResource
- The new ImageResource to set.public void setImageResourceReference(ResourceReference resourceReference)
resourceReference
- The shared ImageResource to set.public void setImageResourceReference(ResourceReference resourceReference, PageParameters parameters)
resourceReference
- The shared ImageResource to set.parameters
- Set the resource parameters for the resource.public Component setDefaultModel(IModel<?> model)
Component
WARNING: DO NOT OVERRIDE THIS METHOD UNLESS YOU HAVE A VERY GOOD REASON FOR IT. OVERRIDING THIS MIGHT OPEN UP SECURITY LEAKS AND BREAK BACK-BUTTON SUPPORT.
setDefaultModel
in class Component
model
- The model
Component.setDefaultModel(org.apache.wicket.model.IModel)
protected IResource getImageResource()
protected ResourceReference getImageResourceReference()
protected IModel<?> initModel()
Component
By default this implementation looks components in the parent chain owning a
IComponentInheritedModel
to provide a model for this component via
IComponentInheritedModel.wrapOnInheritance(Component)
.
For example a FormComponent
has the opportunity to instantiate a model on the fly
using its id
and the containing Form
's model, if the form holds a
CompoundPropertyModel
.
initModel
in class Component
Component.initModel()
protected void onComponentTag(ComponentTag tag)
Component
onComponentTag
in class Component
tag
- Tag to modifyComponent.onComponentTag(ComponentTag)
protected boolean shouldAddAntiCacheParameter()
AjaxRequestTarget
most of the times mean that the image has
changes and must be re-rendered.
With this method the user may change this default behavior for some of her images.
true
to add the anti cache request parameter, false
- otherwiseprotected void addAntiCacheParameter(ComponentTag tag)
tag
- protected boolean getStatelessHint()
Component
getStatelessHint
in class Component
Component.getStatelessHint()
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
Component
onComponentTagBody
in class Component
markupStream
- The markup streamopenTag
- The open tag for the bodyComponent.onComponentTagBody(MarkupStream, ComponentTag)
public boolean canCallListenerInterface(Method method)
Component
WARNING: be careful when overriding this method because it may open security holes - such as allowing a user to click on a link that should be disabled.
Example usecase for overriding: Suppose you are building an component that displays images.
The component generates a callback to itself using IRequestListener
interface and
uses this callback to stream image data. If such a component is placed inside a disabled
webmarkupcontainer we still want to allow the invocation of the request listener callback
method so that image data can be streamed. Such a component would override this method and
return true if the listener method belongs to IRequestListener
.
canCallListenerInterface
in class Component
method
- listener method about to be invoked on this component. Could be null
- in
this case it means any method.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |