Page History
...
This tells KIML that the defined layout algorithm supports the border spacing option. And even more, it overrides the default value declared by the layout option and sets it to 20.
The Layout
...
Option Manager
By now, we have an idea of what layout options do and why they are important in the first place. However, we haven't looked at how layout options end up on KGraph elements yet. This is where the LayoutOptionsManager
LayoutOptionManager
comes in.
After a diagram layout manager has finished turning a given diagram into its KGraph representation, the layout options option manager is asked to enrich the KGraph elements with layout options. The option values can come from different sources: the user might have set some using the layout view; there might be some defaults for certain kinds of diagrams; or the programmer might have decided to attach some layout options to certain elements for just this one layout run. Whatever the source, the options manager is in charge of collecting all these layout option values and making sure they find their way to the correct KGraph element. To start off with a clean plate, it first makes sure there are no layout options attached to the KGraph elements. It then does two things: collect every eligible source of layout options, and transfer values of layout options to the associated KGraph elements. Sounds easy enough.
...
So with all these layout configurators available, how do you actually go about setting values for layout options programmatically? Well, as always: it depends.
...
title | ToDo |
---|
...
Using the Extension Point
The recommended way to configure your layout is to use the layoutConfigs
extension point. It offers three different kinds of configurations, explained in the following.
staticConfig
A staticConfig
element can set one value for one layout option in the context of a particular diagram element type. Let's see an example:
Code Block | ||
---|---|---|
| ||
<staticConfig
class="org.eclipse.emf.ecore.EReference"
option="de.cau.cs.kieler.edgeType"
value="ASSOCIATION">
</staticConfig> |
Here class
refers to a domain model class, in this case the EReference
class from the Ecore meta model defined by EMF, and option
refers to a layout option through its identifier. The meaning of this declaration is that whenever automatic layout is requested for an Ecore class diagram, the edgeType
option is set to ASSOCIATION
for all edges linked to instances of EReference
. Since the domain model (abstract syntax) is independent of the specific diagram viewer (concrete syntax), this configuration is applied to all diagram viewers that use the Ecore meta model.