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

Bug 466815

Summary: When navigating to a parent graph, the viewport and layout are not restored.
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF ZestAssignee: Alexander Nyßen <nyssen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: unspecified   
Target Milestone: 3.10.1 (Mars SR1) RC1   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Matthias Wienand CLA 2015-05-08 04:15:16 EDT
Within the Zest graph viewer, you can navigate to nested graphs by zooming into a nesting node. When zooming out of a graph, you will eventually navigate back to its parent graph. The transition should be as smooth as possible, therefore the viewport (scroll position and zoom level) and layout (positions and sizes of nodes) of that parent graph should be restored.
Comment 1 Matthias Wienand CLA 2015-05-08 12:15:53 EDT
I added a ViewportStackModel to keep track of scroll positions, zoom levels, and already layed out graphs, so that these can be restored when navigating back to a parent graph. The changes only extend the current API. The code is published on the master branch, therefore, I resolve this ticket as fixed for 3.10.0RC1.
Comment 2 Alexander Nyßen CLA 2015-05-08 14:43:37 EDT
I performed some tests on my machine and cannot confirm that this is fixed properly. While the layout is preserved, the zoom-level at which we step into the nested graph seems to be higher than the one we are in when leaving it again. We should fix that also.
Comment 3 Alexander Nyßen CLA 2015-05-19 12:47:46 EDT
Resetting target milestone, as not fixed in 3.10.0 RC1.
Comment 4 Matthias Wienand CLA 2015-06-05 08:32:00 EDT
Currently, the ViewportStackModel maintains a list of graphs for which the next layout pass is to be skipped in order to preserve the layout when navigating back to a previously already layed out graph. This functionality should be moved into a separate model, because it is unrelated to the viewport.
Comment 5 Alexander Nyßen CLA 2015-07-28 16:04:50 EDT
The problem is related to pinch/spread. The cause is that when using pinch/spread to zoom out, the spread gesture is not completed yet when the OpenParentGraphOnZoomBehavior restores the viewport, the FXChangeViewportsPolicy is still in an active transaction (init() was called, commit() will only be called when the spread gesture completes). However, FXChangeViewportsPolicy does not recognize that the ViewportModel was changed after init() was called and will apply the relative zoom to the initial viewport (before viewport was restored by OpenParentGraphOnZoomBehavior). 

We can resole this by registering a listener to the ViewportModel within FXChangeViewportsModel and reacting to changes of the viewport. However, investigation will still be needed w.r.t. to proper fundability in these cases.
Comment 6 Alexander Nyßen CLA 2015-07-28 16:08:13 EDT
It may be a better idea to turn the OpenParentGraphOnZoomBehavior and the OpenNestedGraphOnZoomBehavior into policies, so they could synchronize their behavior with the respective zoom policies. Maybe FXChangeViewportPolicy can be extended in Zest to perform the viewport push/pop operations. It could then perform the synchronization internally.
Comment 7 Alexander Nyßen CLA 2015-07-30 15:37:51 EDT
I have re-investigated this. I think, at first, we should enhance the ViewportModel with the push/pop functionality currently offered in the ViewportStackModel. Also the FXChangeViewportPolicy can offer respective functionality for pushing/popping the viewport state. Thereby, synchronization with the current zoom operation can be performed within FXChangeViewportPolicy.
Comment 8 Alexander Nyßen CLA 2015-08-17 12:13:22 EDT
I replaced the push/pop mechanism with a mechanism that stores a viewport state for each graph from which navigation was started (so that viewport can be restored when navigating back). 

Renamed ViewportStackModel into NavigationModel and introduced a NavigationPolicy that is now used by OpenParentGraphOnDoubleClick and OpenNestedGraphOnDoubleClick policies, so the navigation can be properly undone as well. 

The OpenNestedGraphBehavior and OpenParentGraphBehavior behaviors also make use of the NavigationPolicy now, but the do only apply the respective changes without properly initializing and committing the policy. We will have to replace this. Also, we will have to replace that up to now, the NavigationPolicy directly manipulates the FXChangeViewportOperation of the FXChangeViewportPolicy to apply the viewport changes.
Comment 9 Alexander Nyßen CLA 2015-08-17 12:51:28 EDT
I opened bug #475190 to keep track of the remaining refactorings and resolve this as fixed in 3.10.1 RC1.