Home » Eclipse Projects » GEF » [ZEST] render Composite/Nested nodes using Zest(Help drawing UML state machine using with GEF4/zest (particularly the concept of composite states))
|
Re: [ZEST] render Composite/Nested nodes using Zest [message #1749070 is a reply to message #1748797] |
Thu, 01 December 2016 14:54 |
|
Hi Bob,
as you already figured out, within Zest you can navigate to nested graphs. Additionally, you can zoom into a nesting node and its nested graph will be rendered within the node at some point. So rendering of nested graphs is already possible. However, if the nested elements should always be rendered, independent from the zoom level, you would need to overwrite GraphPart#doGetContentchildren() accordingly.
Moreover, you should be able to connect nodes on different levels using edges in the "outer" graph, even though this is not explicitly supported. However, the Z-ordering might be unfortunate, i.e. edges being rendered behind nodes, so that they are only partially visible. If you encounter this problem, you should be able to fix it by changing the order in which nodes and edges are returned within GraphPart#doGetContentChildren().
Besides, there is a "cluster subgraph" concept within Graphviz which should be supported by GEF Zest. However, we did not implement it, yet [1]. Graphviz supports grouping of nodes to so-called subgraphs. If a subgraph name starts with "cluster", a container will be rendered around its grouped nodes, the inner nodes will be laid out separately, and the whole subgraph will be included as a unit within the graph.
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=469469
Best regards,
Matthias
|
|
|
Re: [ZEST] render Composite/Nested nodes using Zest [message #1749315 is a reply to message #1749070] |
Mon, 05 December 2016 11:53 |
Bob Bobson Messages: 13 Registered: April 2016 |
Junior Member |
|
|
Hi Matthias,
Thanks for your reply
To deal with your last point first. I am familiar with graphviz, and its cluster concept is exactly the sort of functionality I'm looking for. I would therefore be very interested in similar functionality being added to zest. Unfortunately it doesn't look like there is much activity around the referenced issue, so i assume this features is not planned for implementation soon?
In my digging i have also come across the ELK Project, which does seem to handle hierarchical graph layout. And there seems to be a move to integrate it into Zest (https://bugs.eclipse.org/bugs/show_bug.cgi?id=440098). So that may be another option, but again its not clear what time scale that will happen on.
The alternative is for me to try an implement this myself. I have been doing some digging based on your suggestion of overriding doGetContentchildren, but i fear my lack of knowledge with Zest is a problem.
Currently "doGetContentchildren" returns the contents of the top level "content" graph. Simply changing it to return sub nodes causes them to be rendered but they are not layed out.
So an outline of the approach would be:
Have "doGetContentchildren" return all sub nodes + edges.
Implement a custom layout algorithm that laysout all the nodes in the sub graphs.
This seems plausible to me. However, I'm worried it pushes beyond how zest currently works. Will the rest of zest, particularly the rendering and MVC code, handle this gracefully?
Thanks,
Bob
|
|
|
Re: [ZEST] render Composite/Nested nodes using Zest [message #1749413 is a reply to message #1749315] |
Tue, 06 December 2016 13:15 |
|
Hi Bob,
I was wrong about GraphPart#doGetContentChildren(). The relevant code is at NodePart#doGetContentChildren() where the nested graph is returned as a content child only if the zoom level is within some range. In order to render nested graphs at all times, you only need to remove the zoom-level check. (I thought this check was within GraphPart#doGetContentChildren(), and should have looked it up
Moreover, you should replace the binding for SemanticZoomPolicy with a binding for the default FXChangeViewportPolicy, so that the contents are not replaced with a nested graph at certain zoom levels.
For rendering edges between outer and inner graphs, I would have these edges be reported as content children by the outer GraphPart after the nodes (this should already be the case). So if the "root" Graph has edges that connect nodes on different levels, that should work out-of-the-box.
You can make use of ELK with Zest by implementing a LayoutAlgorithm that constructs a KGraph from the layout model, delegates to some ELK algorithm for computing the layout, and applies the layout back to the layout model.
We are currently working on other issues:
- Implement Dot IDs for XML content (HTML-like labels)
- Implement attribute grammar for HTML-like labels
- Perform layout passes in a background thread
But for Oxygen we have planned to work out how clusters in the Graphviz sense can be implemented in Zest.
Best regards,
Matthias
|
|
|
Goto Forum:
Current Time: Tue Oct 08 21:36:48 GMT 2024
Powered by FUDForum. Page generated in 0.03530 seconds
|