Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This may seem complicated, and it is, but the good news is that the vast majority of developers will not need to dig that deep into the layout configuration infrastructure. There are easier ways to specify configurations, as described in the following section.

Programmatically Setting Layout Options
Anchor
programmatic-config
programmatic-config

So with all these layout configurators available, how do you actually go about setting values for layout options programmatically? Well, as always: it depends.

...

A further use of diagram types is for the selection of layout algorithms: a layout algorithm may declare that is is especially suited to process diagrams of certain type t. If the diagram type t is assigned to a diagram viewer, the most suitable layout algorithm is chosen automatically for that viewer.

semanticConfig

semanticConfig element registers a subclass of SemanticLayoutConfig:

Code Block
languagexml
      <semanticOption
            class="de.cau.cs.kieler.synccharts.Scope"
            config="de.cau.cs.kieler.synccharts.diagram.custom.AnnotationsLayoutConfig">
      </semanticOption>

Similarly to staticConfig entries, the class attribute refers to which model elements the configuration is applied. However, only domain model (a.k.a. semantic model) classes may be referenced. The config attribute names a concrete implementation of the semantic layout configurator.

The advantage of this kind of configuration compared to staticConfig declarations is that it may perform arbitrary analyses of the domain model. For instance, different option values may be computed depending on certain properties of the domain model elements. This approach can be used to enable annotations of domain model elements. When the domain model is stored with a textual format, e.g. defined with Xtext, such annotations can be written in the source file that specifies the model:

Code Block
@portConstraints FIXED_SIDE
@minWidth 20.0
@minHeight 15.0
entity IdentityActor
{
    @portSide WEST
    port Input;
    
    @portSide EAST
    port Output;
}

The source file annotations can be translated to KIML layout options with a semantic layout configurator, which is registered to each domain model class where annotations can occur.