Wednesday, January 18, 2012

Discovery Diagrams for the Generic Graphical View

If you've read my previous posts or seen my presentation at EclipseCon Europe 2011, you'll already know the Generic Graphical View framework: Using two Xtext-based DSLs - one for mapping semantic to graphical elements and the other for styling the figures - you can easily create nice looking diagrams for any Java based model.

In its first version the contents of the diagram was entirely defined in the mapping DSL. It was only possible to restrict the visible elements to a subset of the model by adding filtering expressions in the mapping. For bigger models it was hard to focus on a subset that is not structural defined but based on semantics, e.g. all classes that deal with addresses in a CRM application.

Many graphical frameworks handle the selection of the visible elements in a diagram by means of dialogs. The user is then forced to switch between keyboard and mouse which is annoying, and these dialogs are often complicated and unintuitive. The goal for the Generic Graph View project was to build a UI for choosing the diagram contents that uses the mouse or trackpad only and avoid dialogs at all cost. The following screencast demonstrates the basic functionality.

As a first step, actions were introduced that allow to hide existing graphical elements - nodes, labels or connections. If you hover over an element, you'll get an popup button allowing to remove it from the view. So you can start with a big diagram and strip it down to what you want to see. Once an element inside a node has been removed, you can restore the node completely using another popup button. You can define elements as initially hidden using a hidden flag in the mapping definition.

In addition to the subtractive approach, you can step by step extend the diagram contents from an initial node. If you're hovering over a node that has hidden connection, several + buttons will popup. When one of these buttons is triggered, the hidden elements and connections will appear in transparent arranged in a circle around the source element. In the same drag operation you can change the distance and the angle of that circle. This behavior will get really cool with multitouch gestures, which I will cover in a separate post.


Markus Voelter said...

Very nice!!

Denis said...

Hi Jan, really great stuff!
I saw at Github, you re-built this with Xtext 2.4.3.
Do you plan to make a release for GGV in the next time?

BTW, is there a more detailed explanation on how to use it?

May hope is, you will present it again on the next XtextCon in May? ... I will attend.

Jan Köhnlein said...

@Denis: Thanks. Unfortunately, I haven't found the time lately to upgrade to 2.5.x. But that doesn't mean it's not going to happen :-)

Given the pain it was to teach GEF about new behavior (e.g. the MT gestures or the nodes that don't disappear during move) I have given JavaFX a try and the results look very promising. If you want to watch it at EclipseCon France 2014, you might want to comment on

Jan Köhnlein said...

It's upgraded to Xtext 2.5.4 now.

Denis said...

Great! Thanks.