Open a sub window with a link ?

Hello

I’m looking for how to open a sub window with link.

I’m trying this.



public class MyWindow extends Window{

     public MyWindow(){
        super("MyWindow");
        center();
        setModal(true);
        setClosable(false);
        setDraggable(false);
        setResizable(false);
     }
}


public class OpenMyWindow extends Window{
     private Link link;
      
     public MyWindow(){
        super("OpenMyWindow");
        center();
        setModal(true);
        setClosable(false);
        setDraggable(false);
        setResizable(false);

         link = new Link("Open Window", new ExternalResource("MyWindow");
         VerticalLayout v = new VerticalLayout();
          setContent(v);
          v.addComponent(link);
     } 

}

Any idea ?

thanks

Use a Button with a link-like style. For example, using the default Reindeer theme, you can say
myButton.addStyleName(Reindeer.BUTTON_LINK)
.

Thanks…Now, I need open a Window over another Window.

I’m trying this.


public class MyWindow extends Window{
     public MyWindow(){
        super("MyWindow");
        center();
        setModal(true);
        setClosable(false);
        setDraggable(false);
        setResizable(false);
     }
}


public class OpenMyWindow extends Window{
     private Button openMyWindow;
      
     public OpenMyWindow(){
        super("OpenMyWindow");
        center();
        setModal(true);
        setClosable(false);
        setDraggable(false);
        setResizable(false);

        openMyWindow = new Button("Open Window");
        openMyWindow.setStyleName(BaseTheme.BUTTON_LINK);
        openMyWindow.addClickListener(new Button.ClickListener() {            
            @Override
            public void buttonClick(ClickEvent event) {
                  new MyWindow().setVisible(true);                
            }
        });  
      
        VerticalLayout v = new VerticalLayout();
         setContent(v);
         v.addComponent(link);
     } 
}

setVisible(true) does not work to open new Window. How to do this ?

thanks !