Package org.wicketstuff.urlfragment
Class BookmarkableAjaxLink<T>
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- org.apache.wicket.markup.html.link.AbstractLink
-
- org.apache.wicket.ajax.markup.html.AjaxLink<T>
-
- org.wicketstuff.urlfragment.BookmarkableAjaxLink<T>
-
- Type Parameters:
T
- the type of Model object
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IAjaxLink
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IGenericComponent<T,AjaxLink<T>>
,IMetadataContext<Serializable,Component>
,IHeaderContributor
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
public abstract class BookmarkableAjaxLink<T> extends AjaxLink<T>
This is anAjaxLink
which will set an URL fragment parameter in the browser.You can provide a default parameter to the constructors so it will be set automatically during event handling. You can also set or remove parameters by yourself using
UrlFragment.set(String, Object)
orUrlFragment.removeParameter(String)
.- Author:
- Martin Knopf
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
defaultarameterName
protected String
defaultParamterValue
-
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 BookmarkableAjaxLink(String id)
Constructor.BookmarkableAjaxLink(String id, String parameterName, String parameterValue)
Constructor.BookmarkableAjaxLink(String id, IModel<T> model)
Constructor.BookmarkableAjaxLink(String id, IModel<T> model, String parameterName, String parameterValue)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
onBookmarkableClick(AjaxRequestTarget target)
Handles the click event.void
onClick(AjaxRequestTarget target)
void
renderHead(IHeaderResponse response)
protected UrlFragment
urlFragment()
Returns aUrlFragment
connected to the currentAjaxRequestTarget
.-
Methods inherited from class org.apache.wicket.ajax.markup.html.AjaxLink
getStatelessHint, newAjaxEventBehavior, onComponentTag, onInitialize, updateAjaxAttributes
-
Methods inherited from class org.apache.wicket.markup.html.link.AbstractLink
disableLink, getBody, onComponentTagBody, onDetach, setBody
-
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, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderAssociatedMarkup, renderNext, replace, setDefaultModel, 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, initModel, internalOnModelChanged, 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, 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.IGenericComponent
getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModel, setDefaultModelObject, setModel, setModelObject
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
BookmarkableAjaxLink
public BookmarkableAjaxLink(String id)
Constructor.- Parameters:
id
- id of the link being created
-
BookmarkableAjaxLink
public BookmarkableAjaxLink(String id, IModel<T> model)
Constructor.- Parameters:
id
- id of the link being createdmodel
-IModel
to be set as model object
-
BookmarkableAjaxLink
public BookmarkableAjaxLink(String id, String parameterName, String parameterValue)
Constructor. Sets given URL fragment parameter in the browser during the click event. Be aware that the given parameter name and value will not be set if they are empty.- Parameters:
id
- id of the link being createdparameterName
- the name of the default parameter for this linkparameterValue
- the value of the default parameter for this link
-
BookmarkableAjaxLink
public BookmarkableAjaxLink(String id, IModel<T> model, String parameterName, String parameterValue)
Constructor. Sets given default URL fragment parameter during the click event. Be aware that the given parameter name and value will not be set if either one is empty and that the parameter will be overwritten if it already exists.- Parameters:
id
- id of the link being createdmodel
-IModel
to be set as model objectparameterName
- the name of the default parameter for this linkparameterValue
- the value of the default parameter for this link
-
-
Method Detail
-
onClick
public void onClick(AjaxRequestTarget target)
-
onBookmarkableClick
public abstract void onBookmarkableClick(AjaxRequestTarget target)
Handles the click event. Your default URL fragment parameter was already set automatically if it wasn't empty. You can useurlFragment()
inside this method.- Parameters:
target
-AjaxRequestTarget
can be used to perform update
-
urlFragment
protected UrlFragment urlFragment()
Returns aUrlFragment
connected to the currentAjaxRequestTarget
. Use theUrlFragment
to update the URL fragment in the browser after the current AJAX event.- Returns:
- created
UrlFragment
for chaining
-
renderHead
public void renderHead(IHeaderResponse response)
- Specified by:
renderHead
in interfaceIHeaderContributor
- Overrides:
renderHead
in classComponent
-
-