Vaadin 7 - popup windows

In my Vaadin 6 project, I open a number of secondary/popup windows. One of them is a simple ‘help’ window - hit the help button, and it pops up a window with a list of commands and some text explanation. I’m trying to re-write the program for Vaadin 7, and I don’t quite see how to do that.

The original code looked something like this:

    Button tbHelp = new NativeButton();
    tbHelp.setDescription("myAPP Help Window");
    tbHelp.addListener(new Button.ClickListener() {
    private static final long serialVersionUID = 1L
        public void buttonClick(ClickEvent event) {
    private void showHelpWindow(){
        wHelp = new Window("myAPP Help");
        wHelp.addComponent(new Win_Help(myApp, wHelp));;

    private void closeHelpWindow(){
        if(wHelp != null){
            Win_Help.removeHelpWindow(myApp, wHelp);
            wHelp = null;

And the help window itself looked like:

    public class Win_Help extends VerticalLayout{
	private static final long serialVersionUID = 1L;
	private Button b_Close = null;
	private HorizontalLayout hlHeader = null;
	private My_Application app = null;
	private VerticalLayout myPage = null;
	private Window wHelp = null;

	public VerticalLayout getMyPage() {
		return myPage;

	public Win_Help(My_Application myApp, Window w){
		HorizontalLayout hlHelpDescription = null;
		HorizontalLayout hlCloseWindow = null;
		HorizontalLayout hlHelp = null;


		setComponentAlignment(hlHelpDescription, Alignment.MIDDLE_CENTER);

	public void closeButtonClick(Button.ClickEvent event){
		removeHelpWindow(app, wHelp);
	public static void removeHelpWindow(My_Application app, Window w){

So how do I do this in Vaadin 7? I found some sample code that purports to open sub-windows, but it calls routines like getApplication() which I can’t seem to locate in the new library… I’m guessing that I’m missing something very simple here…



Use myUI.addWindow(window) instead of myApp.getMainWindow().addWindow(window).

You can get the current UI with UI.getCurrent() if you don’t have a reference to it, or use Component.getUI() for any suitable attached component.