How to add buttons to a modal window?

I noticed that there’s no addComponent method in Window class.
I want to popup a dialog when user clicks delete button and if user confirms deletion data is deleted otherwise modal window simply closes. But how to add “Ok” and “Cancel” buttons?

I’m not sure, did I understand your question correctly, but I assume you are talking about Vaadin 7.
In Vaadin 6, you could add components to the Window directly. However, the components were not added directly to the window, but to the content of the window. In Vaadin 6, if you had not set the content yourself, a VerticalLayout was implicitly used.

In Vaadin 7, you have to add this layout yourself like Window.setContent(layout), and indeed window.addComponent() is removed.

So generally you would just add a layout to your window and then populate it with components.

Alternatively, you could use this component: https://vaadin.com/directory#addon/confirmdialog (seems to be available for V6 and V7 beta 2)

BR,
Johan

Yes I use Vaadin 7. Thanks for reply, adding layout is more convenient than adding components directly :slight_smile: