2011-07-13 42 views
0

我使用在vaadin菜单演示示例中给出的菜单项,点击每个菜单项im点击显示通知消息,但是我的要求是我必须在点击时打开新类子菜单项的一些给我演示示例在vaadin如何打开新窗口点击菜单项vaadin wth在菜单命令clcik上打开新窗口

回答

1

这里是一个简短的例子,展示了如何打开Vaadin的另一个顶级窗口。您必须为窗口提供唯一的名称(setName调用)。然后你打电话给Vaadin找到新创建的窗口的URL,然后打开它。在这种情况下,“窗口”是保存我的主应用程序窗口的变量。

reportWindow = injector.getInstance(GeneralReportWindow.class); 
reportWindow.setName("report_overview"); 
reportWindow.setGenerator(injector.getInstance(OverviewGenerator.class)); 

addWindow(reportWindow); 

try { 
    URI reportURI = reportWindow.getURL().toURI(); 
    URL windowURL = new URI(reportURI.getScheme(), 
     reportURI.getUserInfo(), reportURI.getHost(), 
     reportURI.getPort(), reportURI.getPath(), "report=overview", null).toURL(); 
    window.open(new ExternalResource(windowURL, "_new")); 
} catch (Exception e) { 
    log.warn("Unable to create report window", e); 
} 
+0

给我的示例代码您好感谢,请你给我的代码一些细节I M发现很难实现,如果你给我提供例如,它是很大的帮助充满了对我 – vinayaka