* Constructor
*/
public Home()
{
// Action link counts link clicks
final Link actionLink = new Link("actionLink")
{
@Override
public void onClick()
{
linkClickCount++;
}
};
actionLink.add(new Label("linkClickCount", new PropertyModel<Integer>(this,
"linkClickCount")));
add(actionLink);
// Action link counts link clicks on works with onclick handler
final Link actionOnClickLink = new Link("actionOnClickLink")
{
@Override
public void onClick()
{
onClickLinkClickCount++;
}
};
add(actionOnClickLink);
add(new Label("onClickLinkClickCount", new PropertyModel<Integer>(this,
"onClickLinkClickCount")));
// Link to Page1 is a simple external page link
add(new BookmarkablePageLink<Void>("page1Link", Page1.class));
// Link to Page2 is automaticLink, so no code
// Link to Page3 is an external link which takes a parameter
add(new BookmarkablePageLink<Void>("page3Link", Page3.class).setParameter("bookmarkparameter",
"3++2 & 5 � >< space + �"));
// Link to BookDetails page
add(new Link<Void>("bookDetailsLink")
{
@Override
public void onClick()
{
setResponsePage(new BookDetails(new Book("The Hobbit")));
}
});
// Delayed link to BookDetails page
add(new Link<Void>("bookDetailsLink2")
{
@Override
public void onClick()
{
setResponsePage(new BookDetails(new Book("Inside The Matrix")));
}
});
// Popup example
PopupSettings popupSettings = new PopupSettings("popuppagemap").setHeight(500)
.setWidth(500);
add(new BookmarkablePageLink<Void>("popupLink", Popup.class).setPopupSettings(popupSettings));
// Popup example
add(new BookmarkablePageLink<Void>("popupButtonLink", Popup.class).setPopupSettings(popupSettings));
// External site link
add(new ExternalLink("google", "http://www.google.com", "Click this link to go to Google"));
// And that link as a popup
PopupSettings googlePopupSettings = new PopupSettings(PopupSettings.RESIZABLE |
PopupSettings.SCROLLBARS).setHeight(500).setWidth(700);
add(new ExternalLink("googlePopup", "http://www.google.com",
"Click this link to go to Google in a popup").setPopupSettings(googlePopupSettings));
// Shared resource link
add(new ResourceLink("cancelButtonLink", new SharedResourceReference("cancelButton")));
// redirect to external url form
FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
add(feedbackPanel);
add(new RedirectForm("redirectForm"));
Link linkToAnchor = new Link("linkToAnchor")
{
@Override
public void onClick()
{
}
};
add(linkToAnchor);
Link anotherlinkToAnchor = new Link("anotherlinkToAnchor")
{
@Override
public void onClick()
{
}