<
From version < 4.1 >
edited by msp
on 2013/03/27 16:50
To version < 2.1 >
edited by msp
on 2013/03/27 16:19
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,29 +1,35 @@
1 1  This exercise will introduce the usage of the Eclipse Plugin Development Environment for developing new layout algorithms to be used in Eclipse diagram editors. Replace each <login> by your own login name (e.g. msp), and each <Login> by your login name with capitalized first letter (e.g. Msp). For any questions contact msp.
2 2  
3 -1. Install and set up Eclipse ((% style="color: rgb(255,0,0);" %)TODO: describe steps to install and set up Eclipse(%%))
4 -1. Import the following KIELER plugins: ((% style="color: rgb(255,0,0);" %)TODO: describe steps to access and import the KIELER plugins and update the list(%%))\\
3 +1. [[Install and set up Eclipse>>url:http://trac.rtsys.informatik.uni-kiel.de/trac/10ss-layout/wiki/Eclipse||style="" shape="rect" class="wiki"]]
4 +1. [[Check out>>url:http://trac.rtsys.informatik.uni-kiel.de/trac/10ss-layout/wiki/Subversion||style="" shape="rect" class="wiki"]] the following KIELER plugins:\\
5 5  1*. de.cau.cs.kieler.core
6 6  1*. de.cau.cs.kieler.core.kgraph
7 -1*. (% style="font-size: 10.0pt;line-height: 13.0pt;" %)de.cau.cs.kieler.kiml
8 -1*. (% style="font-size: 10.0pt;line-height: 13.0pt;" %)de.cau.cs.kieler.kiml.service
7 +1*. de.cau.cs.kieler.core.kgraph.edit
8 +1*. de.cau.cs.kieler.core.ui
9 +1*. de.cau.cs.kieler.keg
10 +1*. de.cau.cs.kieler.keg.diagram
11 +1*. de.cau.cs.kieler.kiml.layout
9 9  1*. de.cau.cs.kieler.kiml.ui
10 -1*. (% style="font-size: 10.0pt;line-height: 13.0pt;" %)de.cau.cs.kieler.klay.layered
13 +1*. de.cau.cs.kieler.kiml.viewer
14 +1*. de.cau.cs.kieler.klay.layered
11 11  1. Create a new plugin\\
12 -11. //File → New →// Other... //→// Plug-in Development //→// Plug-in Project
13 -11. Project name: de.cau.cs.rtprak.<login>.tutorial2
14 -11. //Next// //→// set version to //0.1.0.qualifier//, provider to //Christian-Albrechts-Universität zu Kiel//, and execution environment to //J2SE-1.5// (do this for all plugins that you create!)
16 +11. //File -> New -> Other... -> Plug-in Development -> Plug-in Project//
17 +11. Project name: de.cau.cs.rtprak.<login>.exercise1
18 +11. //Next// -> set version to //0.1.0.qualifier//, provider to //Christian-Albrechts-Universität zu Kiel//, and execution environment to //J2SE-1.5// (do this for all plugins that you create!)
15 15  11. The checkboxes in the //Options// group can be deactivated -> //Finish//
16 -1. Commit the new plugin project ((% style="color: rgb(255,0,0);" %)TODO: describe steps to commit plugin projects(%%))
17 -1. (% style="font-size: 10.0pt;line-height: 13.0pt;" %)Open the file META-INF/MANIFEST.MF //→// //Dependencies// tab(%%)\\
18 -1*. Add the plugins de.cau.cs.kieler.core and de.cau.cs.kieler.kiml to the list of dependencies, then save the file.[[attach:test-drawing.png]]
19 -1. Create a //layout provider// class with the //New →// Class wizard\\
20 -1*. Package: de.cau.cs.rtprak.<login>.tutorial2
20 +1. [[Check in>>url:http://trac.rtsys.informatik.uni-kiel.de/trac/10ss-layout/wiki/Subversion||style="" shape="rect" class="wiki"]] the new plugin project into [[https:~~/~~/rtsys.informatik.uni-kiel.de/svn/teaching/prak/10ss-layout/exercises/>>url:https://rtsys.informatik.uni-kiel.de/svn/teaching/prak/10ss-layout/exercises/||shape="rect"]]<login>/
21 +1. Activate Checkstyle: right-click the project -> //Properties -> Checkstyle -> Checkstyle active for this project//
22 +1. Open the file META-INF/MANIFEST.MF -> //Dependencies// tab\\
23 +1*. Add the plugins de.cau.cs.kieler.core and de.cau.cs.kieler.kiml.layout to the list of dependencies, then save the file
24 +1. Create a //layout provider// class with the //New -> Class// wizard\\
25 +1*. Package: de.cau.cs.rtprak.<login>.exercise1
21 21  1*. Name: <Login>LayoutProvider
22 22  1*. Superclass: de.cau.cs.kieler.kiml.AbstractLayoutProvider
23 23  1. (((
24 -Implement the layout provider class
25 -1. (% style="font-size: 10.0pt;line-height: 13.0pt;" %)Add the following constant to the class:
26 -1. (% class="code" %)
29 +Implement the [[(% class="icon" %) (%%)layout provider>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/kiml/layout/AbstractLayoutProvider.html||style="" shape="rect" class="ext-link"]] class
30 +1. You should now see a checkstyle warning for the doLayout method\\
31 +1*. Add the keyword final to each method argument to eliminate the warning
32 +1. Add the following constant to the class:(% class="code" %)
27 27  (((
28 28  (% class="cm" style="color: rgb(153,153,136);" %)/~*~* default value for spacing between nodes. */(% class="kd" %)privatestaticfinal(% class="kt" style="color: rgb(68,85,136);" %)float(% class="o" %)=(% class="mf" style="color: rgb(0,153,153);" %)15.0f(% class="o" %);
29 29  
... ... @@ -31,7 +31,7 @@
31 31   DEFAULT_SPACING
32 32  }}}
33 33  )))
34 -1. Write the following lines at the beginning of the {{code language="none"}}doLayout{{/code}} method:(% class="code" %)
40 +1. Write the following lines at the beginning of the doLayout method (see [[(% class="icon" %) (%%)IKielerProgressMonitor>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/core/alg/IKielerProgressMonitor.html||style="" shape="rect" class="ext-link"]] and [[(% class="icon" %) (%%)KimlLayoutUtil>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/kiml/layout/util/KimlLayoutUtil.html||style="" shape="rect" class="ext-link"]]):(% class="code" %)
35 35  (((
36 36  (% class="o" %).(% class="na" style="color: rgb(0,128,128);" %)begin(% class="o" %)((% class="s" style="color: rgb(187,136,68);" %)"<Login> Layouter"(% class="o" %),(% class="mi" style="color: rgb(0,153,153);" %)1(% class="o" %));=.(% class="na" style="color: rgb(0,128,128);" %)getData(% class="o" %)(.(% class="na" style="color: rgb(0,128,128);" %)class(% class="o" %));(% class="kt" style="color: rgb(68,85,136);" %)float(% class="o" %)=.(% class="na" style="color: rgb(0,128,128);" %)getProperty(% class="o" %)(.(% class="na" style="color: rgb(0,128,128);" %)SPACING(% class="o" %));(% class="k" %)if(% class="o" %)(<(% class="mi" style="color: rgb(0,153,153);" %)0(% class="o" %)){=;}(% class="kt" style="color: rgb(68,85,136);" %)float(% class="o" %)=.(% class="na" style="color: rgb(0,128,128);" %)getProperty(% class="o" %)(.(% class="na" style="color: rgb(0,128,128);" %)BORDER_SPACING(% class="o" %));(% class="k" %)if(% class="o" %)(<(% class="mi" style="color: rgb(0,153,153);" %)0(% class="o" %)){=;}
37 37  
... ... @@ -47,7 +47,7 @@
47 47  
48 48  }}}
49 49  )))
50 -1. Write the following line at the end of the {{code language="none"}}doLayout{{/code}} method:(% class="code" %)
56 +1. Write the following line at the end of the doLayout method:(% class="code" %)
51 51  (((
52 52  (% class="o" %).(% class="na" style="color: rgb(0,128,128);" %)done(% class="o" %)();
53 53  
... ... @@ -55,9 +55,9 @@
55 55  }}}
56 56  )))
57 57  1. (((
58 -Implement the rest of the layouter such that the nodes of the input graph are all put in a row.
59 -* See the [[KGraph>>doc:KIELER.KGraph Meta Model]] and [[KLayoutData>>doc:KIELER.KLayoutData Meta Model]] data structures: the input is a KNode and holds the nodes of the graph in its list of children
60 -* Iterate over the nodes in the {{code language="none"}}getChildren(){{/code}} list of the {{code language="none"}}layoutNode{{/code}} input
64 +Implement the rest of the layouter such that the nodes of the input graph are all put in a row
65 +* See the [[(% class="icon" %) (%%)KGraph>>url:https://rtsys.informatik.uni-kiel.de/trac/kieler/wiki/KGraph||style="" shape="rect" class="ext-link"]] and [[(% class="icon" %) (%%)KLayoutData>>url:https://rtsys.informatik.uni-kiel.de/trac/kieler/wiki/KLayoutData||style="" shape="rect" class="ext-link"]] data structures: the input is a [[(% class="icon" %) (%%)KNode>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/core/kgraph/KNode.html||style="" shape="rect" class="ext-link"]] and holds the nodes of the graph in its list of children
66 +* Iterate over the nodes in the [[(% class="icon" %) (%%)getChildren()>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/core/kgraph/KNode.html#getChildren()||style="" shape="rect" class="ext-link"]] list of the layoutNode input
61 61  * Retrieve the size of a node using the following code:(% class="code" %)
62 62  (((
63 63  (% class="o" %)=.(% class="na" style="color: rgb(0,128,128);" %)getData(% class="o" %)(.(% class="na" style="color: rgb(0,128,128);" %)class(% class="o" %));(% class="kt" style="color: rgb(68,85,136);" %)float(% class="o" %)=.(% class="na" style="color: rgb(0,128,128);" %)getWidth(% class="o" %)();(% class="kt" style="color: rgb(68,85,136);" %)float(% class="o" %)=.(% class="na" style="color: rgb(0,128,128);" %)getHeight(% class="o" %)();
... ... @@ -75,57 +75,63 @@
75 75   nodeLayouty
76 76  }}}
77 77  )))
78 -* {{code language="none"}}objectSpacing{{/code}} shall be the spacing to be left between each pair of nodes.
79 -* {{code language="none"}}borderSpacing{{/code}} shall be the spacing to be left to the borders of the drawing: the first node's coordinates shall be (borderSpacing, borderSpacing).
80 -* At the end of the method, set the width and height of {{code language="none"}}parentLayout{{/code}} so that it is large enough to hold the whole drawing, including borders.
81 -* Edges may be ignored for now.
84 +* objectSpacing shall be the spacing to be left between each pair of nodes
85 +* borderSpacing shall be the spacing to be left to the borders of the drawing: the first node's coordinates shall be (borderSpacing, borderSpacing)
86 +* At the end of the method, set the width and height of parentLayout so that it is large enough to hold the whole drawing, including borders
87 +* Edges may be ignored for now
82 82  )))
83 83  )))
84 -1. Open the file META-INF/MANIFEST.MF //→// //Extensions// tab\\
90 +1. Open the file META-INF/MANIFEST.MF -> //Extensions// tab\\
85 85  11. Add an extension for de.cau.cs.kieler.kiml.layout.layoutProviders
86 -11. Right-click the extension //→// //New// //→// //layoutProvider//
87 -11. Set //name// to //<Login> Test Layouter//, //class// to de.cau.cs.rtprak.<login>.tutorial2.<Login>LayoutProvider
88 -11. Right-click the new //layoutProvider// //→// //New// //→// //knownOption//, set //option// to de.cau.cs.kieler.spacing
89 -11. Add another //knownOption//, set to de.cau.cs.kieler.borderSpacing
90 -1. //Run// //→// //Run Configurations...// //→// right-click //Eclipse Application// //→// //New//\\
92 +11. Right-click the extension -> //New// -> //layoutProvider//
93 +11. Set //name// to //<Login> Test Layouter//, //class// to de.cau.cs.rtprak.<login>.exercise1.<Login>LayoutProvider
94 +11. Right-click the new //layoutProvider// -> //New// -> //knownOption//, set //option// to de.cau.cs.kieler.layout.options.minSpacing
95 +11. Add another //knownOption//, set to de.cau.cs.kieler.layout.options.borderSpacing
96 +1. //Run// -> //Run Configurations...// -> right-click //Eclipse Application// -> //New//\\
91 91  11. Name: //Layout//
92 -11. For testing the layouter, a new workspace location will be created; you may configure its destination in //Workspace Data// //→// //Location//
93 -11. Add the program arguments {{code language="none"}}-debug -consoleLog{{/code}} in the //Arguments// tab.
98 +11. For testing the layouter, a new workspace location will be created; you may configure its destination in //Workspace Data// -> //Location//
99 +11. Add the program arguments -debug -consoleLog in the //Arguments// tab
94 94  11. Go to //Plug-ins// tab, select //Launch with: plug-ins selected below only//
95 95  11. //Deselect All//, activate //Workspace// checkbox, //Add Required Plug-ins//, //Apply//, //Run//
96 96  1. Test the layouter in the new Eclipse instance:\\
97 -11. //New// //→// //Project...// //→// //General// //→// //Project//, name //test//
98 -11. Right-click test project //→// //New// //→// //Other...// //→// //KEG Diagram// ((% style="color: rgb(255,0,0);" %)TODO: if graphs shall be created in another way, describe it here(%%))
99 -11. Create a graph using the palette on the right.
100 -11. //Window// //→// //Show View// //→// //Other...// //→// //KIELER// //→// //Layout//
101 -11. While the graph diagram is open, set //Layout Provider or Type// in the //Layout// view to //<Login> Test Layouter.//
102 -11. Open the additional views //Layout Graph// and //Layout Time.//
103 -11. Trigger layout with the //KIELER Layout// button in the toolbar or Ctrl+R L (first Ctrl+R, then L).
104 -11. See the direct input and output of your algorithm in the //Layout Graph// view.
105 -11. See the execution time analysis in the //Layout Time// view.
103 +11. //New// -> //Project...// -> //General// -> //Project//, name //test//
104 +11. Right-click test project -> //New// -> //Other...// -> //Graphs Diagram//
105 +11. Create a graph using the palette on the right
106 +11. //Window// -> //Show View// -> //Other...// -> //KIELER// -> //Layout//
107 +11. While the graph diagram is open, set //Layout Provider or Type// in the //Layout// view to //<Login> Test Layouter//
108 +11. Open the additional views //Layout Graph// and //Layout Time//
109 +11. Trigger layout with //KIELER// -> //Layout// or Ctrl+R L (first Ctrl+R, then L) or the button in the toolbar
110 +11. See the direct input and output of your algorithm in the //Layout Graph// view: //Pre-Layout// is the input, //Post-Layout// is the output
111 +11. See the execution time analysis in the //Layout Time// view
106 106  1. (((
107 -Implement another class //EdgeRouter//.
113 +Implement another class //EdgeRouter// with superclass de.cau.cs.kieler.core.alg.AbstractAlgorithm
108 108  1. Add the following method:(% class="code" %)
109 109  (((
116 +(% class="cm" style="color: rgb(153,153,136);" %)/~*~* * Route the edges that are connected with the children of the given node. * * @param parentNode the parent node of the input graph */(% class="kd" %)public(% class="kt" style="color: rgb(68,85,136);" %)void(% class="nf" style="color: rgb(153,0,0);" %)routeEdges(% class="o" %)((% class="kd" %)final(% class="o" %)){().(% class="na" style="color: rgb(0,128,128);" %)begin(% class="o" %)((% class="s" style="color: rgb(187,136,68);" %)"Edge Routing"(% class="o" %),(% class="mi" style="color: rgb(0,153,153);" %)1(% class="o" %));().(% class="na" style="color: rgb(0,128,128);" %)done(% class="o" %)();}
110 110  
111 -\\\\\\\\\\\\\\
112 -
113 -{{{ /** * Route the edges that are connected with the children of the given node. * @param parentNode the parent node of the input graph */ public void routeEdges(final KNode parentNode) { getMonitor().begin("Edge Routing", 1); getMonitor().done(); }}}}
118 +{{{
119 + KNode parentNode
120 + getMonitor
121 +
122 + getMonitor
123 +
124 +}}}
114 114  )))
115 -1. Add the following code to the end of the {{code language="none"}}doLayout{{/code}} method in your layout provider:(% class="code" %)
126 +1. Add the following code to the end of the doLayout method in your layout provider:(% class="code" %)
116 116  (((
117 -(% class="o" %)=(% class="k" %)new(% class="o" %)();.(% class="na" style="color: rgb(0,128,128);" %)routeEdges(% class="o" %)();
128 +(% class="o" %)=(% class="k" %)new(% class="o" %)();.(% class="na" style="color: rgb(0,128,128);" %)reset(% class="o" %)(.(% class="na" style="color: rgb(0,128,128);" %)subTask(% class="o" %)((% class="mi" style="color: rgb(0,153,153);" %)1(% class="o" %)));.(% class="na" style="color: rgb(0,128,128);" %)routeEdges(% class="o" %)();
118 118  
119 119  {{{ EdgeRouter edgeRouter EdgeRouter
131 + edgeRouterprogressMonitor
120 120   edgeRouterlayoutNode
121 121  }}}
122 122  )))
123 123  1. (((
124 -Implement the {{code language="none"}}routeEdges{{/code}} method:
136 +Implement the routeEdges method:
125 125  * Each edge shall be drawn with three line segments: one vertical segment starting below the source node, one horizonzal segment, and another vertical segment ending below the target node.
126 -* The horizontal segments of two different edges shall not have the same y-coordinate; for consecutive edges, the distance between their horizontal segments shall equal {{code language="none"}}objectSpacing{{/code}}.
127 -* See the attached image [[attach:test-drawing.png]] for an example.
128 -* Find the edges using {{code language="none"}}getOutgoingEdges(){{/code}} or {{code language="none"}}getIncomingEdges(){{/code}} on a node.
138 +* The horizontal segments of two different edges shall not have the same y-coordinate; for consecutive edges, the distance between their horizontal segments shall equal objectSpacing
139 +* See the attached image [[test-drawing.png>>url:http://trac.rtsys.informatik.uni-kiel.de/trac/10ss-layout/attachment/wiki/Exercises/Introduction/test-drawing.png||style="" title="Attachment 'test-drawing.png' in Exercises/Introduction" shape="rect" class="attachment"]](% class="noprint" %) [[~[~[image:url:http://trac.rtsys.informatik.uni-kiel.de/trac/10ss-layout/chrome/common/download.png~]~]>>url:http://trac.rtsys.informatik.uni-kiel.de/trac/10ss-layout/raw-attachment/wiki/Exercises/Introduction/test-drawing.png||style="" title="Download" shape="rect" class="trac-rawlink"]](%%) for an example
140 +* Find the edges using [[(% class="icon" %) (%%)getOutgoingEdges()>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/core/kgraph/KNode.html#getOutgoingEdges()||style="" shape="rect" class="ext-link"]] or [[(% class="icon" %) (%%)getIncomingEdges()>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/core/kgraph/KNode.html#getIncomingEdges()||style="" shape="rect" class="ext-link"]] on a node
129 129  * Get the edge layout of an edge to set bend points using this code:(% class="code" %)
130 130  (((
131 131  (% class="o" %)=.(% class="na" style="color: rgb(0,128,128);" %)getData(% class="o" %)(.(% class="na" style="color: rgb(0,128,128);" %)class(% class="o" %));
... ... @@ -140,8 +140,8 @@
140 140  {{{ KPoint point KLayoutDataFactory
141 141  }}}
142 142  )))
143 -* Use the {{code language="none"}}getBendPoints(){{/code}} list on the {{code language="none"}}edgeLayout{{/code}} to add bend points (clear the list first to remove points from the previous layout).
144 -* Set the values of the points returned by {{code language="none"}}getSourcePoint(){{/code}} and {{code language="none"}}getTargetPoint(){{/code}} according to the positions where the edge leaves its source node and reches its target node.
155 +* Use the [[(% class="icon" %) (%%)getBendPoints()>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/kiml/layout/klayoutdata/KEdgeLayout.html#getBendPoints()||style="" shape="rect" class="ext-link"]] list on the edgeLayout to add bend points (clear the list first to remove points from the previous layout)
156 +* Set the values of the points returned by [[(% class="icon" %) (%%)getSourcePoint()>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/kiml/layout/klayoutdata/KEdgeLayout.html#getSourcePoint()||style="" shape="rect" class="ext-link"]] and [[(% class="icon" %) (%%)getTargetPoint()>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/doc/de/cau/cs/kieler/kiml/layout/klayoutdata/KEdgeLayout.html#getTargetPoint()||style="" shape="rect" class="ext-link"]] according to the positions where the edge leaves its source node and reches its target node
145 145  )))
146 146  )))
147 147  1. Use your previous run configuration to test the edge router.
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -5505224
1 +5505221
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS13LayPract/pages/5505224/KIML
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS13LayPract/pages/5505221/KIML