Changes for page Configuring Automatic Layout
Last modified by Alexander Schulz-Rosengarten on 2023/07/11 10:33
To version 8.1
edited by cds
on 2013/09/12 11:42
on 2013/09/12 11:42
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -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.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. 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. ... ... @@ -94,7 +94,7 @@ 94 94 95 95 * {{code language="none"}}DefaultLayoutConfig{{/code}} – Sets fixed default values defined for layout options. 96 96 * {{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. 97 -* {{code language="none"}}SemanticLayoutConfig{{/code}} – Aconfiguration that bases its layout option values on the semantic objects represented by the KGraph elements.97 +* {{code language="none"}}SemanticLayoutConfig{{/code}} – **DOCUMENT THIS** 98 98 * {{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. 99 99 * {{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. 100 100 ... ... @@ -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: 105 +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(); 110 + 110 110 void enrich(LayoutContext context); 112 + 111 111 Object getValue(LayoutOptionData<?> optionData, LayoutContext context); 114 + 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.119 +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 -T he {{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.123 +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 theLayoutview 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 toimplement if yourfinal productwon't include the layout viewanyway.125 +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}} 129 +(% 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. 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 - 94699771 +7700960 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/ 9469977/Configuring Automatic Layout1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/7700960/Configuring Automatic Layout