I think this example is great for understanding how to build links. Can
we add it to Wiki? Specifically I used this in my code:
Link customize = new Link("customize")
{
public void onClick()
{
setResponsePage(new CustomizeProduct(imageID));
}
public boolean linksTo(Page page)
{
if (!(page instanceof CustomizeProduct))
return false;
CustomizeProduct typedPage = (CustomizeProduct) page;
return typedPage.getImageID()==imageID();
}
};
Gili
Johan Compagner wrote:
Hmm. I don't get the reason why to use page link. Don't you think
using regular link for this is more elegant?
new Link()
{
public void onClick()
{
setResponsePage(new MyPage(...));
}
}
ahh look Another option to use! :)
This is also possible the only thing you don't have then is linkTo()
(enabling and disabling the link)
And that linkTo() if you really want to check if it is the same page
(and not the same page but a different instance)
public boolean linksTo(final Page page)
{
if(page.getClass() == pageLink.getPageIdentity())
{
PageParameters pp =
((MyPageLink)pageLink).getPageParameters())
String value = pp.get("myparam");
if( ((MyPage)page).getMyParam().equals(value))
{
return true;
}
}
return false;
}
Then you have a PageLink that disables/enabled depending on the Page and
checks if the Instance of the page has the same state as you expect it
to be.
johan
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
--
http://www.desktopbeautifier.com/
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop