Vetoing a CloseEvent

I wonder why the CloseEvent of the Window component hasn’t a veto possibilty like in other UI libraries. I had to switch all my SubWindows to non-closeable because Vaadin enforces the closing, leaving me with no chance to say ‘no’. This is not optimal because the users are used to have a Close-Button. What I really need is that the Close-Button can lead to the same application behaviour as if the Cancel-Button was pressed. For example if there is any unsaved work I want to raise the classic Yes/No/Cancel-Dialog. Or something like the “Do you really want to quit?” would be another example.

This would be a nice feature, and not hard to implement, seeing that the closing on the client side only occurs after the server visit anyway. As a workaround, you can override Window.close() as described
in this thread

Thank you, Johannes. This workaround does the trick for me. I override close() and let it send a close request to my controller. If it says “yes ok” I call my own close-Method that does the super.close() logic.
Maybe the Vaadin team will change the logic a bit in the future… So that the CloseEvent carries a veto-flag in it and is able to stop the close-logic. But still we would need the possibilty to enforce closing in case it is done programmatically after the “yes ok”. Maybe it would be cleanest if the programmatical close and the close-button would fire different events…