in PageLink, getPageClass() is used like this:
/**
* Returns true if the given page is of the same class as the (delayed)
* destination of this page link.
* @see wicket.markup.html.link.Link#linksTo(wicket.Page)
*/
public boolean linksTo(final Page page)
{
return page.getClass() == pageLink.getPageClass();
}this method can be further overridden to deal with auto-enabling/disabling navigation links to parameterized pages of the same class.
there used to be an example of this, i think, but it seems to be gone now.
anyway, Link.linksTo is used to disable navigation links automatically when a Link is rendered:
/**
* Handles this link's tag.
* @param tag the component tag
* @see wicket.Component#handleComponentTag(ComponentTag)
*/
protected final void handleComponentTag(final ComponentTag tag)
{
// Can only attach links to anchor tags
checkTag(tag, "a"); // Default handling for tag
super.handleComponentTag(tag);// If we're auto-enabling
if (autoEnable)
{
// the link is enabled if this link doesn't link to the current page
setEnabled(!linksTo(getPage()));
}
Jonathan Locke wrote:
Juergen Donnerstag wrote:
IPageLink requires us to implement two methods: getPage() andnope. getPage() actually resolves the Page when a link is clicked. getPageClass is part of the information used before the link is clicked to determine how a link should be rendered.
getPageClass(). Aren't these two information redundant? The page
the docs state this:
* ... The getPageClass() * method returns the subclass of Page that getPage() will return if * and when it is called. * <p> * This way of arranging things is useful in determining whether a * link links to a given page, which is in turn useful for deciding * how to display the link (because links in a navigation which link to * a page itself are not useful and generally should instead indicate * where the user is in the navigation).
returned by getPage() is able to provide its Class. From the sources I understand what they required for, but from a user's perspective I don't. Does anybody knwo the details of this implementation and may be come up with a suggestion on how to avoid getPageClass() in IPageLink.
Juergen
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
