Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 438927

Summary: FXMouseDragGesture can get into an invalid state.
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF FXAssignee: Matthias Wienand <matthias.wienand>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Matthias Wienand CLA 2014-07-04 08:30:10 EDT
Not all mouse events are correctly registered by the FXMouseDragGesture. That's why not all of the press(), drag(), and release() methods are necessarily called. As a result, a policy (GEF4 MVC) might not get initialized or completed, which is a violation of the policy's general contract. Therefore, the FXMouseDragGesture should guarantee, that the press(), drag(), and release() methods are correctly called.

The current set of event handlers is not sufficient to resolve the issue. Probably, an event filter has to be used to guarantee that press, drag, and release events are registered. The event filter receives all mouse events before other nodes have a chance of processing (and possibly consuming) the events.
Comment 1 Matthias Wienand CLA 2014-07-09 11:22:50 EDT
The gesture can no longer get into an invalid state. It is guaranteed now that at least press() and release() are called for a press-drag-release gesture. After an initial mouse press, all mouse events are processed by the gesture using an event filter. The code is published on the master branch of the GEF4 git repository, therefore I am changing the status to RESOLVED FIXED.

However, there are still remaining problems with the FXMouseDragGesture in conjunction with the JavaFX SWT integration. In particular, mouse events might not get processed by JavaFX when the mouse is outside of the JavaFX Scene. In order to guarantee a release() call before the next press-drag-release gesture can start, the gesture does now check if at least one mouse button is pressed in the event filter. If no mouse buttons are pressed, the gesture deduces that a release event must have occured which did not get send to the event filter and calls release().

I reported those problems in the JavaFX issue tracker: https://javafx-jira.kenai.com/browse/RT-37869