| Summary: | update problem in dynamic graphs | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Arne Adams <arne.adams> | ||||
| Component: | GEF FX | Assignee: | gef-inbox <gef-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | matthias.wienand | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 4.0.0 / 3.11.0 (Neon) M5 | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
We looked into the issue and can present the following findings: 1) We cannot reproduce the exact issue. Therefore, it would be great if you could supply us with the GEF4 version that you are using and with a description from where the changes to the Graph are performed (input event handler, other thread, etc.). 2) When we tested to add nodes and edges, a ConcurrentModificationException was thrown. We identified the source of the CME and pushed a fix that to the master branch that prevents the CME. The fix contains: - Ensure LayoutContextBehavior does not re-layout when the layout-bounds are (temporarily) removed from the attributes of the GraphLayoutContext. - Guard GraphLayoutContext against unnecessary re-binding of its attributes in case the same Graph is set on the context as was set before already. - Ensure GraphContentPart accesses its adapters type-safe. 3) Your description (edges do not follow) sounds like an anchor-related bug. We fixed a lot of anchor-related bugs some time ago. Therefore, if you are using an older version, such behavior is not completely unexpected. Maybe, the issue is fixed for you already if you update to the most recent revision. Otherwise, we would like to investigate further, but we need some additional information (named above). I am using the version 0.2.0.201509140217 of gef The changes are triggered from an input event handler (context menu of a node) Due to bug #478408 the anchor mechanism is broken in 0.2.0 for Java 8u40 or newer. Therefore, you will have to update to the current version in order to fix your problems. In our tests we also performed the changes from within an input event handler. With the fix for the CME applied, the changes are working just fine. Therefore, I resolve this ticket as fixed for 3.11.0M5. Feel free to reopen this ticket if necessary. |
Created attachment 259355 [details] resized image, edge points nowhere, clicked in graph (right image) When nodes and edges are added to a graph after it was first displayed (at least on windows, when there is only one node to add) sometimes the edges won't get displayed. The workaround is, to add the nodes first and the edges later like this: graph.getNodes().addAll(nodesToAdd); Runnable evilHack = () -> { graph.getEdges().addAll(edgesToAdd); }; Platform.runLater(evilHack); Similarly on Linux hiding nodes won't update the graph, unless the following workaround is used: graph.getEdges().removeAll(removedEdges); Runnable evilHack = () -> { if (!nodesToRemove.isEmpty()) { graph.getNodes().removeAll(nodesToRemove); } }; Platform.runLater(evilHack); For what it's worth to inject the custom node content part factory the following snippet is used: public static class CustomModule extends ZestFxModule { @Override protected void bindIContentPartFactory() { binder().bind(IFXCanvasFactory.class).toInstance(new IFXCanvasFactory() { @Override public FXCanvas createCanvas(Composite parent) { return new FXCanvasEx(parent, SWT.NONE); } }); binder().bind(new TypeLiteral<IContentPartFactory<Node>>() { }).to(CustomContentPartFactory.class) .in(AdaptableScopes.typed(FXViewer.class)); } } Additionally, after removing nodes and adding them again, when moving a node, the edge may not follow - see attached images.