Class ImageButton
-
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IGenericComponent<String,FormComponent<String>>
,IMetadataContext<Serializable,Component>
,IRequestListener
,IFormModelUpdateListener
,IFormSubmitter
,IFormSubmittingComponent
,IFormVisitorParticipant
,ILabelProvider<String>
,IHeaderContributor
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
public class ImageButton extends Button implements IRequestListener
<input type="image"> component - likeButton
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_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING, RFLAG_CONTAINER_HAS_REMOVALS
-
-
Constructor Summary
Constructors Constructor Description ImageButton(String id, String string)
ImageButton(String id, IModel<String> model)
ImageButton(String id, IResource imageResource)
Constructs an image directly from an image resource.ImageButton(String id, ResourceReference resourceReference)
Constructs an image button from an imageResourceReference
.ImageButton(String id, ResourceReference resourceReference, PageParameters resourceParameters)
Constructs an image button from an imageResourceReference
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
onRequest()
Called when a request is received.boolean
rendersPage()
Does invocation of this listener render the page.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, getForm, getOnClickScript, initModel, onAfterSubmit, onComponentTagBody, onError, onSubmit, renderHead, 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, getParameterValues, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, newValidationError, onBeforeRender, onDetach, onDisabled, onInvalid, onValid, processChildren, processInput, remove, reportRequiredError, setConvertedInput, setLabel, setModelValue, setRequired, setType, shouldTrimInput, trim, updateAutoLabels, 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, 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, getMarkupTag, 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, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, 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
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ImageButton
public ImageButton(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 aResource
that isn't guaranteed to be on every server, for example a dynamic image or resources that aren't added with aIInitializer
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 ComponentresourceReference
- The shared image resource
-
ImageButton
public ImageButton(String id, ResourceReference resourceReference, 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 aResource
that isn't guaranteed to be on every server, for example a dynamic image or resources that aren't added with aIInitializer
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 ComponentresourceReference
- The shared image resourceresourceParameters
- The resource parameters
-
ImageButton
public ImageButton(String id, IResource imageResource)
Constructs an image directly from an image resource. This one doesn't have the 'non sticky session clustering' problem that theResourceReference
constructor 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(String id, IModel<String> model)
- Parameters:
id
-model
-- See Also:
Component(String, IModel)
-
ImageButton
public ImageButton(String id, String string)
- Parameters:
id
- See Componentstring
- Name of image- See Also:
Component(String, IModel)
-
-
Method Detail
-
rendersPage
public boolean rendersPage()
Description copied from interface:IRequestListener
Does invocation of this listener render the page.- Specified by:
rendersPage
in interfaceIRequestListener
- Returns:
- default
true
, i.e. aRenderPageRequestHandler
is schedules after invocation
-
onRequest
public void onRequest()
Description copied from interface:IRequestListener
Called when a request is received.- Specified by:
onRequest
in interfaceIRequestListener
-
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.
- Specified by:
setDefaultModel
in interfaceIGenericComponent<String,FormComponent<String>>
- Overrides:
setDefaultModel
in 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:
onComponentTag
in classButton
- 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 classComponent
- Returns:
- whether the component can be stateless
- See Also:
Component.getStatelessHint()
-
-