Last modified by Alexander Schulz-Rosengarten on 2023/07/11 10:33

From version 12.1
edited by cds
on 2013/09/16 16:56
Change comment: There is no comment for this version
To version 7.1
edited by cds
on 2013/09/12 11:41
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -5,7 +5,6 @@
5 5  This page describes how automatic layout can be configured for a given application. This includes how layout options can be set on graph elements, and how they are applied by KIML during the layout process. After having read this, you should be able to answer the following questions:
6 6  
7 7  * What are //layout options//?
8 -* How do layout algorithms support layout options?
9 9  * How do layout options end up in KGraph elements?
10 10  * How can I set layout options on elements programmatically?
11 11  
... ... @@ -81,7 +81,7 @@
81 81  (% style="line-height: 1.4285715;" %)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 [[{{code language="none"}}LayoutOptionsManager{{/code}}>>url:http://git.rtsys.informatik.uni-kiel.de/projects/KIELER/repos/pragmatics/browse/plugins/de.cau.cs.kieler.kiml.ui/src/de/cau/cs/kieler/kiml/ui/service/LayoutOptionManager.java||shape="rect"]] comes in.
82 82  
83 83  {{tip}}
84 -The [[KIML page>>doc:Infrastructure for Meta Layout (KIML)]] has a high-level explanation of what happens when during the layout process. To take a look at it if you haven't already – it will make the following concepts easier to understand. Plus, there's a nice picture that took Miro quite some time to create.
83 +The [[KIML page>>doc:Infrastructure for Meta Layout (KIML)]] has a high-level explanation of what happens when during the layout process. To take a look at it if you haven't already – it will make the following concepts easier to understand.
85 85  {{/tip}}
86 86  
87 87  (% style="line-height: 1.4285715;" %)After a layout manager has finished turning a given diagram into its KGraph representation, the layout options 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 layout options to the correct KGraph elements. Sounds easy enough.
... ... @@ -102,42 +102,35 @@
102 102  
103 103  == A Few Details on Layout Configurations ==
104 104  
105 -What we just learned is a bit of a simplification of what happens. Before we look at the details, let's take a look at the methods each layout configuration provides:
104 +What we just learned is a bit of a simplification of what happens. The layout options manager not only asks each layout configuration to provide layout options for each graph element. Before we look at the details, let's take a look at the methods each layout configuration provides:
106 106  
107 107  {{code language="java"}}
108 108  public interface ILayoutConfig {
109 109   int getPriority();
109 +
110 110   void enrich(LayoutContext context);
111 +
111 111   Object getValue(LayoutOptionData<?> optionData, LayoutContext context);
113 +
112 112   void transferValues(KLayoutData layoutData, LayoutContext context);
113 113  } 
114 114  {{/code}}
115 115  
116 -It is not hard to guess what {{code language="none"}}getPriority(){{/code}} does: it returns the priority a given layout configuration has. If two layout configurations set a layout option to different values on a given graph element, the value set by the configuration with higher priority wins. The other three methods look a bit more obscure, so we have to provide more details on what the options manager does, exactly.
118 +It is not hard to guess what {{code language="none"}}getPriority(){{/code}} does: it returns the priority a given layout configuration has. If two layout configurations set a layout option to different values on a given graph element, the value set by the configuration with lower priority gets overwritten. The other three methods look a bit more obscure, so we have to provide more details on what the options manager does, exactly.
117 117  
118 118  ENRICHING (+ WHAT IS A LAYOUT CONTEXT)
119 119  
120 -The {{code language="none"}}transferValues(...){{/code}} method is the main workhorse of the interface. This is where a KGraph element, identified by the given layout context, is equipped with the layout option values a layout configuration deems necessary. It thus becomes the most important part of a layout configuration that you absolutely have to implement, no excuses. If for example every {{code language="none"}}KNode{{/code}} should have its port constraints set to {{code language="none"}}FIXED_POS{{/code}}, this is the place to do it.
122 +TRANSFERRING
121 121  
122 -With all these layout configurations active, it's by no means clear which layout option values KGraph elements will end up with during the layout process. Enter the {{code language="none"}}getValue(...){{/code}} method. For a given element and layout option, it returns the value it would set on the element if {{code language="none"}}transferValues(...){{/code}} was called. This method is mainly used by the Layout view to inform the user about the layout option values of whatever graph element he (or she) has clicked on. It is also the method you can safely neglect to implement if your final product won't include the layout view anyway.
124 +GETVALUE (for the layout view?)
123 123  
124 124  == (% style="line-height: 1.4285715;" %)Implementing a Layout Configuration(%%) ==
125 125  
126 -{{warning title="ToDo"}}
127 -deciding what options are applicable depending on the context object; setting the options;
128 -{{/warning}}
128 +(% style="line-height: 1.4285715;" %)deciding what options are applicable depending on the context object; setting the options;
129 129  
130 -(% style="line-height: 1.4285715;" %)
131 131  
132 -
133 133  = (% style="line-height: 1.4285715;" %)Programmatically Setting Layout Options(%%) =
134 134  
135 -(% style="line-height: 1.4285715;" %)So with all these layout configurations available, how do you actually go about setting layout options programmatically? Well, as always: it depends. Your use case
136 -
137 -
138 -(% style="line-height: 1.4285715;" %)
139 -
140 -
141 141  {{warning title="ToDo"}}
142 142  Write this section. This will be about when to use the different kinds of layout configurations, mainly {{code language="none"}}SemanticLayoutConfig{{/code}} and {{code language="none"}}VolatileLayoutConfig{{/code}}.
143 143  {{/warning}}
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -7701015
1 +7700958
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/7701015/Configuring Automatic Layout
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/7700958/Configuring Automatic Layout