Listening subwindow move/drag

Hello everybody,

I’m searching for a means to capture window drag events. com.vaadin.ui.Window seems not declaring a method like “addMoveListener”, nor its ancestors.

(There is com.vaadin.client.ui.VWindow which has “addMoveHandler”; but i think, this class is in client-side. I thought those two classes are matched, that is, Window is “server-side counterpart” of VWindow; appearantly not.)

Any idea or tip on listening sub-window movement?

Hello again,

If anyone is interested, found a solution: Using extension mechanism.
Thanks to Tapio Aali for this great article: https://vaadin.com/blog/-/blogs/2656782
Once you check the accompanying code, you’ll see in the connector class that an event handler is registered to the widget (in the example it’s a VTextField) and through RPC mechanism event on the client side is transmitted to the server. Although RPC is not called in the event handler, example paves the way.

Using this example as a skeleton to write an extension for Window, it’s managed to transmit move event on VWindow to the listeners registered on the server side. Different from the article’s example code, RPC is called from the event handler method of the connector.

It seems to me that explanation above is not so clear. If anyone is interested and need help, I can share code.

A correction: Yes, VWindow is indeed counterpart of Window.

Very nice! If you feel like it, you should consider publishing your extension as an add-on to the Directory :slight_smile:

Best regards,
Olli