KIELER Generic Autolayout

If you build a graphical editor with Graphiti normally you have to do the layout by your own. But you can use KIELER (The Kiel Integrated Environment for Layout). It provides an automatic layout for graphical editors built with Graphiti or GMF.

The following figure shows the class diagram editor, which is one of the shipped Graphiti examples. I just draw four classes and some relationships and as you can see, I intentionally placed them very badly. Now it’s time to use KIELER, just press the marked icon in the Eclipse toolbar or press Ctrl+R, L. You can also use the KIELER menu or the KIELER context menu in the Graphiti editor, but they will be removed in one of the next versions.

Unstructured Class Diagram

Figure 1. Unstructured Class Diagram

The next figure shows the diagram after the diagram is layouted with KIELER. The default values are used. You can e.g. change the Spacing of the diagram to 100.0 and let KIELER layout the diagram again. Therefore click in the editing area to change the
layout properties for the diagram. You can also change the layout properties for EClasses, EReferences and the Connection Decorators.

Class Diagram after layout

Figure 2. Class Diagram after layout

Now you can see the result after another layout with Spacing 100.

Class Diagram after adjusted layout

Figure 3. Class Diagram after adjusted layout

Take your time to discover all the properties of the different Layout Algorithms. It’s
very interesting to see the different Layout Algorithms in action!

Select Layout Dialog

Figure 4. Select Layout Dialog

Many thanks to the KIELER team, great work!

In a future article I will describe how to use KIELER for containment hierachies and
how to use KIELER programmatically to layout more complicated diagrams.

Be aware that KIELER is mostly EPL and the OGDF layout is under GPL. But it’s in an optional feature and can be omitted when using KIELER in your product.

I used the following versions:

Plugin Version
KIELER Layout for Graphiti
Graphiti Tools (Incubation) 0.9.1.v20120919-0732
Eclipse SDK 3.8.1.M20120914-1540

Table 1. Plugin version info

Die Kommentarfunktion ist geschlossen.