Class ImageButton
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- org.apache.wicket.markup.html.form.LabeledWebMarkupContainer
-
- org.apache.wicket.markup.html.form.FormComponent<java.lang.String>
-
- org.apache.wicket.markup.html.form.Button
-
- org.apache.wicket.markup.html.form.ImageButton
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<Component>,IEventSink,IEventSource,IFeedbackContributor,IConverterLocator,IGenericComponent<java.lang.String,FormComponent<java.lang.String>>,IMetadataContext<java.io.Serializable,Component>,IRequestListener,IFormModelUpdateListener,IFormSubmitter,IFormSubmittingComponent,IFormVisitorParticipant,ILabelProvider<java.lang.String>,IHeaderContributor,IRequestableComponent,org.apache.wicket.util.IHierarchical<Component>,org.apache.wicket.util.io.IClusterable
public class ImageButton extends Button implements IRequestListener
<input type="image"> component - likeButtononly 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_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING
-
-
Constructor Summary
Constructors Constructor Description ImageButton(java.lang.String id, java.lang.String string)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 imageResourceReference.ImageButton(java.lang.String id, ResourceReference resourceReference, org.apache.wicket.request.mapper.parameter.PageParameters resourceParameters)Constructs an image button from an imageResourceReference.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IResourcegetImageResource()protected ResourceReferencegetImageResourceReference()protected booleangetStatelessHint()Returns whether the component can be stateless.protected voidonComponentTag(ComponentTag tag)Processes the component tag.voidonRequest()Called when a request is received.booleanrendersPage()Does invocation of this listener render the page.ImageButtonsetDefaultModel(IModel<?> model)Sets the given model.voidsetImageResource(IResource imageResource)voidsetImageResourceReference(ResourceReference resourceReference)voidsetImageResourceReference(ResourceReference resourceReference, org.apache.wicket.request.mapper.parameter.PageParameters parameters)-
Methods inherited from class org.apache.wicket.markup.html.form.Button
getDefaultFormProcessing, getForm, getOnClickScript, initModel, onAfterSubmit, onComponentTagBody, 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, getInput, getInputAsArray, getInputName, getModelValue, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, newValidationError, onDetach, onDisabled, onInvalid, onValid, processChildren, processInput, remove, reportRequiredError, setConvertedInput, setLabel, setModelValue, setRequired, setType, shouldTrimInput, trim, updateAutoLabels, updateCollectionModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrder
-
Methods inherited from class org.apache.wicket.markup.html.form.LabeledWebMarkupContainer
getLabel
-
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
-
Methods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
-
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, 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, 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, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, 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.IGenericComponent
getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModelObject, setModel, setModelObject
-
-
-
-
Constructor Detail
-
ImageButton
public ImageButton(java.lang.String id, ResourceReference resourceReference)Constructs an image button from an imageResourceReference. 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 aResourcethat isn't guaranteed to be on every server, for example a dynamic image or resources that aren't added with aIInitializerat 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 ComponentresourceReference- The shared image resource
-
ImageButton
public ImageButton(java.lang.String id, ResourceReference resourceReference, org.apache.wicket.request.mapper.parameter.PageParameters resourceParameters)Constructs an image button from an imageResourceReference. 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 aResourcethat isn't guaranteed to be on every server, for example a dynamic image or resources that aren't added with aIInitializerat 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 ComponentresourceReference- The shared image resourceresourceParameters- 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 theResourceReferenceconstructor has. But this will result in a non 'stable' url and the url will have request parameters.- Parameters:
id- See ComponentimageResource- The image resource
-
ImageButton
public ImageButton(java.lang.String id, IModel<java.lang.String> model)- Parameters:
id-model-- See Also:
Component(String, IModel)
-
ImageButton
public ImageButton(java.lang.String id, java.lang.String string)- Parameters:
id- See Componentstring- Name of image- See Also:
Component(String, IModel)
-
-
Method Detail
-
rendersPage
public boolean rendersPage()
Description copied from interface:IRequestListenerDoes invocation of this listener render the page.- Specified by:
rendersPagein interfaceIRequestListener- Returns:
- default
true, i.e. aRenderPageRequestHandleris schedules after invocation
-
onRequest
public void onRequest()
Description copied from interface:IRequestListenerCalled when a request is received.- Specified by:
onRequestin interfaceIRequestListener- See Also:
org.apache.wicket.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, org.apache.wicket.request.mapper.parameter.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:ComponentSets 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.
- Specified by:
setDefaultModelin interfaceIGenericComponent<java.lang.String,FormComponent<java.lang.String>>- Overrides:
setDefaultModelin classMarkupContainer- 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:
onComponentTagin classButton- Parameters:
tag- Tag to modify- See Also:
Component.onComponentTag(ComponentTag)
-
getStatelessHint
protected boolean getStatelessHint()
Description copied from class:ComponentReturns 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:
getStatelessHintin classComponent- Returns:
- whether the component can be stateless
- See Also:
Component.getStatelessHint()
-
-