Took advantage of the advice given in this thread . I do it in the second way, but this hardly affects the situation. Columns of the table perfectly resize. But there is one problem. If I take the cursor outside the browser window, then my application does not catch events. So it may happen that the user has already released the button, and when the cursor returns to the window, the movement begins again. Logically, columns should normally resize regardless of whether the cursor is inside or outside the browser window. In google-docs this works in some way. At the moment I do something like this:
Resizer catches the mouse-down event and disables the selection in the browser (applies the style), and also adds listeners to the RootPanel:
handlerRegistrations.add(RootPanel.get().addDomHandler(new MouseUpHandler() { public void onMouseUp(MouseUpEvent e) { resize(e); setDragged(false); } }, MouseUpEvent.getType()); ); handlerRegistrations.add(RootPanel.get().addDomHandler(new MouseMoveHandler() { public void onMouseMove(MouseMoveEvent e) { resize(e); } }, MouseMoveEvent.getType()); ); handlerRegistrations.add(RootPanel.get().addDomHandler(new MouseOutHandler() { public void onMouseOut(MouseOutEvent e) { setDragged(false); } }, MouseOutEvent.getType()); );
To stop dragging, I delete all these listeners (I clear the handlerRegistrations) and allow the selection again in the browser. As you can see, now if we move the mouse out of the window, we stop dragging.
How can you still do to catch events outside the browser?