* 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")));
}
});
// Image map link example
Image imageForMap = new Image("imageForMap", new PackageResourceReference(Home.class,
"ImageMap.gif"));
add(imageForMap);
add(new ClientSideImageMap("imageMap", imageForMap).addRectangleArea(
new BookmarkablePageLink<Page1>("page1", Page1.class), 0, 0, 100, 100)
.addCircleArea(new BookmarkablePageLink<Page2>("page2", Page2.class), 160, 50, 35)
.addPolygonArea(new BookmarkablePageLink<Page3>("page3", Page3.class), 212, 79, 241, 4,
279, 54, 212, 79)
.add(RelativePathPrefixHandler.RELATIVE_PATH_BEHAVIOR));
// 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()
{
}