简体   繁体   English

Wicket AjaxIndicatorAppender跨面板

[英]Wicket AjaxIndicatorAppender across panels

I have 2 panels on one page and in first panel I call Ajax link and do some back end operations with long duration. 我在一个页面上有2个面板,在第一个面板中,我称Ajax链接并长时间进行一些后端操作。 In another panel I want show AjaxIndicatorAppender . 在另一个面板中,我想显示AjaxIndicatorAppender

If I use AjaxIndicatorAppender with listener in the first panel, everything work fine, but if I use it in panel 2, it does nothing. 如果在第一个面板AjaxIndicatorAppender与listener一起使用,则一切正常,但是如果在面板2中使用它,则它什么也不会做。 Any help how call Ajax in panel 1 and show the Ajax indicator in panel 2? 有什么帮助如何在面板1中调用Ajax并在面板2中显示Ajax指示器? I am lost. 我搞不清楚了。

In panel1 (menu panel): 在panel1(菜单面板)中:

modal1.setWindowClosedCallback(new ModalWindow.WindowClosedCallback()
    {
        @Override
        public void onClose(AjaxRequestTarget target)
        {
            some code.....

            send(getPage(), Broadcast.DEPTH, new ContentUpdate(target));


            etc...

in panel2 (content panel) 在panel2(内容面板)中

@Override
public void onEvent(IEvent<?> event) {
super.onEvent(event);
if (event.getPayload() instanceof ContentUpdate) {
    AjaxRequestTarget target = ((ContentUpdate)event.getPayload()).getTarget();

            ContentSection section = new ContentSection("content0",contentView.getCustomSectionList().get(0));
            listItems.get("content0").replaceWith(section);
            listItems.get("pagingNavigator0").replaceWith(new PagingNavigator("pagingNavigator0", section.getDataView()));
            target.add(wmc);
}
}    

How can I trigger listener in panel 2? 如何在面板2中触发监听器? Thank you 谢谢

I fixed this problem. 我解决了这个问题。 My parent page can trigger IAjaxIndicatorAware too. 我的父页面也可以触发IAjaxIndicatorAware。 I move this interface to my parent page and I call IndicatorMarkupId from the second panel. 我将此界面移到我的父页面,并从第二个面板中调用IndicatorMarkupId。

Thank for help :) 感谢您的帮助:)

The AjaxLink should implement IAjaxIndicatorAware interface and #getAjaxIndicatorMarkupId() should return the markup id of the HTML element with the loading indicator in Panel2. AjaxLink应该实现IAjaxIndicatorAware接口,并且#getAjaxIndicatorMarkupId()应该返回带有Panel2中的加载指示器的HTML元素的标记ID。

But this way you would couple Panel1 with Panel2. 但是通过这种方式,您可以将Panel1与Panel2耦合在一起。 Since you use Wicket Event mechanism I guess you try to keep them decoupled. 由于您使用的是Wicket事件机制,所以我想您尝试使它们保持解耦状态。 Probably you need to show a page-wide loading indicator instead. 可能您需要显示整个页面的加载指示器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM