<
From version < 6.1 >
edited by cds
on 2013/09/11 19:29
To version < 10.1 >
edited by cds
on 2013/09/16 16:05
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -Working With Layout Options
1 +Configuring Automatic Layout
Content
... ... @@ -2,11 +2,10 @@
2 2  We haven't finished writing this page yet.
3 3  {{/warning}}
4 4  
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 -This page describes how layout options are applied by KIML during the layout process. After having read this, you should be able to answer the following questions:
8 -
9 9  * What are //layout options//?
8 +* How do layout algorithms support layout options?
10 10  * How do layout options end up in KGraph elements?
11 11  * How can I set layout options on elements programmatically?
12 12  
... ... @@ -82,16 +82,20 @@
82 82  (% 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.
83 83  
84 84  {{tip}}
85 -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.
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.
86 86  {{/tip}}
87 87  
88 88  (% 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.
89 89  
89 +{{note}}
90 +Since the options manager starts by removing all layout options set on graph elements, setting layout options on the graph elements in the layout manager is a futile endeavor.
91 +{{/note}}
92 +
90 90  (% style="line-height: 1.4285715;" %)The question remains how the layout options sources work. Each source is represented by a class that implements the [[{{code language="none"}}ILayoutConfig{{/code}}>>url:https://git.rtsys.informatik.uni-kiel.de/projects/KIELER/repos/pragmatics/browse/plugins/de.cau.cs.kieler.kiml/src/de/cau/cs/kieler/kiml/config/ILayoutConfig.java||shape="rect"]] interface, called a //layout configuration//. KIML currently provides the following layout configurations, each representing a particular source of layout options:
91 91  
92 92  * {{code language="none"}}DefaultLayoutConfig{{/code}} – Sets fixed default values defined for layout options.
93 93  * {{code language="none"}}EclipseLayoutConfig{{/code}} – Users can define default layout options to be set on elements that meet certain criteria via the KIML preference page. This layout configuration takes these options and applies them.
94 -* {{code language="none"}}SemanticLayoutConfig{{/code}} – ???
97 +* {{code language="none"}}SemanticLayoutConfig{{/code}} – **DOCUMENT THIS**
95 95  * {{code language="none"}}GmfLayoutConfig{{/code}} / {{code language="none"}}GraphitiLayoutConfig{{/code}} – These configurations apply layout options set by the user in the layout view or stored in the notation model file of a diagram.
96 96  * {{code language="none"}}VolatileLayoutConfig{{/code}} – A configuration whose only purpose it is to make sure certain layout options are set on certain diagram elements in a particular layout run.
97 97  
... ... @@ -104,28 +104,29 @@
104 104  {{code language="java"}}
105 105  public interface ILayoutConfig {
106 106   int getPriority();
107 -
108 108   void enrich(LayoutContext context);
109 -
110 110   Object getValue(LayoutOptionData<?> optionData, LayoutContext context);
111 -
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 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.
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.
117 117  
118 118  ENRICHING (+ WHAT IS A LAYOUT CONTEXT)
119 119  
120 -TRANSFERRING
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.
121 121  
122 -GETVALUE (for the layout view?)
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.
123 123  
124 124  == (% style="line-height: 1.4285715;" %)Implementing a Layout Configuration(%%) ==
125 125  
126 -(% style="line-height: 1.4285715;" %)deciding what options are applicable depending on the context object; setting the options;
126 +{{warning title="ToDo"}}
127 +deciding what options are applicable depending on the context object; setting the options;
128 +{{/warning}}
127 127  
130 +(% style="line-height: 1.4285715;" %)
128 128  
132 +
129 129  = (% style="line-height: 1.4285715;" %)Programmatically Setting Layout Options(%%) =
130 130  
131 131  {{warning title="ToDo"}}
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -7700957
1 +7701011
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/7700957/Working With Layout Options
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/7701011/Configuring Automatic Layout