org.apache.wicket.markup.html.form
Class ImageButton

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.form.LabeledWebMarkupContainer
                  extended by org.apache.wicket.markup.html.form.FormComponent<java.lang.String>
                      extended by org.apache.wicket.markup.html.form.Button
                          extended by org.apache.wicket.markup.html.form.ImageButton
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<Component>, IEventSink, IEventSource, IClusterable, IConverterLocator, IRequestListener, IResourceListener, IFormModelUpdateListener, IFormSubmitter, IFormSubmittingComponent, IFormVisitorParticipant, ILabelProvider<java.lang.String>, IHeaderContributor, IRequestableComponent, IHierarchical<Component>

public class ImageButton
extends Button
implements IResourceListener

<input type="image"> component - like Button only with an image.

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

Author:
Jonathan Locke
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.wicket.markup.html.form.FormComponent
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, VALUE_SEPARATOR
 
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
ImageButton(java.lang.String id, IModel<java.lang.String> model)
           
ImageButton(java.lang.String id, IResource imageResource)
          Constructs an image directly from an image resource.
ImageButton(java.lang.String id, ResourceReference resourceReference)
          Constructs an image button from an image ResourceReference.
ImageButton(java.lang.String id, ResourceReference resourceReference, PageParameters resourceParameters)
          Constructs an image button from an image ResourceReference.
ImageButton(java.lang.String id, java.lang.String string)
           
 
Method Summary
protected  IResource getImageResource()
           
protected  ResourceReference getImageResourceReference()
           
protected  boolean getStatelessHint()
          Returns whether the component can be stateless.
protected  void onComponentTag(ComponentTag tag)
          Processes the component tag.
 void onResourceRequested()
          Called when a resource is requested.
 ImageButton setDefaultModel(IModel<?> model)
          Sets the given model.
 void setImageResource(IResource imageResource)
           
 void setImageResourceReference(ResourceReference resourceReference)
           
 void setImageResourceReference(ResourceReference resourceReference, PageParameters parameters)
           
 
Methods inherited from class org.apache.wicket.markup.html.form.Button
getDefaultFormProcessing, getOnClickScript, initModel, onError, onSubmit, setDefaultFormProcessing, updateModel
 
Methods inherited from class org.apache.wicket.markup.html.form.FormComponent
add, add, checkRequired, clearInput, convertInput, convertValue, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getForm, getInput, getInputAsArray, getInputName, getModel, getModelObject, getModelValue, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, onDetach, onDisabled, onInvalid, onValid, processChildren, processInput, remove, setConvertedInput, setLabel, setModel, setModelObject, setModelValue, setRequired, setType, shouldTrimInput, trim, updateCollectionModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrder
 
Methods inherited from class org.apache.wicket.markup.html.form.LabeledWebMarkupContainer
getLabel, setLabelInternal
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onConfigure, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.wicket.markup.html.form.IFormSubmittingComponent
getInputName
 
Methods inherited from interface org.apache.wicket.markup.html.form.IFormSubmitter
getForm
 

Constructor Detail

ImageButton

public ImageButton(java.lang.String id,
                   ResourceReference resourceReference)
Constructs an image button 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

ImageButton

public ImageButton(java.lang.String id,
                   ResourceReference resourceReference,
                   PageParameters resourceParameters)
Constructs an image button 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

ImageButton

public ImageButton(java.lang.String id,
                   IResource 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

ImageButton

public ImageButton(java.lang.String id,
                   IModel<java.lang.String> model)
Parameters:
id -
model -
See Also:
Component.Component(String, IModel)

ImageButton

public ImageButton(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(IResource 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,
                                      PageParameters parameters)
Parameters:
resourceReference - The shared ImageResource to set.
parameters - Set the resource parameters for the resource.

setDefaultModel

public ImageButton setDefaultModel(IModel<?> model)
Description copied from class: Component
Sets the given model.

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.

Overrides:
setDefaultModel in class MarkupContainer
Parameters:
model - The model
Returns:
This
See Also:
Component.setDefaultModel(org.apache.wicket.model.IModel)

getImageResource

protected IResource getImageResource()
Returns:
Resource returned from subclass

getImageResourceReference

protected ResourceReference getImageResourceReference()
Returns:
ResourceReference returned from subclass

onComponentTag

protected final void onComponentTag(ComponentTag tag)
Processes the component tag.

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

getStatelessHint

protected boolean getStatelessHint()
Description copied from class: Component
Returns whether the component can be stateless. Also the component behaviors must be stateless, otherwise the component will be treat as stateful. In order for page to be stateless (and not to be stored in session), all components (and component behaviors) must be stateless.

Overrides:
getStatelessHint in class Component
Returns:
whether the component can be stateless
See Also:
Component.getStatelessHint()


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.