2008年10月13日 星期一

Wicket的PopupSettings元件

網頁常有一些需要彈出新視窗的功能,Wicket在此也提供了方便的元件PopupSettings來提供程式設計人員使用.

步驟一.先建置一個PopupLinkExamples.html

<html>
<body>
<a wicket:id ="popupLink">彈出窗口</a>
</body>
</html>

步驟二.建置PopupLinkExamples.java

package wicket.examples.html.body.base.popuplink;

import wicket.examples.html.body.base.hello.HelloWicket;
import wicket.markup.html.WebPage;
import wicket.markup.html.link.BookmarkablePageLink;
import wicket.markup.html.link.PopupSettings;

public class PopupLinkExamples extends WebPage {

public PopupLinkExamples(){
super();
BookmarkablePageLink cPopupLink = new BookmarkablePageLink("popupLink",HelloWicket.class);
PopupSettings cPopupSettings = new PopupSettings();
cPopupSettings.setHeight(350);
cPopupSettings.setWidth(350);
cPopupLink.setPopupSettings(cPopupSettings);
this.add(cPopupLink);
}
}

步驟三.修改Examples.html & Examples.java

...
<tr>
<td><a wicket:id="Examples10">show PopupLinkExamplesPage</a></td>
</tr>
...


...
add(new PageLink("Examples10",PopupLinkExamples.class));
...

沒有留言: