結局JavaScript なのだが、a タグ onclick に Wicket で window.open 実行を埋め込んでくれる。
<a wicket:id="link" href="#">other</a>
PopupSettings をリンクのコンポーネント(ExternalLink)に設定する。
PopupSettings settings = new PopupSettings(); settings.setWindowName("_blank"); queue(new ExternalLink("link", "http://google.com").setPopupSettings(settings));
すると、<a> の onclick が、以下のように生成される。
onclick="var w = window.open(href, '_blank', 'scrollbars=no,location=no ,menuBar=no,resizable=no,status=no,toolbar=no'); try {if (w.blur) w.focus();}catch(ignore){}; return false;"
開く前のリンクのブラウザウィンドウ大きさサイズで開くので、開くウィンドウサイズを調整したければ
PopupSettings に、width と height をセットしておく。
PopupSettings settings = new PopupSettings(); settings.setWindowName("_blank"); settings.setHeight(800); settings.setWidth(500);
window.open() の中に、width=800,height=500 となるはずだ。