使用新的浏览器窗口访问 vaadin 中的内部资源
我正在与 vaadin 合作,我想在用户单击按钮时生成报告,我的报告位于应用程序内,我想在新的浏览器窗口中打开报告。当我尝试这样做时,它会打开窗口,但显示我当前所在的同一窗口。我使用“open()”方法打开新窗口,并使用“ExternalResource”作为报告路径。这是我的代码
mainWindow.getWindow().open(
new ExternalResource("http://localhost:8080/myapp/reports/report.rptdesigng"),
"_blank", // window name
500, // width
200, // weight
Window.BORDER_NONE // decorations
);
I'm working with vaadin, I want to generate a report when user click the button,My report is within the application,I want to open the report within new browser window. When I try to do that, it opens the window but shows the same window I'm currently in. I used "open()" method to open new window and to for the report path I used "ExternalResource". Here is my code
mainWindow.getWindow().open(
new ExternalResource("http://localhost:8080/myapp/reports/report.rptdesigng"),
"_blank", // window name
500, // width
200, // weight
Window.BORDER_NONE // decorations
);
瓦丁有不同类型的资源。请查看有关 Vaadin 书中可用资源类型的章节。
如果您使用ExternalResource,它只会将窗口转发到该URL。除非您在窗口中注册了 URIHandler,否则它只会显示主窗口代替。
所以基本上你有两个选择:
当然也可以打开另一个 Vaadin 管理的窗口(即由 Vaadin 组件组成)。您可以在采样器中找到有关 Windows 的信息和代码示例。
There are different types of resources in Vaadin. Take a look at chapter about available Resource types in the Book of Vaadin.
If you use the ExternalResource it only forwards the window to that URL. And unless you have registered an URIHandler in your window, it only shows the main window instead.
So basically you have two options:
Of course there is also possibility to open another Vaadin managed window (i.e. composed of Vaadin components). You can find information and code samples about windows in the Sampler.