Vaadin 7: modify main UI when table item in subwindow is choosen

Hi all,

i have a subwindow in a vaadin 7 project, on this subwindow there is a table component. If row in the table is clicked, i hope that main UI can show the information about this row.

The problem is that i don’t know how to let subwindow change the component in main UI.

The screen shot about my target can be found on
google driver

The example code can be found on
git hub

Any suggestion will be greatly appreciated.

Thanks.
Y18

Hi, in your subwindow class you can simply call getUI() and get a reference to the UI it belongs to. Its static type is naturally plain UI so you have to cast it to MyUI to access things declared in your subclass. Alternatively, you could add a MyUI parameter to your subwindow constructor and pass the “this” reference from the UI. To decouple things a bit, you could also pass a callback (such as a Runnable object) to the subwindow, to be invoked when the close button is clicked - this way the subwindow doesn’t have to know anything about the main UI.

Thanks, the callback solution works.