Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Now here is the way to create the pop-up with a link that will make change the browser window (not the pop-up)

Code Block
String parentPageMaptarget = "wicket:default";
String parentPageMap = null;
if(pp != null)
{
    parentPageMap = (String)pp.get ("parent_page_map");
    if(parentPageMap != null)
    {
        target=parentPageMap;
    }
}
Class pageClass = SomePage.class;
BookmarkablePageLink bpl = new BookmarkablePageLink("link", pageClass);
bpl.setPageMap (PageMap.forName (parentPageMap));
bpl.add(new SimpleAttributeModifier("target", parentPageMaptarget));
add(bpl);

If we want the link to work, we have to put the pageMap in the BPL. Also, we have to modify the attribute "target" of the link to be sure it will modify the good window.

Now the not so instinctive thing about this is the parentPagMap name. It is that Wicket will not create a pagemap name by default. That is why we have to set manually The default page map will have a name set to null. This is not a problem because we are able to fetch the pageMap with a null key. The problem is that we need to communicate to the window. Since the target is normally equal to the pageMap name, if the pageMap name is null, Wicket will set the window.name to "wicket:default". This issue is linked with JIRA : https://issues.apache.org/jira/browse/WICKET-206

...