在GWT的新窗口中显示小部件 [英] Displaying a Widget in a new Window in GWT

查看:78
本文介绍了在GWT的新窗口中显示小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我需要在新窗口中显示一个拖放n拖放单元格表. 我已经检查了答案,并在Google上进行了搜索,但是没有得到适当的答案. 单击按钮即可打开一个新窗口.以下是我正在使用的代码:

I have a requirement wherein I need to display a drag n drop cell table in a new window. I have checked for answers and I have googled about this, but I did not get appropriate answers. I am able to open a new window on click of a button. Following is the code which I am using:

@UiHandler(value = { "buttonReleaseView" })
    void onReleaseViewClick(ClickEvent clickEvent) {
        String winUrl = GWT.getModuleBaseURL() + "releaseView/";
        String winName = "Release View";

        openNewWindow (winName, winUrl);  /* spawn a new window - not popup */
    }

    /**
    * Opens a new windows with a specified URL..
    * 
    * @param name String with the name of the window.
    * @param url String with your URL.
    */
    public static void openNewWindow(String name, String url) {
        com.google.gwt.user.client.Window.open(url, name.replace(" ", "_"),
               "menubar=no," + 
               "location=false," + 
               "resizable=yes," + 
               "scrollbars=yes," + 
               "status=no," + 
               "dependent=true");
    }

现在,我应该如何在新窗口中显示单元格表?

Now, how should I display cell Table in this new window?

请帮帮我.

预先感谢

Richa

推荐答案

GWT模块位于浏览器页面中,因此,如果要打开新的浏览器页面并在其中显示GWT组件,则基本上需要加载新的它自己的主机页面中的GWT模块.在这种情况下,我可能会使用弹出窗口,因为这样会更简单.

A GWT module lives inside a browser page, so if you want to open a new browser page and display GWT components inside it, you basically need to load a new GWT module in it's own host page. I would probably use a popup window in this case, since it would be way simpler.

但是,如果您确实需要这样做,则可以创建一个单独的主机页面和GWT模块以显示该表,或者可以重复使用相同的主机页面和GWT模块并传递一些URL参数或历史记录令牌以指示哪个查看显示.请记住,即使在最后一种情况下,浏览器中仍将运行GWT模块的两个实例.

But if you really need to do it, you could either create a separate host page and GWT module to display the table, or you could reuse the same host page and GWT module and pass some URL parameter or history token to indicate which view to display. Keep in mind that even in this last case, you would still have two instances of the GWT module running in the browser.

通过在Window.open()返回的句柄上调用document.write,也可以或多或少地采用骇人听闻的方式直接将其写入新的浏览器窗口,但是我只会对不需要的简单操作执行此操作大量的用户交互(例如,我已经将此方法用于打印预览"功能).

There are also more or less hackish ways to write directly to the new browser window by calling document.write on the handle returned by Window.open(), but I would only do that for simple things that don't require too much user interaction (e.g. I've used this approach for a Print Preview feature).

这篇关于在GWT的新窗口中显示小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆