I use vaadin 8.
I have the following class, in which i want to create a SubWindow:
@CDIView("TitleView")
public class TitleView extends VerticalLayout implements View {
private Button details;
public TitleView(TitleService service) {
Button details = new Button("details");
details.addClickListener(event -> showDetails());
HorizontalLayout tb = new HorizontalLayout(details);
addComponent(tb);
}
private void showDetails() {
// Create a sub-window and set the content
Window subWindow = new Window("Sub-window");
VerticalLayout subContent = new VerticalLayout();
subWindow.setContent(subContent);
// Put some components in it
subContent.addComponent(new Label("Meatball sub"));
subContent.addComponent(new Button("Awlright"));
// Center it in the browser window
subWindow.center();
// Open it in the UI, but not work
addWindow(subWindow);
=> Error !!!!!!!!!!!!!!!!!!!!!!!
}
How can i add the Window to the View?