wicket.markup.html.link
Class PageLink

java.lang.Object
  extended by wicket.Component
      extended by wicket.MarkupContainer
          extended by wicket.markup.html.WebMarkupContainer
              extended by wicket.markup.html.link.Link
                  extended by wicket.markup.html.link.PageLink
All Implemented Interfaces:
java.io.Serializable, IRequestListener, ILinkListener

public class PageLink
extends Link

Links to a given page via an object implementing the IPageLink delayed linking interface. PageLinks can be constructed directly with an IPageLink interface or with a Page Class object. In the latter case, an IPageLink implementation is provided which constructs a Page of the given class when the link is clicked. A default no-args constructor must be available in this case or a WicketRuntimeException will be thrown when Wicket fails to instantiate the class.

Author:
Jonathan Locke
See Also:
IPageLink, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.Component
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER
 
Fields inherited from interface wicket.markup.html.link.ILinkListener
INTERFACE
 
Constructor Summary
PageLink(java.lang.String id, java.lang.Class c)
          Constructs a link that instantiates the given Page class when the link is clicked.
PageLink(java.lang.String id, IPageLink pageLink)
          This constructor is ideal for constructing pages lazily.
PageLink(java.lang.String id, Page page)
          This constructor is ideal if a Page object was passed in from a previous Page.
 
Method Summary
 boolean linksTo(Page page)
          Returns true if the given page is of the same class as the (delayed) destination of this page link.
 void onClick()
          Handles a link click by asking for a concrete Page instance through the IPageLink.getPage() delayed linking interface.
 
Methods inherited from class wicket.markup.html.link.Link
appendAnchor, getAfterDisabledLink, getAnchor, getAutoEnable, getBeforeDisabledLink, getOnClickScript, getOnClickScript, getPopupSettings, getURL, internalOnAttach, isEnabled, onComponentTag, onComponentTagBody, onLinkClicked, setAfterDisabledLink, setAnchor, setAutoEnable, setBeforeDisabledLink, setPopupSettings
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalAttach, internalDetach, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onDetach, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, renderHead, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMetaData, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageLink

public PageLink(java.lang.String id,
                java.lang.Class c)
Constructs a link that instantiates the given Page class when the link is clicked. The instantiated Page is used to render a response to the user.

Parameters:
id - See Component
c - Page class

PageLink

public PageLink(java.lang.String id,
                Page page)
This constructor is ideal if a Page object was passed in from a previous Page. Construct a link to the Page.

Parameters:
id - See component
page - The page

PageLink

public PageLink(java.lang.String id,
                IPageLink pageLink)
This constructor is ideal for constructing pages lazily. Constructs a link which invokes the getPage() method of the IPageLink interface when the link is clicked. Whatever Page objects is returned by this method will be rendered back to the user.

Parameters:
id - See Component
pageLink - An implementation of IPageLink which will create the page linked to if and when this hyperlink is clicked at a later time.
Method Detail

linksTo

public boolean linksTo(Page page)
Returns true if the given page is of the same class as the (delayed) destination of this page link.

Overrides:
linksTo in class Link
Parameters:
page - A page
Returns:
True if this link goes to the given page
See Also:
Link.linksTo(wicket.Page)

onClick

public void onClick()
Handles a link click by asking for a concrete Page instance through the IPageLink.getPage() delayed linking interface. This call will normally cause the destination page to be created.

Specified by:
onClick in class Link
See Also:
Link.onClick()


Copyright © 2004-2007 Wicket developers. All Rights Reserved.