[Client] VWindow.close()?

Hello everyone,

I’m trying to write a small Vaadin 7.4.0 Extension that can be attached to a com.vaadin.ui.Window. The corresponding Connector should be able to close a VWindow on the client side. Unfortunately, VWindow does not have a public “close()” method. It does have “hide()”, but that doesn’t propagate the state change properly to the server.

I did it like this for now, stealing the code of “onCloseClick” handler of VWindow:

    private VWindow widget;
    private String windowId;
    private ApplicationConnection client;

    @Override
    protected void extend(final ServerConnector target) {
        this.widget = (VWindow) ((ComponentConnector) target).getWidget();
        this.windowId = target.getConnectorId();
        this.client = target.getConnection();
    }
    
    private void closeWindow() {
        this.client.updateVariable(this.windowId, "close", true, true);
    }

It works, but this doesn’t seem very… clean. Is there a better way? This is my very first encounter with GWT code ever, so please be patient with me ^^’

Thank you,

Martin