org.apache.wicket.ajax.markup.html.navigation.paging
Class AjaxPagingNavigationIncrementLink

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.link.AbstractLink
                  extended by org.apache.wicket.markup.html.link.Link<T>
                      extended by org.apache.wicket.markup.html.navigation.paging.PagingNavigationIncrementLink<java.lang.Void>
                          extended by org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigationIncrementLink
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<Component>, IAjaxLink, IEventSink, IEventSource, IClusterable, IConverterLocator, IRequestListener, IHeaderContributor, ILinkListener, IRequestableComponent, IHierarchical<Component>

public class AjaxPagingNavigationIncrementLink
extends PagingNavigationIncrementLink<java.lang.Void>
implements IAjaxLink

An incremental Ajaxian link to a page of a PageableListView. Assuming your list view navigation looks like

 
                 [first / << / <] 1 | 2 | 3 [> / >> /last]
 
 

and "<" meaning the previous and "<<" goto the "current page - 5", than it is this kind of incremental page links which can easily be created. This link will update the pageable and itself or the navigator the link is part of using Ajax techniques, or perform a full refresh when ajax is not available.

Since:
1.2
Author:
Martijn Dashorst
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.wicket.markup.html.navigation.paging.PagingNavigationIncrementLink
pageable
 
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.markup.html.link.ILinkListener
INTERFACE
 
Constructor Summary
AjaxPagingNavigationIncrementLink(java.lang.String id, IPageable pageable, int increment)
          Constructor.
 
Method Summary
protected  java.lang.String getEventHandler(java.lang.String defaultHandler)
          Returns the javascript event handler for this component.
protected  AjaxPagingNavigationBehavior newAjaxPagingNavigationBehavior(IPageable pageable, java.lang.String event)
           
 void onClick()
          Fallback event listener, will redisplay the current page.
 void onClick(AjaxRequestTarget target)
          Performs the actual action of this component, performing a non-ajax fallback when there was no AjaxRequestTarget available.
protected  void onInitialize()
          This method is meant to be used as an alternative to initialize components.
 
Methods inherited from class org.apache.wicket.markup.html.navigation.paging.PagingNavigationIncrementLink
getPageNumber, isFirst, isLast, linksTo
 
Methods inherited from class org.apache.wicket.markup.html.link.Link
appendAnchor, getAnchor, getAutoEnable, getModel, getModelObject, getOnClickScript, getPopupSettings, getStatelessHint, getURL, isEnabled, onComponentTag, onLinkClicked, setAnchor, setAutoEnable, setModel, setModelObject, setPopupSettings
 
Methods inherited from class org.apache.wicket.markup.html.link.AbstractLink
disableLink, getAfterDisabledLink, getBeforeDisabledLink, getBody, isLinkEnabled, onBeforeRender, onComponentTagBody, onDetach, setAfterDisabledLink, setBeforeDisabledLink, setBody
 
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, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, 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, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onConfigure, onEvent, 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
 

Constructor Detail

AjaxPagingNavigationIncrementLink

public AjaxPagingNavigationIncrementLink(java.lang.String id,
                                         IPageable pageable,
                                         int increment)
Constructor.

Parameters:
id - See Component
pageable - The pageable component the page links are referring to
increment - increment by
Method Detail

onInitialize

protected void onInitialize()
Description copied from class: Component
This method is meant to be used as an alternative to initialize components. Usually the component's constructor is used for this task, but sometimes a component cannot be initialized in isolation, it may need to access its parent component or its markup in order to fully initialize. This method is invoked once per component's lifecycle when a path exists from this component to the Page thus providing the component with an atomic callback when the component's environment is built out.

Overrides must call super#Component.onInitialize(). Usually this should be the first thing an override does, much like a constructor.

Parent containers are guaranteed to be initialized before their children

It is safe to use Component.getPage() in this method

NOTE:The timing of this call is not precise, the contract is that it is called sometime before Component.onBeforeRender().

Overrides:
onInitialize in class Component

newAjaxPagingNavigationBehavior

protected AjaxPagingNavigationBehavior newAjaxPagingNavigationBehavior(IPageable pageable,
                                                                       java.lang.String event)
Parameters:
pageable - The pageable component the page links are referring to
event - the name of the default event on which this link will listen to
Returns:
the ajax behavior which will be executed when the user clicks the link

getEventHandler

protected java.lang.String getEventHandler(java.lang.String defaultHandler)
Returns the javascript event handler for this component. This function is used to decorate the generated javascript handler.

NOTE: It is recommended that you only prepend additional javascript to the default handler because the default handler uses the return func() format so any appended javascript will not be evaluated by default.

Parameters:
defaultHandler - default javascript event handler generated by this link
Returns:
javascript event handler for this link

onClick

public void onClick()
Fallback event listener, will redisplay the current page.

Overrides:
onClick in class PagingNavigationIncrementLink<java.lang.Void>
See Also:
Link.onClick()

onClick

public void onClick(AjaxRequestTarget target)
Performs the actual action of this component, performing a non-ajax fallback when there was no AjaxRequestTarget available.

Specified by:
onClick in interface IAjaxLink
Parameters:
target - the request target, when null, a full page refresh will be generated


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