The link method returns an instance of PageLink. I'm not sure if you're
aquinted to anonymous classes, but:
return new PageLink(name, new IPageLink()
{
public Page getPage()
{
return new EditBook(Book.get(id));
}
public Class getPageIdentity()
{
return EditBook.class;
}
});
Is an anonymous class of type PageLink (see
http://java.sun.com/docs/books/tutorial/java/javaOO/innerclasses.html)
The getPage method returns the page that should be navigated to, and
getPageIndentity is used to see whether a link should be rendered
'active' (points to another page than the current one), or 'inactive'
(the link points to the current page).
If you look at the onClick implementation of PageLink:
public void onClick()
{
// Set page source's page as response page
setResponsePage(pageLink.getPage());
}
You can see that the getPage method is called not before it is actually
needed, thus saving session space.
Eelco
Nick Heudecker wrote:
Can someone explain what's going on in EditBook#link(String, Long):
public static PageLink link(final String name, final long id)
{
return new PageLink(name, new IPageLink()
{
public Page getPage()
{
return new EditBook(Book.get(id));
}
public Class getPageIdentity()
{
return EditBook.class;
}
});
}
I see <a wicket:id = "edit" href="EditBook.html">Edit</a> in
BookDetails.html and I'm fairly sure they're related, but I'm not
clear on that method body.
Thanks for your time.
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user