# Wiki source code of Infrastructure for Meta Layout (KIML)

Last modified by Richard Kreissig on 2023/09/14 10:13
Export
Office Formats
Export as PDF Export as ODT Export as RTF
Other Formats

Select the pages to export:

select all/ none

Legend:
  Created Page
  Modified Extension Page
  Clean Extension Page

Export as HTML

Show last authors

author | version | line-number | content
--- | --- | --- | ---
|  | 1 | {{warning}}
|  | 2 | KIML has been discontinued and is replaced by the [[Eclipse Layout Kernel (ELK)>>url:http://www.eclipse.org/elk/||shape="rect"]].
|  | 3 | {{/warning}}
|  | 4 |
|  | 5 | Project Overview
|  | 6 |
|  | 7 | Related Publications:
|  | 8 |
|  | 9 | * Miro Spönemann, Hauke Fuhrmann, and Reinhard von Hanxleden. //Automatic Layout of Data Flow Diagrams in KIELER and Ptolemy II//. Technical Report 0914, Christian-Albrechts-Universität zu Kiel, Department of Computer Science, 2009. ([[pdf>>url:http://rtsys.informatik.uni-kiel.de/~~biblio/downloads/papers/report-0914.pdf||shape="rect"]] / [[bib>>url:http://rtsys.informatik.uni-kiel.de/~~biblio/cgi-bin/bibcgi.cgi?key=SpoenemannFvH09||shape="rect"]])
|  | 10 | * Hauke Fuhrmann, Miro Spönemann, Michael Matzen, and Reinhard von Hanxleden. Automatic layout and structure-based editing of UML diagrams. In //Proceedings of the 1st Workshop on Model Based Engineering for Embedded Systems Design// (M-BED'10), Dresden, 2010. ([[pdf>>url:http://rtsys.informatik.uni-kiel.de/~~biblio/downloads/papers/mbed10.pdf||shape="rect"]] / [[bib>>url:http://rtsys.informatik.uni-kiel.de/~~biblio/cgi-bin/bibcgi.cgi?key=FuhrmannSM+10||shape="rect"]])
|  | 11 | * Christian Schneider, Miro Spönemann, and Reinhard von Hanxleden. Transient view generation in Eclipse. In //Proceedings of the First Workshop on Academics Modeling with Eclipse//, Kgs. Lyngby, Denmark, 2012. ([[pdf>>url:http://rtsys.informatik.uni-kiel.de/~~biblio/downloads/papers/acme12.pdf||shape="rect"]] / [[bib>>url:http://rtsys.informatik.uni-kiel.de/~~biblio/cgi-bin/bibcgi.cgi?key=SchneiderSvH12a||shape="rect"]])
|  | 12 | * Miro Spönemann, Christoph Daniel Schulze, Christian Motika, Christian Schneider, and Reinhard von Hanxleden. KIELER: Building on Automatic Layout for Pragmatics-Aware Modeling (Showpiece). In //Proceedings of the IEEE Symposium on Visual Languages and Human-Centric Computing// (VL/HCC’13), San Jose, CA, USA, 15–19 September 2013. ([[pdf>>url:http://rtsys.informatik.uni-kiel.de/~~biblio/downloads/papers/vlhcc13-showpiece.pdf||shape="rect"]] / [[bib>>url:http://rtsys.informatik.uni-kiel.de/~~biblio/cgi-bin/bibcgi.cgi?key=SpoenemannSM+13||shape="rect"]])
|  | 13 |
|  | 14 | Related Theses:
|  | 15 |
|  | 16 | * Björn Duderstadt, //Evolutionary Meta Layout for KIELER//, May 2011 ([[pdf>>url:http://rtsys.informatik.uni-kiel.de/~~biblio/downloads/theses/bdu-st.pdf||shape="rect" class="extTarget"]])
|  | 17 |
|  | 18 |
|  | 19 | ===== Contents =====
|  | 20 |
|  | 21 |
|  | 22 |
|  | 23 | {{toc maxLevel="2"/}}
|  | 24 |
|  | 25 | = Getting Started =
|  | 26 |
|  | 27 | This subproject deals with the automatic layout of graph-based models. KIML offers interfaces to connect layout algorithms to diagram editors and viewers. The focus is on flexible configurability, which is a crucial issue for creating good layouts for different graphical languages and in different circumstances. The term //meta layout// relates to the idea of specifying the layout of a diagram on an abstract level, while //concrete layout// information is computed by layout algorithms.
|  | 28 |
|  | 29 | In order to use KIML with your own GMF-based editor, you need to do the following steps:
|  | 30 |
|  | 31 | 1. Install the "//KIELER Layout for GMF//" feature from our update site, see [[Downloads>>url:http://www.rtsys.informatik.uni-kiel.de/en/research/kieler/||shape="rect"]]
|  | 32 | 1*. It includes the Java-based layout algorithms developed in the [[KLay project>>doc:KIELER.Discontinued Projects.Layout Algorithms (KLay).WebHome]].
|  | 33 | 1. Open a diagram and press the layout button [[image:attach:kieler-arrange.gif]] or use the shortcut Ctrl+R L.
|  | 34 |
|  | 35 | Similarly, the "//KIELER Layout for Graphiti//" feature provides the KIML interface to Graphiti-based editors.
|  | 36 |
|  | 37 | == Terminology ==
|  | 38 |
|  | 39 | //**Layout Graph**//
|  | 40 |
|  | 41 | * Internal representation of the graph structure of the current diagram, built on the [[KGraph>>doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).KGraph Meta Model.WebHome]] model.
|  | 42 |
|  | 43 | **//Layout Algorithm//**
|  | 44 |
|  | 45 | * An algorithm that takes a layout graph as input and computes positions for all elements of the graph.
|  | 46 |
|  | 47 | **//Layout Provider//**
|  | 48 |
|  | 49 | * A component that provides one or more layout algorithms to KIML.
|  | 50 |
|  | 51 | **//Layout Option//**
|  | 52 |
|  | 53 | * A customization point for layout algorithms, with a specific data type and optionally a default value.
|  | 54 |
|  | 55 | **//Layout Configurator//**
|  | 56 |
|  | 57 | * A component that is responsible for retrieving specific layout option values for model elements.
|  | 58 |
|  | 59 | **//Layout Data//**
|  | 60 |
|  | 61 | * Concrete layout data (position and size) and abstract layout data (layout options) attached to elements of the layout graph using the [[KLayoutData>>doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).KLayoutData Meta Model.WebHome]] model.
|  | 62 |
|  | 63 | //**Layout Meta Data**//
|  | 64 |
|  | 65 | * Meta information on layout algorithms, layout options, etc. gathered through extension points.
|  | 66 |
|  | 67 | //**Meta Layout**//
|  | 68 |
|  | 69 | * The process of creating abstract layout data (configuration of layout options) through layout configurators. In a more general sense, also used for the whole layout infrastructure.
|  | 70 |
|  | 71 | **//Layout Type//**
|  | 72 |
|  | 73 | * Classification of layout algorithms depending on their basic approach (e.g. layered, force, etc.).
|  | 74 |
|  | 75 | **//Diagram Type//**
|  | 76 |
|  | 77 | * Classification of graphical diagrams used to set default layout option values for all diagrams of a specific type (e.g. state machines, data flow diagrams, etc.).
|  | 78 |
|  | 79 | **//Diagram Layout Manager//**
|  | 80 |
|  | 81 | * The central interface for connecting diagram editors with layout algorithms.
|  | 82 |
|  | 83 | //**Diagram Layout Engine**//
|  | 84 |
|  | 85 | * A singleton class for invoking layout algorithms on diagram viewers and editors.
|  | 86 |
|  | 87 | = User Interface =
|  | 88 |
|  | 89 | The main user interface element of KIML is the command to layout the current diagram. This command is available in the toolbar ([[image:attach:kieler-arrange.gif]]) or using the Ctrl+R L shortcut. Additionally, an entry in the context menu allows to layout only a selected part of the diagram.
|  | 90 |
|  | 91 | == Layout View ==
|  | 92 |
|  | 93 | [[image:attach:layout_view.png]]
|  | 94 |
|  | 95 | The //Layout// view allows flexible customization of layout options for the selected objects in the diagram. If no object is selected, the view shows the options for the top-level container of the diagram. Options are stored persistently in the notation model of the diagram, so that they are still available after the next Eclipse restart. Of course this requires the diagram to be saved after an option was changed.
|  | 96 |
|  | 97 | The options can be grouped according to the function of the selected object. The groups //Node,// //Edge//, //Port//, and //Label// contain options related to the object itself, such as its size or priority, while the groups //Graph// and// Subgraph// contain options for the elements contained in the selected object, such as the applied layout algorithm or the spacing between elements. Which layout options are displayed depends on the types of selected objects and the active layout algorithm, since each algorithm supports only a subset of the available options. Furthermore, some options are only visible if the //Show Advanced Properties// button in the view toolbar is activated. The group types can be hidden using the //Show Categories// button.
|  | 98 |
|  | 99 | An option can be changed by selecting or entering a new value in the corresponding cell of the //Value// column. The most important option is //Layout Algorithm//, which is used to determine the layout algorithm for the contents of the selected element. Here either a specific layout algorithm or a layout type can be chosen; in the latter case, the most suitable layout algorithm of the given type is taken. By changing the active layout algorithm, the content of the layout view is updated to display only those options that are supported by the new layout algorithm.
|  | 100 |
|  | 101 | Selecting //Restore Default Value// in the context menu or the view toolbar removes any value for the currently selected option that is stored in the current model file, thus resetting the option to its default value. The view menu has an entry //Remove all Layout Options// which resets all options of the current model by removing persistent data in the model file.
|  | 102 |
|  | 103 | The standard layout options defined in KIML are documented in [[doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).KIML Layout Options.WebHome]]. However, layout algorithms may define additional layout options.
|  | 104 |
|  | 105 | [[image:attach:context_menu.png]]
|  | 106 |
|  | 107 | The context menu for a specific layout option has different alternatives to set the currently active value as default value: //Set as Default for this Diagram// changes the open model file so that the same value is applied to all similar objects of that model. //Set as Default for ... in this Context// applies the value to all similar objects that are displayed with the same diagram editor (the option is linked to the //edit part// class of the selected object). Choosing //Set as Default for all ...// links the option value with the domain model element or diagram type of the selected object (see the context menu depicted above). These four alternatives have different priorities: if present, the default value for the current diagram is taken first, then the default value for the edit part is checked, then the default value for the domain model element, and then the default value for the diagram type.
|  | 108 |
|  | 109 | The information button of the view toolbar can be used to display some useful details on the current selection, such as the edit part and domain model classes.
|  | 110 |
|  | 111 | == Preference Page ==
|  | 112 |
|  | 113 | [[image:attach:preference_page.png]]
|  | 114 |
|  | 115 | //Animate layout// enables animation of the transition of the old layout to the new layout whenever the layout is recomputed.
|  | 116 |
|  | 117 | Automatic zooming can be enabled with //Zoom to fit after layout//.
|  | 118 |
|  | 119 | If //Show layout progress// is active, a progress dialog is shown during the computation of layouts.
|  | 120 |
|  | 121 | If //Oblique edge routing// is active, all routing styles and smoothness settings of edges are removed when automatic layout is performed on GMF editors. Since most layouters compute the routing of edges as part of their algorithm, these styles usually do not yield the expected results.
|  | 122 |
|  | 123 | The option //Debug graph output// is used for debugging, as the name suggests. It writes the layout graph of each layout computation to a file in the current user's home directory.
|  | 124 |
|  | 125 | The //Default Layout Option Values// table is used to manage the default setting for layout options, which can also be modified with the context menu of the layout view (see above). All user-defined settings are displayed here, and the buttons on the right of the table serve to create, edit, and remove entries. The //Type// column shows the type of element the option is linked with: either //Diagram Part//, //Model Element//, or //Diagram Type//. The //Element// column shows the class name for options that relate to diagram parts (i.e. edit parts) or domain model elements, and the diagram type name for options that relate to diagram types. //Option// is the name of the layout option, and //Value// is the currently set value of the option.
|  | 126 |
|  | 127 | Creating a new entry requires the selection of the type of related element and entering its class name or identifier. Class names of diagram parts and domain model elements can be explored using the information button of the layout view, while diagram type identifiers can be selected with the //Browse// button. After that, a layout option has to be selected from the list using the corresponding //Browse //button. Hitting //OK// creates an entry, and its value can then be set using the //Edit// button.
|  | 128 |
|  | 129 | = Programming Interface =
|  | 130 |
|  | 131 | The primary API of KIML is the [[DiagramLayoutEngine>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml.service/src/de/cau/cs/kieler/kiml/service/DiagramLayoutEngine.java||shape="rect"]], which is responsible for analyzing diagrams, creating a [[KGraph>>doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).KGraph Meta Model.WebHome]] structure, configuring and executing the layout algorithms, and writing new position information back to the diagram. It is invoked with
|  | 132 |
|  | 133 | {{code language="java" theme="Eclipse"}}
|  | 134 | DiagramLayoutEngine.INSTANCE.layout(workbenchPart, diagramPart)
|  | 135 | {{/code}}
|  | 136 |
|  | 137 | where {{code language="none"}}workbenchPart{{/code}} is the Eclipse editor part or view part whose content shall be processed, and {{code language="none"}}diagramPart{{/code}} is a further reference to which part of the diagram the layout shall be applied (may be {{code language="none"}}null{{/code}}).
|  | 138 |
|  | 139 | An overview of the internal structure of KIML is given in the following.
|  | 140 |
|  | 141 | [[~[~[image:attach:kiml-overview.png~]~]>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/files/documentation/kiml-structure.png||shape="rect" style="text-decoration: none;"]]
|  | 142 |
|  | 143 | The interaction with the diagram editor or viewer is handled by //layout managers//, represented by [[IDiagramLayoutManager>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml.service/src/de/cau/cs/kieler/kiml/service/IDiagramLayoutManager.java||shape="rect"]] implementations, explained with more detail below.
|  | 144 |
|  | 145 | The configuration of automatic layout is done by the [[LayoutOptionManager>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml.service/src/de/cau/cs/kieler/kiml/service/LayoutOptionManager.java||shape="rect"]], which iterates over all graph elements and applies a set of layout configurators, represented by the interface [[ILayoutConfig>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/config/ILayoutConfig.java||shape="rect"]]. Layout configurators analyze the context of each graph element and set specific values for some layout options. More information on layout configuration is available on [[doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).Configuring Automatic Layout.WebHome]].
|  | 146 |
|  | 147 | Hierarchically structured graphs are handled by the [[RecursiveGraphLayoutEngine>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/RecursiveGraphLayoutEngine.java||shape="rect"]], which executes layout algorithms separately on each hierarchy level, starting with the innermost levels. The actual layout computations are performed by subclasses of [[AbstractLayoutProvider>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/AbstractLayoutProvider.java||shape="rect"]], which are registered with the {{code language="none"}}layoutProviders{{/code}} extension point.
|  | 148 |
|  | 149 | The singleton class [[LayoutMetaDataService>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/LayoutMetaDataService.java||shape="rect"]] is used to access the available layout algorithms, layout options, diagram types, layout types, and stored option values. Similarly, there are other service classes for accessing the meta data managed by KIML. Meta data are stored in XML format according to the extension points mechanism of Eclipse.
|  | 150 |
|  | 151 | KIML makes extensive use of the [[IPropertyHolder>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.core/src/de/cau/cs/kieler/core/properties/IPropertyHolder.java||shape="rect"]] interface; a //property holder// is an object that can give and receive values for specific properties. The key for specifying which property to access is [[IProperty>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.core/src/de/cau/cs/kieler/core/properties/IProperty.java||shape="rect"]], which is usually instanced exactly once for each property. The layout data classes [[KShapeLayout>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/klayoutdata/KShapeLayout.java||shape="rect"]] and [[KEdgeLayout>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/klayoutdata/KEdgeLayout.java||shape="rect"]] are property holders, which means that they can store layout option values for the graph elements they are connected with.
|  | 152 |
|  | 153 | == Connecting Layout Algorithms ==
|  | 154 |
|  | 155 | Layout algorithms must be connected by extending [[AbstractLayoutProvider>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/AbstractLayoutProvider.java||shape="rect"]]. The input of [[t>>url:http://trac.rtsys.informatik.uni-kiel.de/trac/kieler/wiki/Projects/AbstractLayoutProvider||rel="nofollow" shape="rect" style="text-decoration: none;" class="missing wiki"]]he {{code language="none"}}doLayout{{/code}} method is an instance of the [[KGraph>>doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).KGraph Meta Model.WebHome]], an [[EMF>>url:http://www.eclipse.org/modeling/emf/||shape="rect"]] based graph structure, together with a progress monitor ([[IKielerProgressMonitor>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.core/src/de/cau/cs/kieler/core/alg/IKielerProgressMonitor.java||shape="rect"]]). The graph is represented by a [[KNode>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.core.kgraph/src/de/cau/cs/kieler/core/kgraph/KNode.java||shape="rect"]], which serves as top-level container. The contained graph elements initially have attached [[KShapeLayout>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/klayoutdata/KShapeLayout.java||shape="rect"]] or [[KEdgeLayout>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/klayoutdata/KEdgeLayout.java||shape="rect"]] with information on the original layout of the diagram as well as an abstract layout specified by layout options. The layout provider should consider layout options from the attached layout data, execute a layout algorithm, and write the concrete results back to the layout data. A good example for a layout provider implementation is [[LayeredLayoutProvider>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.klay.layered/src/de/cau/cs/kieler/klay/layered/LayeredLayoutProvider.java||shape="rect"]].
|  | 156 |
|  | 157 | The {{code language="none"}}layoutProviders{{/code}} extension point is needed to register layout algorithms; one layout provider class may provide multiple layout algorithms by giving a parameter string in the extension point. The extension point allows to attach information on known layout options, supported diagram types, and supported graph features to a layout algorithm. The known layout options are those that are offered in the Layout view when the respective algorithm is selected. The supported diagram types are used to automatically select the most suitable algorithm for a specific diagram type: from all algorithms that state to support a given type, the one with the highest priority is taken. The supported graph features are used to state which special features that a graph can contain can be handled by the algorithm; examples for such features are edge labels, ports, or clusters. Furthermore, the extension point can be used to specify new layout options, layout types, and categories of layout algorithms.
|  | 158 |
|  | 159 | Each layout option that is registered in the extension point needs a corresponding constant in Java code, where the most relevant data is replicated with a [[Property>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.core/src/de/cau/cs/kieler/core/properties/Property.java||shape="rect"]] constant for easy use in the implementation of layout algorithms. KIML comes with a large set of [[built-in layout options>>doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).KIML Layout Options.WebHome]], which are all defined in [[LayoutOptions>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/options/LayoutOptions.java||shape="rect"]]. Layout providers can access the layout option values using the [[IPropertyHolder>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.core/src/de/cau/cs/kieler/core/properties/IPropertyHolder.java||shape="rect"]] interface:
|  | 160 |
|  | 161 | {{code language="java" theme="Eclipse"}}
|  | 162 | KShapeLayout nodeLayout = parentNode.getData(KShapeLayout.class);
|  | 163 | boolean isInteractive = nodeLayout.getProperty(LayoutOptions.INTERACTIVE);
|  | 164 | {{/code}}
|  | 165 |
|  | 166 |
|  | 167 | The layout option that is used in this example has a default value, thus it is guaranteed that the option always returns a valid value. This and the fact that properties are type-safe allows us to implicitly cast and unbox the returned value to a {{code language="none"}}boolean{{/code}} without checking for NullPointerExceptions or ClassCastExceptions.
|  | 168 |
|  | 169 | == Connecting Diagram Editors ==
|  | 170 |
|  | 171 | (% style="line-height:1.4285715" %)The transformation of input diagrams to [[KGraph>>doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).KGraph Meta Model.WebHome]] instances as well as the transfer of computed layouts back to the input diagrams is done by (%%)[[IDiagramLayoutManager>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler/plugins/de.cau.cs.kieler.kiml.ui/src/de/cau/cs/kieler/kiml/ui/diagram/IDiagramLayoutManager.java||shape="rect" style="line-height: 1.4285715;"]](% style="line-height:1.4285715" %) implementations. For most diagram editors that are based on (%%)[[GMF>>url:http://www.eclipse.org/modeling/gmp/||shape="rect" style="line-height: 1.4285715;"]](% style="line-height:1.4285715" %) the generic (%%)[[GmfDiagramLayoutManager>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml.gmf/src/de/cau/cs/kieler/kiml/gmf/GmfDiagramLayoutManager.java||shape="rect"]](% style="line-height:1.4285715" %) can be used, while for (%%)[[Graphiti>>url:http://www.eclipse.org/graphiti/||shape="rect" style="line-height: 1.4285715;"]](% style="line-height:1.4285715" %) there is the generic (%%)[[GraphitiDiagramLayoutManager>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml.graphiti/src/de/cau/cs/kieler/kiml/graphiti/GraphitiDiagramLayoutManager.java||shape="rect"]](% style="line-height:1.4285715" %). However, some customized diagram editors do not work with the generic diagram layout managers and hence require their own specialized implementations, which can be contributed with the extension point {{code language="none"}}layoutManagers{{/code}}.
|  | 172 |
|  | 173 | (% style="line-height:1.4285715" %)The diagram layout manager implementation that is applicable to the currently selected diagram viewer is chosen based on the {{code language="none"}}supports(Object){{/code}} method: the first implementation that returns {{code language="none"}}true{{/code}} for the respective workbench part instance is selected. Implementations can be assigned a priority in the extension;(%%) diagram layout managers with higher priority are queried first. The object passed to supports(Object){{code language="none"}}{{/code}} can also be an element of the selection. For example, GEF-based editors report edit part instances to the Eclipse selection service. Which diagram layout manager to use for a selected edit part is determined by testing which implementation supports that edit part instance.
|  | 174 |
|  | 175 | Each diagram layout manager must be able to map the graph structure of its supported diagram viewers to the [[KGraph>>doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).KGraph Meta Model.WebHome]] format using the {{code language="none"}}buildLayoutGraph({{/code}}…{{code language="none"}}){{/code}} method. The result is stored in a [[LayoutMapping>>url:http://rtsys.informatik.uni-kiel.de/fisheye/browse/kieler-pragmatics/plugins/de.cau.cs.kieler.kiml.service/src/de/cau/cs/kieler/kiml/service/LayoutMapping.java||shape="rect"]], which stores a bidirectional map between graph elements and diagram elements and can be enriched with additional information. Such information is often required when the new computed layout is applied back to the diagram, which is done with {{code language="none"}}applyLayout({{/code}}…{{code language="none"}}){{/code}}. This method is also responsible for applying animation of the transition between the old layout and the new layout and for automatic zooming, if requested.
|  | 176 |
|  | 177 | (% style="line-height:1.4285715" %)There are many ways to customize the configuration of graphs created by layout managers. These are documented in [[doc:KIELER.Discontinued Projects.Infrastructure for Meta Layout (KIML).Configuring Automatic Layout.WebHome]].

# Quick Links

KIELER on GitHub
RTSYS Homepage

XWiki 14.4.7