在 wicket 中自定义 IndicatingAjaxLink [英] Customizing IndicatingAjaxLink in wicket
问题描述
在我当前的项目中,我遇到了在 wicket 中自定义 IndicatingAjaxLink 的问题,是否有任何解决方案可以将标准 gif 图像更改为我自己的?例如我们有以下监听器
add(new IndicatingAjaxLink("closeReceivedBillspanel") {public void onClick(AjaxRequestTarget art) {//一些耗时的计算}});
当用户点击这个链接时,出现了带加载的gif,我想改变这个gif,这个问题有什么解决方案吗?
让你的页面实现 IAjaxIndicatorAware 接口
公共类 BasePage 扩展 WebPage 实现 IAjaxIndicatorAware {公共 BasePage(最终的 PageParameters 参数){//主页链接AjaxLink<页面>homeLink = new AjaxLink("homeLink") {private static final long serialVersionUID = 1L;@覆盖public void onClick(AjaxRequestTarget 目标) {setResponsePage(HomePage.class);}};添加(主页链接);}@覆盖公共字符串 getAjaxIndicatorMarkupId() {返回指标";}
这样你就可以在html中通过改变img标签中的图片来设置加载出现时想要显示的任何图片
in my current project i've faced a problem of customizing IndicatingAjaxLink in wicket, is there any solution to change standart gif image to my own? For example we have following listeneer
add(new IndicatingAjaxLink("closeReceivedBillspanel") {
public void onClick(AjaxRequestTarget art) {
// some timeconsuming calculations
}
});
as user clicks this link, the gif with loading appears, and i want to change this gif, is there any solution for this problem?
Have your page implements the IAjaxIndicatorAware interface
public class BasePage extends WebPage implements IAjaxIndicatorAware {
public BasePage(final PageParameters parameters) {
// Home link
AjaxLink<Page> homeLink = new AjaxLink<Page>("homeLink") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
setResponsePage(HomePage.class);
}
};
add(homeLink);
}
@Override
public String getAjaxIndicatorMarkupId() {
return "indicator";
}
This way, you can set, in the html, any image you want to display when the loading appears by changing the image in the "img" tag
<div id="indicator" style="display: none;">
<div class="indicator-content">
Please wait... <wicket:link><img src="images/loading.gif" width="16" height="16" alt="loading" /></wicket:link>
</div>
</div>
这篇关于在 wicket 中自定义 IndicatingAjaxLink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!