Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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))
icon5.gif  [ZEST] render Composite/Nested nodes using Zest [message #1748797] Mon, 28 November 2016 18:17 Go to next message
Bob Bobson is currently offline Bob BobsonFriend
Messages: 13
Registered: April 2016
Junior Member
Hi GEF community,

I have been tasked with implementing a visualizer for UML State Machines in an eclipse RCP 4 application. I identified GEF4 + Zest as looking like the most appropriate technology platform.

Initially it seemed like it would be an easy solution. State machines are directed graphs with states represented by nodes and transitions are edges.

However UML has the concept of a composite state which contains one or more sub states. This is really a way of grouping related states together in the diagram. Its not clear to me how this idea can be rendered using GEF/Zest?

I know you can assign a top level node a sub graph in zest. However, this seems to be rendered as a single node that opens the sub graph when clicked. Where as we would need sub nodes to be visible in the top level graph (grouped in a container that represents the parent composite node). Also, AFAIK at the moment, you don't seem to be able to have edges that connect nodes in the top level graph with those in the sub graph.

Any help people could provide with how to render this with GEF4/Zest would be greatly appreciated Smile

Thanks in advance for your time,

Bob
Re: [ZEST] render Composite/Nested nodes using Zest [message #1749070 is a reply to message #1748797] Thu, 01 December 2016 14:54 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 163
Registered: March 2015
Senior Member
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 Go to previous messageGo to next message
Bob Bobson is currently offline Bob BobsonFriend
Messages: 13
Registered: April 2016
Junior Member
Hi Matthias,

Thanks for your reply Smile

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 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 163
Registered: March 2015
Senior Member
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 Wink

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
Previous Topic:[Zest] Suppress multi-selection on the canvas
Next Topic:Where are the arrow heads?
Goto Forum:
  


Current Time: Wed Sep 19 10:33:44 GMT 2018

Powered by FUDForum. Page generated in 0.01999 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top