在 Vaadin 7 中,将数据/参数传递给 BrowserWindowOpener 的新 UI 实例? [英] In Vaadin 7, pass data/arguments to new UI instance of BrowserWindowOpener?

查看:17
本文介绍了在 Vaadin 7 中,将数据/参数传递给 BrowserWindowOpener 的新 UI 实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 BrowserWindowOpener.

问题:如何向新实例化的 UI 子类传递一些信息?

Question: How do I pass some information to the newly instantiated UI subclass?

语法要求我指定一个要实例化的类.我如何与未来的实例通信?

The syntax requires that I specify a class to be instantiated. How do I communicate with that future instance?

BrowserWindowOpener bookOpener = new BrowserWindowOpener( BookUI.class );

例如,假设我的应用打开了一个窗口,其中列出了以特定字母 (A-Z) 开头的单词的单词定义.如何告诉新打开的 UI 应该显示A"字、B"字或V"字?

For example, let's say my app opens a window listing word definitions for words starting with a particular letter of the alphabet (A-Z). How do I tell the newly opening UI that it should show the "A" words, the "B" words, or the "V" words?

我注意到 BrowserWindowOpenerState 类,但它的用途是没有记录.

I noticed the BrowserWindowOpenerState class, but its use is not documented.

推荐答案

我还没有尝试过这个,但是快速浏览一下 javadoc 建议使用 BrowserWindowOpener#setParameterBrowserWindowOpener#setUriFragment 可以传递参数进入用户界面.

I have not tried this, but a quick look at the javadoc suggests that by using BrowserWindowOpener#setParameter or BrowserWindowOpener#setUriFragment you can pass parameters into the UI.

例如

BrowserWindowOpener bookOpener = new BrowserWindowOpener( BookUI.class );
bookOpener.setParameter("startLetter", "A");

...

class BookUI {
  protected abstract void init(VaadinRequest request){
    String startLetter = request.getParameter("startLetter");
    // Etc
  }
} 

这篇关于在 Vaadin 7 中,将数据/参数传递给 BrowserWindowOpener 的新 UI 实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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