String anchor = component.getAnchor();
ILink link = component.getLink(cycle);
String url = link.getURL(anchor, true);
PageRenderSupport support = TapestryUtils.getPageRenderSupport(cycle, component);
String functionName = support.getUniqueString("popup_window");
BodyBuilder builder = new BodyBuilder();
builder.addln("function {0}()", functionName);
builder.begin();
builder.addln(
"var newWindow = window.open({0}, {1}, {2});",
TapestryUtils.enquote(url),
TapestryUtils.enquote(getWindowName()),
TapestryUtils.enquote(getFeatures()));
builder.addln("newWindow.focus();");
builder.end();
support.addBodyScript(component, builder.toString());
return "javascript:" + functionName + "();";
}