【问题标题】:gwt modal popuppanel blocks iframe eventgwt modal popuppanel 阻止 iframe 事件
【发布时间】:2012-09-17 07:42:01
【问题描述】:

我有一个带有简单“请稍候”机制的 GWT 应用程序。当我按下按钮发送 RPC 调用时,我会在屏幕上显示一个模式弹出对话框,该对话框会阻止用户交互,直到 RPC 返回。像这样,我防止用户多次单击按钮并发送多个 RPC。这非常有效,除非在加载 IFrame 时。在这种情况下,我安装在 iframe 上的 loadhandler 永远不会被调用。

/**
 * Test class
 */
public class Test implements EntryPoint {

    /**
     * This is the entry point method.
     */
    @Override
    public void onModuleLoad() {
        final PopupPanel popup = new PopupPanel(false, true);
        popup.add(new Label("Please wait"));
        popup.center();

        final Frame frame = new Frame("http://www.google.com");
        frame.addLoadHandler(new LoadHandler() {
            @Override
            public void onLoad(LoadEvent event) {
                Window.alert("Event received");
                popup.hide();
            }
        });

        RootPanel.get().add(frame);
    }
}

但是,如果我构造一个 PopupPanel(false, false),则会触发 LoadEvent。 注意:这只发生在编译模式下,GWT开发模式下不会发生。

有人知道吗?

提前谢谢你,

迈克

【问题讨论】:

    标签: gwt


    【解决方案1】:

    不要使用modal 弹出窗口,其中有all sorts of issues。更喜欢显示玻璃面板 (setGlassEnabled)。

    【讨论】:

      【解决方案2】:

      模态窗口防止各种事件以确保模态。在这种情况下,您需要找到解决方法。

      我建议禁用单击按钮并在 rpc 成功或失败时启用它。

      如果您需要一次性禁用它们,那么您很可能需要实现自己的事件,在事件总线中注册它们并根据您的需要处理它们。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-16
        • 1970-01-01
        • 1970-01-01
        • 2021-02-27
        • 1970-01-01
        相关资源
        最近更新 更多