blob: 94096005709ee1f238e94589d716d6158b882051 [file] [log] [blame]
mwenzb5dc2f92010-06-16 13:24:52 +00001<html>
jpasch3e395602010-07-08 11:41:42 +00002
mwenzb5dc2f92010-06-16 13:24:52 +00003<head>
jpasch3e395602010-07-08 11:41:42 +00004<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
5<meta name=Generator content="Microsoft Word 12 (filtered)">
mwenzb5dc2f92010-06-16 13:24:52 +00006<title>Selection behavior</title>
jpasch3e395602010-07-08 11:41:42 +00007<link rel=Stylesheet type="text/css" media=all href="../book.css">
8<style>
mwenzb5dc2f92010-06-16 13:24:52 +00009<!--
10 /* Font Definitions */
11 @font-face
jpasch3e395602010-07-08 11:41:42 +000012 {font-family:"Cambria Math";
13 panose-1:2 4 5 3 5 4 6 3 2 4;}
mwenzb5dc2f92010-06-16 13:24:52 +000014@font-face
jpasch3e395602010-07-08 11:41:42 +000015 {font-family:Cambria;
16 panose-1:2 4 5 3 5 4 6 3 2 4;}
mwenzb5dc2f92010-06-16 13:24:52 +000017@font-face
jpasch3e395602010-07-08 11:41:42 +000018 {font-family:Tahoma;
19 panose-1:2 11 6 4 3 5 4 4 2 4;}
mwenzb5dc2f92010-06-16 13:24:52 +000020@font-face
jpasch3e395602010-07-08 11:41:42 +000021 {font-family:Consolas;
22 panose-1:2 11 6 9 2 2 4 3 2 4;}
mwenzb5dc2f92010-06-16 13:24:52 +000023 /* Style Definitions */
24 p.MsoNormal, li.MsoNormal, div.MsoNormal
jpasch3e395602010-07-08 11:41:42 +000025 {margin:0cm;
26 margin-bottom:.0001pt;
27 font-size:12.0pt;
28 font-family:"Times New Roman","serif";}
mwenzb5dc2f92010-06-16 13:24:52 +000029h1
jpasch3e395602010-07-08 11:41:42 +000030 {mso-style-link:"\00DCberschrift 1 Zchn";
31 margin-top:12.0pt;
32 margin-right:0cm;
33 margin-bottom:3.0pt;
34 margin-left:0cm;
35 page-break-after:avoid;
36 font-size:16.0pt;
37 font-family:"Times New Roman","serif";
38 font-weight:bold;}
mwenzb5dc2f92010-06-16 13:24:52 +000039h2
jpasch3e395602010-07-08 11:41:42 +000040 {mso-style-link:"\00DCberschrift 2 Zchn";
41 margin-top:12.0pt;
42 margin-right:0cm;
43 margin-bottom:3.0pt;
44 margin-left:0cm;
45 page-break-after:avoid;
46 font-size:14.0pt;
47 font-family:"Times New Roman","serif";
48 font-weight:bold;
49 font-style:italic;}
mwenzb5dc2f92010-06-16 13:24:52 +000050h3
jpasch3e395602010-07-08 11:41:42 +000051 {mso-style-link:"\00DCberschrift 3 Zchn";
52 margin-top:12.0pt;
53 margin-right:0cm;
54 margin-bottom:3.0pt;
55 margin-left:0cm;
56 page-break-after:avoid;
57 font-size:13.0pt;
58 font-family:"Times New Roman","serif";
59 font-weight:bold;}
mwenzb5dc2f92010-06-16 13:24:52 +000060h4
jpasch3e395602010-07-08 11:41:42 +000061 {mso-style-link:"\00DCberschrift 4 Zchn";
62 margin-top:11.25pt;
63 margin-right:0cm;
64 margin-bottom:1.7pt;
65 margin-left:0cm;
66 font-size:12.0pt;
67 font-family:"Times New Roman","serif";
68 font-weight:bold;
69 font-style:italic;}
mwenzb5dc2f92010-06-16 13:24:52 +000070h5
jpasch3e395602010-07-08 11:41:42 +000071 {mso-style-link:"\00DCberschrift 5 Zchn";
72 margin-right:0cm;
73 margin-left:0cm;
74 font-size:10.0pt;
75 font-family:"Times New Roman","serif";
76 font-weight:bold;}
mwenzb5dc2f92010-06-16 13:24:52 +000077h6
jpasch3e395602010-07-08 11:41:42 +000078 {mso-style-link:"\00DCberschrift 6 Zchn";
79 margin-right:0cm;
80 margin-left:0cm;
81 font-size:7.5pt;
82 font-family:"Times New Roman","serif";
83 font-weight:bold;}
mwenzb5dc2f92010-06-16 13:24:52 +000084p.MsoCaption, li.MsoCaption, div.MsoCaption
jpasch3e395602010-07-08 11:41:42 +000085 {margin-top:6.0pt;
86 margin-right:0cm;
87 margin-bottom:24.0pt;
88 margin-left:0cm;
89 text-align:justify;
90 font-size:10.0pt;
91 font-family:"Times New Roman","serif";
92 font-weight:bold;}
mwenzb5dc2f92010-06-16 13:24:52 +000093a:link, span.MsoHyperlink
jpasch3e395602010-07-08 11:41:42 +000094 {color:blue;
95 text-decoration:underline;}
mwenzb5dc2f92010-06-16 13:24:52 +000096a:visited, span.MsoHyperlinkFollowed
jpasch3e395602010-07-08 11:41:42 +000097 {color:purple;
98 text-decoration:underline;}
mwenzb5dc2f92010-06-16 13:24:52 +000099p
jpasch3e395602010-07-08 11:41:42 +0000100 {margin-top:5.65pt;
101 margin-right:0cm;
102 margin-bottom:5.65pt;
103 margin-left:0cm;
104 font-size:12.0pt;
105 font-family:"Times New Roman","serif";}
mwenzb5dc2f92010-06-16 13:24:52 +0000106pre
jpasch3e395602010-07-08 11:41:42 +0000107 {mso-style-link:"HTML Vorformatiert Zchn";
108 margin-top:0cm;
109 margin-right:0cm;
110 margin-bottom:0cm;
111 margin-left:3.4pt;
112 margin-bottom:.0001pt;
113 font-size:11.0pt;
114 font-family:"Courier New";}
mwenzb5dc2f92010-06-16 13:24:52 +0000115p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
jpasch3e395602010-07-08 11:41:42 +0000116 {mso-style-link:"Sprechblasentext Zchn";
117 margin:0cm;
118 margin-bottom:.0001pt;
119 font-size:8.0pt;
120 font-family:"Tahoma","sans-serif";}
mwenzb5dc2f92010-06-16 13:24:52 +0000121span.berschrift1Zchn
jpasch3e395602010-07-08 11:41:42 +0000122 {mso-style-name:"\00DCberschrift 1 Zchn";
123 mso-style-link:"\00DCberschrift 1";
124 font-family:"Cambria","serif";
125 color:#365F91;
126 font-weight:bold;}
mwenzb5dc2f92010-06-16 13:24:52 +0000127span.berschrift2Zchn
jpasch3e395602010-07-08 11:41:42 +0000128 {mso-style-name:"\00DCberschrift 2 Zchn";
129 mso-style-link:"\00DCberschrift 2";
130 font-family:"Cambria","serif";
131 color:#4F81BD;
132 font-weight:bold;}
mwenzb5dc2f92010-06-16 13:24:52 +0000133span.berschrift3Zchn
jpasch3e395602010-07-08 11:41:42 +0000134 {mso-style-name:"\00DCberschrift 3 Zchn";
135 mso-style-link:"\00DCberschrift 3";
136 font-family:"Cambria","serif";
137 color:#4F81BD;
138 font-weight:bold;}
mwenzb5dc2f92010-06-16 13:24:52 +0000139span.berschrift4Zchn
jpasch3e395602010-07-08 11:41:42 +0000140 {mso-style-name:"\00DCberschrift 4 Zchn";
141 mso-style-link:"\00DCberschrift 4";
142 font-family:"Cambria","serif";
143 color:#4F81BD;
144 font-weight:bold;
145 font-style:italic;}
mwenzb5dc2f92010-06-16 13:24:52 +0000146span.berschrift5Zchn
jpasch3e395602010-07-08 11:41:42 +0000147 {mso-style-name:"\00DCberschrift 5 Zchn";
148 mso-style-link:"\00DCberschrift 5";
149 font-family:"Cambria","serif";
150 color:#243F60;}
mwenzb5dc2f92010-06-16 13:24:52 +0000151span.berschrift6Zchn
jpasch3e395602010-07-08 11:41:42 +0000152 {mso-style-name:"\00DCberschrift 6 Zchn";
153 mso-style-link:"\00DCberschrift 6";
154 font-family:"Cambria","serif";
155 color:#243F60;
156 font-style:italic;}
mwenzb5dc2f92010-06-16 13:24:52 +0000157span.HTMLVorformatiertZchn
jpasch3e395602010-07-08 11:41:42 +0000158 {mso-style-name:"HTML Vorformatiert Zchn";
159 mso-style-link:"HTML Vorformatiert";
160 font-family:Consolas;}
mwenzb5dc2f92010-06-16 13:24:52 +0000161span.SprechblasentextZchn
jpasch3e395602010-07-08 11:41:42 +0000162 {mso-style-name:"Sprechblasentext Zchn";
163 mso-style-link:Sprechblasentext;
164 font-family:"Tahoma","sans-serif";}
mwenzb5dc2f92010-06-16 13:24:52 +0000165p.code, li.code, div.code
jpasch3e395602010-07-08 11:41:42 +0000166 {mso-style-name:code;
167 margin-top:0cm;
168 margin-right:0cm;
169 margin-bottom:0cm;
170 margin-left:15.0pt;
171 margin-bottom:.0001pt;
172 font-size:12.0pt;
173 font-family:"Times New Roman","serif";}
mwenzb5dc2f92010-06-16 13:24:52 +0000174p.note, li.note, div.note
jpasch3e395602010-07-08 11:41:42 +0000175 {mso-style-name:note;
176 margin-top:19.5pt;
177 margin-right:0cm;
178 margin-bottom:19.5pt;
179 margin-left:30.0pt;
180 font-size:13.0pt;
181 font-family:"Times New Roman","serif";
182 font-style:italic;}
mwenzb5dc2f92010-06-16 13:24:52 +0000183p.msochpdefault, li.msochpdefault, div.msochpdefault
jpasch3e395602010-07-08 11:41:42 +0000184 {mso-style-name:msochpdefault;
185 margin-top:5.65pt;
186 margin-right:0cm;
187 margin-bottom:5.65pt;
188 margin-left:0cm;
189 font-size:10.0pt;
190 font-family:"Times New Roman","serif";}
191p.Uuml, li.Uuml, div.Uuml
jpasch255f62c2010-09-20 11:31:43 +0000192 {mso-style-name:"&Uuml\,''berschrift 1''";
193 mso-style-link:"&Uuml6\,''berschrift 6 Zchn1''";
jpasch3e395602010-07-08 11:41:42 +0000194 margin-bottom:.0001pt;
195 font-size:12.0pt;
jpasch6e886342010-09-17 13:28:25 +0000196 font-family:"Times New Roman","serif"; margin-left:0cm; margin-right:0cm; margin-top:0cm}
jpasch3e395602010-07-08 11:41:42 +0000197span.Uuml1
jpasch255f62c2010-09-20 11:31:43 +0000198 {mso-style-name:"&Uuml1\,''berschrift 1 Zchn1''";
199 mso-style-link:"&Uuml\,''berschrift 1''";
jpasch3e395602010-07-08 11:41:42 +0000200 font-family:"Cambria","serif";
201 color:#365F91;
jpasch6e886342010-09-17 13:28:25 +0000202 font-weight:bold}
jpasch3e395602010-07-08 11:41:42 +0000203span.Uuml2
jpasch255f62c2010-09-20 11:31:43 +0000204 {mso-style-name:"&Uuml2\,''berschrift 2 Zchn1''";
205 mso-style-link:"&Uuml\,''berschrift 1''";
jpasch3e395602010-07-08 11:41:42 +0000206 font-family:"Cambria","serif";
207 color:#4F81BD;
jpasch6e886342010-09-17 13:28:25 +0000208 font-weight:bold}
jpasch3e395602010-07-08 11:41:42 +0000209span.Uuml3
jpasch255f62c2010-09-20 11:31:43 +0000210 {mso-style-name:"&Uuml3\,''berschrift 3 Zchn1''";
211 mso-style-link:"&Uuml\,''berschrift 1''";
jpasch3e395602010-07-08 11:41:42 +0000212 font-family:"Cambria","serif";
213 color:#4F81BD;
jpasch6e886342010-09-17 13:28:25 +0000214 font-weight:bold}
jpasch3e395602010-07-08 11:41:42 +0000215span.Uuml4
jpasch255f62c2010-09-20 11:31:43 +0000216 {mso-style-name:"&Uuml4\,''berschrift 4 Zchn1''";
217 mso-style-link:"&Uuml\,''berschrift 1''";
jpasch3e395602010-07-08 11:41:42 +0000218 font-family:"Cambria","serif";
219 color:#4F81BD;
220 font-weight:bold;
jpasch6e886342010-09-17 13:28:25 +0000221 font-style:italic}
jpasch3e395602010-07-08 11:41:42 +0000222span.Uuml5
jpasch255f62c2010-09-20 11:31:43 +0000223 {mso-style-name:"&Uuml5\,''berschrift 5 Zchn1''";
224 mso-style-link:"&Uuml\,''berschrift 1''";
jpasch3e395602010-07-08 11:41:42 +0000225 font-family:"Cambria","serif";
jpasch6e886342010-09-17 13:28:25 +0000226 color:#243F60}
jpasch3e395602010-07-08 11:41:42 +0000227span.Uuml6
jpasch255f62c2010-09-20 11:31:43 +0000228 {mso-style-name:"&Uuml6\,''berschrift 6 Zchn1''";
229 mso-style-link:"&Uuml\,''berschrift 1''";
jpasch3e395602010-07-08 11:41:42 +0000230 font-family:"Cambria","serif";
231 color:#243F60;
jpasch6e886342010-09-17 13:28:25 +0000232 font-style:italic}
mwenzb5dc2f92010-06-16 13:24:52 +0000233span.code1
jpasch3e395602010-07-08 11:41:42 +0000234 {mso-style-name:code1;
235 font-style:italic;}
mwenzb5dc2f92010-06-16 13:24:52 +0000236span.code0
jpasch3e395602010-07-08 11:41:42 +0000237 {mso-style-name:code0;
238 font-style:italic;}
mwenzb5dc2f92010-06-16 13:24:52 +0000239.MsoChpDefault
jpasch3e395602010-07-08 11:41:42 +0000240 {font-size:10.0pt;}
mwenzb5dc2f92010-06-16 13:24:52 +0000241@page Section1
jpasch3e395602010-07-08 11:41:42 +0000242 {size:595.45pt 841.7pt;
243 margin:72.0pt 89.85pt 72.0pt 89.85pt;}
mwenzb5dc2f92010-06-16 13:24:52 +0000244div.Section1
jpasch3e395602010-07-08 11:41:42 +0000245 {page:Section1;}
mwenzb5dc2f92010-06-16 13:24:52 +0000246-->
247</style>
jpasch3e395602010-07-08 11:41:42 +0000248
mwenzb5dc2f92010-06-16 13:24:52 +0000249</head>
jpasch3e395602010-07-08 11:41:42 +0000250
251<body bgcolor=white lang=DE link=blue vlink=purple style='margin-bottom:12.0pt'>
252
253<div class=Section1>
254
255<h1><span lang=EN-US>Selection Behavior</span></h1>
256
257<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
258
259<h2><span lang=EN-US>Introduction</span></h2>
260
261<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
262
263<p class=MsoNormal><span lang=EN-US style='color:black'>In most cases a
264graphical figure is depicted by one outer &#8216;main&#8217; graphics
265algorithm, inside which several other graphics algorithms are located. The
266outer bounds of this outer &#8216;main&#8217; graphics algorithm also define
267the selection-behavior of the graphical figure.</span></p>
268
269<p class=MsoNormal><span lang=EN-US style='color:black'>But it is also possible
270to assemble a shape from overlapping or even distributed graphics algorithms.
271In such a case it is not so clear anymore, which bounds define the
mwenzb5dc2f92010-06-16 13:24:52 +0000272selection-behavior of the graphical figure.</span></p>
jpasch3e395602010-07-08 11:41:42 +0000273
274<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
275
276<p class=MsoNormal><span lang=EN-US style='color:black'>For a better
277understanding look at the following figure:</span></p>
278
279<p class=MsoNormal><span style='color:black'><img width=111 height=71
280src="visio/rendering-area-1a.gif"></span></p>
281
282<p class=MsoCaption><span class=code1><span lang=EN-US style='font-style:normal'>Figure:
283Graphical figure with distributed graphics algorithms (ellipse and text)</span></span></p>
284
285<p class=MsoNormal><span lang=EN-US style='color:black'>This graphical figure
286consists of an ellipse and a text. For technical reasons there is still an
287outer invisible rectangle, which contains the ellipse and text. But in this
288example it would seem strange for the user, if this outer invisible rectangle
289would define the selection-behavior, meaning that clicking on the invisible
290rectangle would select it and show the selection-handles along the bounds of
mwenzb5dc2f92010-06-16 13:24:52 +0000291the invisible rectangle.</span></p>
jpasch3e395602010-07-08 11:41:42 +0000292
293<p class=MsoNormal><span lang=EN-US style='color:black'>Instead the
294selection-behavior should work as can be seen in the following figure:</span></p>
295
296<p class=MsoNormal><span style='color:black'><img width=111 height=72
297src="visio/rendering-area-1b.gif"></span></p>
298
299<p class=MsoCaption><span class=code1><span lang=EN-US style='font-style:normal'>Figure:
300Selection area is smaller than complete graphical figure</span></span></p>
301
302<p class=MsoNormal><span lang=EN-US style='color:black'>The selection-handles
303appear only along the borders of the ellipse and not along the borders of the
304larger invisible rectangle. It is possible to move or resize the circle along
305these selection-handles (which will implicitly move or resize the complete
306graphical figure).&nbsp; This makes the ellipse the &#8216;main&#8217; graphics
307algorithm, although the ellipse is technically not the outer graphics algorithm
308of the graphical figure.</span></p>
309
310<p class=MsoNormal><span lang=EN-US style='color:black'>Another aspect of the
311selection-behavior is that the graphical figure shall be selected when the
312mouse clicks on either the ellipse or the text. When the mouse clicks the text
313however, then the handle-bounds still appear around the ellipse as described
314above, and not around the text. This means, that the selection-handles can be
315shown around a different area, than the area which reacts on the mouse clicks
316to select the graphical figure.</span></p>
317
318<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
319
320<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
321
322<h2><span lang=EN-US>Creating an Extended Rendering Area</span></h2>
323
324<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
325
326<p class=MsoNormal><span lang=EN-US style='color:black'>The following example
327bases on the <a href="anchors.htm">box relative anchor</a> we created
328previously. As you can see the box relative anchor was located completely
329inside the bounds of the rectangle depicting the EClass.</span></p>
330
331<p class=MsoNormal><span lang=EN-US style='color:black'>Now we want to change
332the location of the box relative anchor, so that it exceeds the bounds of the
333rectangle. This is actually quite typical, that box relative anchors or fix
334point anchors exceed the bounds of the graphical figure it belongs to.</span></p>
335
336<p class=MsoNormal><span style='color:black'><img border=0 width=121 height=71
337src="visio/rendering-area-2a.gif"></span></p>
338
339<p class=MsoCaption><span class=code1><span lang=EN-US style='font-style:normal'>Figure:
340Box relative anchor exceeds bounds of graphical figure</span></span></p>
341
342<p class=MsoNormal><span lang=EN-US style='color:black'>As already mentioned,
343for technical reasons a graphics algorithm can never be painted outside the
344bounds of its parent graphics algorithm. Although it is possible to set the
345bounds of a graphics algorithm to exceed the bounds of its parent graphics
346algorithm, it will just be clipped when painting.</span></p>
347
348<p class=MsoNormal><span lang=EN-US style='color:black'>You can try that out by
349changing the bounds of the <a href="anchors.htm">box relative anchor</a> we
350created previously:</span></p>
351
352<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>gaService<span
353style='color:black'>.<i>setLocationAndSize</i>(boxRect, -8, -4,</span> <b>16</b><span
354style='color:black'>, 8);</span></span></p>
355
356<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
357
358<p class=MsoNormal><span lang=EN-US style='color:black'>As this doesn&#8217;t
359work, we have to change the structure of the graphics algorithms for the
360EClass. The outer graphics algorithm shall be an invisible rectangle, which
361contains the rectangle depicting the EClass. The size of the invisible
362rectangle equals the size of the rectangle depicting the EClass, plus the space
363needed for the box relative anchor at its right side. You can see the bounds of
364the invisible rectangle when you select the graphical figure:</span></p>
365
366<p class=MsoNormal><span style='color:black'><img border=0 width=131 height=71
367src="visio/rendering-area-2b.gif"></span><span lang=EN-US style='color:black'>&nbsp;</span></p>
368
369<p class=MsoCaption><span class=code1><span lang=EN-US style='font-style:normal'>Figure:
370Selection-handles around the invisible rectangle</span></span><span lang=EN-US>&nbsp;</span></p>
371
372<p class=MsoNormal><span lang=EN-US style='color:black'>The invisible rectangle
373has to be created in the add method of the <a href="add-feature.htm">add
374feature</a><span class=code1><span style='font-style:normal'>, as explained in
375the following code snippet. Additionally the bounds of the box relative anchor
376have to be set differently. Note, that the expanded width of the invisible
377rectangle is set in a static field, because it also has to be used in
378calculations outside this class.</span></span></span></p>
379
380<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
381
382<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=851
383 style='width:18.0cm;border-collapse:collapse'>
384 <tr>
385 <td width=851 valign=top style='width:18.0cm;border:solid windowtext 1.0pt;
386 padding:0cm 5.4pt 0cm 5.4pt'>
387 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
388 style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>&nbsp;</span></p>
389 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
390 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
391 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
392 style='color:#3F7F5F'>// the additional size of the invisible rectangle at
393 the right border</span></span></p>
394 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
395 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
396 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
397 style='color:#3F7F5F'>// (this also equals the half width of the anchor to
398 paint there)</span></span></p>
399 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
400 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
401 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
402 style='color:#7F0055'>public</span></b> <b><span style='color:#7F0055'>static</span></b>
403 <b><span style='color:#7F0055'>final</span></b> <b><span style='color:#7F0055'>int</span></b>
404 <i><span style='color:#0000C0'>INVISIBLE_RECT_RIGHT</span></i> <span
405 style='color:black'>= 6;</span></span></p>
406 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
407 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
408 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
409 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
410 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
411 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
412 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
413 style='color:#7F0055'>public</span></b> <span style='color:black'>PictogramElement
414 add(IAddContext context) {</span></span></p>
415 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
416 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
417 EClass addedClass = (EClass) context.getNewObject();</span></p>
418 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
419 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
420 Diagram targetDiagram = (Diagram) context.getTargetContainer();</span></p>
421 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
422 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
423 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
424 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
425 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
426 style='color:#3F7F5F'>// CONTAINER SHAPE WITH ROUNDED RECTANGLE</span></span></p>
427 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
428 style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
429 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> IPeCreateService
430 peCreateService = Graphiti.getPeCreateService();</span></p>
431 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
432 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
433 ContainerShape containerShape =</span></p>
434 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
435 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
436 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> peCreateService<span
437 style='color:black'>.createContainerShape(targetDiagram,</span> <b><span
438 style='color:#7F0055'>true</span></b><span style='color:black'>);</span></span></p>
439 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
440 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
441 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
442 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
443 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
444 style='color:#3F7F5F'>// check whether the context has a size (e.g. from a
445 create feature)</span></span></p>
446 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
447 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
448 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
449 style='color:#3F7F5F'>// otherwise define a default size for the shape</span></span></p>
450 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
451 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
452 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
453 style='color:#7F0055'>int</span></b> <span style='color:black'>width =
454 context.getWidth() &lt;= 0 ? 100 : context.getWidth();</span></span></p>
455 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
456 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
457 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
458 style='color:#7F0055'>int</span></b> <span style='color:black'>height =
459 context.getHeight() &lt;= 0 ? 50 : context.getHeight();</span></span></p>
460 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
461 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
462 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
463 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
464 RoundedRectangle roundedRectangle;</span><span lang=EN-US style='font-size:
465 10.0pt;font-family:"Courier New"'> <span style='color:#3F7F5F'>// need to
466 access it later</span></span></p>
467 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
468 style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
469 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> &nbsp;IGaService
470 gaService = Graphiti.getGaService();</span></p>
471 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
472 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
473 {</span></p>
474 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
475 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
476 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
477 style='color:#3F7F5F'>// create invisible outer rectangle expanded by</span></span></p>
478 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
479 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
480 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
481 style='color:#3F7F5F'>// the width needed for the anchor</span></span></p>
482 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
483 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
484 Rectangle invisibleRectangle =</span></p>
485 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
486 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
487 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> gaService<span
488 style='color:black'>.createInvisibleRectangle(containerShape);</span></span></p>
489 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
490 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
491 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang=EN-US
492 style='font-size:10.0pt;font-family:"Courier New"'>gaService<span
493 style='color:black'>.setLocationAndSize(invisibleRectangle,</span></span></p>
494 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
495 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
496 context.getX(), context.getY(), width +</span><span lang=EN-US
497 style='font-size:10.0pt;font-family:"Courier New"'> <i><span
498 style='color:#0000C0'>INVISIBLE_RECT_RIGHT</span></i><span style='color:black'>,</span></span></p>
499 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
500 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
501 height);</span></p>
502 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
503 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
504 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
505 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
506 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
507 style='color:#3F7F5F'>// create and set visible rectangle inside invisible
508 rectangle</span></span></p>
509 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
510 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
511 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;roundedRectangle =</span></p>
512 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
513 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
514 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> gaService<span
515 style='color:black'>.createRoundedRectangle(invisibleRectangle, 5, 5);</span></span></p>
516 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
517 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
518 roundedRectangle.setForeground(manageColor(</span><i><span lang=EN-US
519 style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>CLASS_FOREGROUND</span></i><span
520 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>));</span></p>
521 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
522 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
523 roundedRectangle.setBackground(manageColor(</span><i><span lang=EN-US
524 style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>CLASS_BACKGROUND</span></i><span
525 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>));</span></p>
526 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
527 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
528 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;roundedRectangle.setLineWidth(2);</span></p>
529 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
530 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
531 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> gaService<span
532 style='color:black'>.setLocationAndSize(roundedRectangle, 0,</span></span></p>
533 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
534 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
535 0, width, height);</span></p>
536 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
537 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
538 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
539 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
540 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
541 style='color:#3F7F5F'>// create link and wire it</span></span></p>
542 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
543 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
544 link(containerShape, addedClass);</span></p>
545 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
546 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
547 }</span></p>
548 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
549 style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>&nbsp;</span></p>
550 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
551 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
552 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
553 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
554 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
555 style='color:#3F7F5F'>// ... EXISTING CODING ...</span></span></p>
556 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
557 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
558 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
559 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
560 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
561 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
562 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
563 style='color:#3F7F5F'>// add a chopbox anchor to the shape</span></span></p>
564 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
565 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
566 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> peCreateService<span
567 style='color:black'>.createChopboxAnchor(containerShape);</span></span></p>
568 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
569 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
570 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
571 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
572 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
573 style='color:#3F7F5F'>// create an additional box relative anchor at middle-right</span></span></p>
574 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
575 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
576 BoxRelativeAnchor boxAnchor =</span></p>
577 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
578 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
579 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> peCreateService<span
580 style='color:black'>.createBoxRelativeAnchor(containerShape);</span></span></p>
581 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
582 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
583 boxAnchor.setRelativeWidth(1.0);</span></p>
584 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
585 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
586 boxAnchor.setRelativeHeight(0.5);</span></p>
587 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
588 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
589 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
590 style='color:#3F7F5F'>// anchor references visible rectangle instead of
591 invisible rectangle</span></span></p>
592 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
593 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
594 boxAnchor.setReferencedGraphicsAlgorithm(roundedRectangle);</span></p>
595 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
596 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
597 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
598 style='color:#3F7F5F'>// assign a graphics algorithm for the box relative
599 anchor</span></span></p>
600 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
601 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
602 Rectangle boxRect =</span><span lang=EN-US style='font-size:10.0pt;
603 font-family:"Courier New"'> gaService<span style='color:black'>.createRectangle(boxAnchor);</span></span></p>
604 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
605 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
606 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
607 style='color:#3F7F5F'>// anchor is located on the right border of the visible
608 rectangle</span></span></p>
609 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
610 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
611 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
612 style='color:#3F7F5F'>// and touches the border of the invisible rectangle</span></span></p>
613 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
614 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
615 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
616 style='color:#7F0055'>int</span></b> <span style='color:black'>w =</span> <i><span
617 style='color:#0000C0'>INVISIBLE_RECT_RIGHT</span></i><span style='color:black'>;</span></span></p>
618 <p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
619 color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
620 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
jpasch6e886342010-09-17 13:28:25 +0000621 gaService.setLocationAndSize(boxRect, -w, -w, 2 * w, 2 * w); </span></p>
jpasch3e395602010-07-08 11:41:42 +0000622 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
623 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
624 Color c =</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
625 gaService<span style='color:black'>.manageColor(getDiagram(), IColorConstant.</span><i><span
626 style='color:#0000C0'>DARK_BLUE</span></i><span style='color:black'>);</span></span></p>
627 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
628 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
629 boxRect.setBackground(c);</span></p>
630 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
631 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
632 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
633 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
634 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
635 style='color:#3F7F5F'>// call the layout feature</span></span></p>
636 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
637 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
638 lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> </span><span
639 style='font-size:10.0pt;font-family:"Courier New";color:black'>layoutPictogramElement(containerShape);</span></p>
640 <p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
641 font-family:"Courier New"'>&nbsp;</span></p>
642 <p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
643 font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
644 style='font-size:10.0pt;font-family:"Courier New"'> <b><span
645 style='color:#7F0055'>return</span></b> <span style='color:black'>containerShape;</span></span></p>
646 <p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
647 font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp; }</span></p>
648 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
649 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;</span></p>
650 </td>
651 </tr>
mwenzb5dc2f92010-06-16 13:24:52 +0000652</table>
jpasch3e395602010-07-08 11:41:42 +0000653
654<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
655
656<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
657
658<p class=MsoNormal><span lang=EN-US style='color:black'>Next we have to change
659the layout method of the <a href="layout-feature.htm">layout feature</a><span
660class=code1><span style='font-style:normal'>. Previously it adjusted the size
661of the inner graphics algorithms (line and text) in relation to the container
662graphics algorithm (visible rectangle). Now it has to adjust the size of the
663inner graphics algorithms (visible rectangle, line and text) in relation to the
664container graphics algorithm (invisible rectangle).</span></span></span></p>
665
666<p class=MsoNormal><span class=code1><span lang=EN-US style='color:black;
667font-style:normal'>The implementation can be seen in the following
668code-snippet:</span></span></p>
669
670<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
671
672<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=851
673 style='width:18.0cm;border-collapse:collapse'>
674 <tr>
675 <td width=851 valign=top style='width:18.0cm;border:solid windowtext 1.0pt;
676 padding:0cm 5.4pt 0cm 5.4pt'>
677 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
678 style='color:black'>&nbsp;</span></p>
679 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
680 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
681 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
682 "Courier New";color:#7F0055'>public</span></b><span lang=EN-US> </span><b><span
683 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>boolean</span></b><span
684 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
685 color:black'>layout(ILayoutContext context) {</span></p>
686 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
687 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
688 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
689 "Courier New";color:#7F0055'>boolean</span></b><span lang=EN-US> </span><span
690 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>anythingChanged
691 =</span><span lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;
692 font-family:"Courier New";color:#7F0055'>false</span></b><span lang=EN-US
693 style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
694 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
695 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
696 ContainerShape containerShape =</span></p>
697 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
698 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
699 (ContainerShape) context.getPictogramElement();</span></p>
700 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
701 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
702 GraphicsAlgorithm containerGa = containerShape.getGraphicsAlgorithm();</span></p>
703 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
704 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
705 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
706 color:#3F7F5F'>// the containerGa is the invisible rectangle</span></p>
707 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
708 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
709 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
710 color:#3F7F5F'>// containing the visible rectangle as its (first and only)
711 child</span></p>
712 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
713 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
714 GraphicsAlgorithm rectangle =</span></p>
715 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
716 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
717 containerGa.getGraphicsAlgorithmChildren().get(0);</span></p>
718 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
719 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
720 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
721 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
722 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
723 color:#3F7F5F'>// height of invisible rectangle</span></p>
724 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
725 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
726 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
727 "Courier New";color:#7F0055'>if</span></b><span lang=EN-US> </span><span
728 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>(containerGa.getHeight()
729 &lt;</span><span lang=EN-US> </span><i><span lang=EN-US style='font-size:
730 10.0pt;font-family:"Courier New";color:#0000C0'>MIN_HEIGHT</span></i><span
731 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>) {</span></p>
732 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
733 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
734 containerGa.setHeight(</span><i><span lang=EN-US style='font-size:10.0pt;
735 font-family:"Courier New";color:#0000C0'>MIN_HEIGHT</span></i><span
736 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span></p>
737 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
738 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
739 anythingChanged =</span><span lang=EN-US> </span><b><span lang=EN-US
740 style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>true</span></b><span
741 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
742 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
743 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
744 }</span></p>
745 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
746 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
747 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
748 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
749 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
750 color:#3F7F5F'>// height of visible rectangle (same as invisible rectangle)</span></p>
751 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
752 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
753 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
754 "Courier New";color:#7F0055'>if</span></b><span lang=EN-US> </span><span
755 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>(rectangle.getHeight()
756 != containerGa.getHeight()) {</span></p>
757 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
758 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
759 rectangle.setHeight(containerGa.getHeight());</span></p>
760 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
761 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
762 anythingChanged =</span><span lang=EN-US> </span><b><span lang=EN-US
763 style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>true</span></b><span
764 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
765 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
766 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
767 }</span></p>
768 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
769 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
770 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
771 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
772 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
773 color:#3F7F5F'>// width of invisible rectangle</span></p>
774 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
775 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
776 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
777 "Courier New";color:#7F0055'>if</span></b><span lang=EN-US> </span><span
778 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>(containerGa.getWidth()
779 &lt;</span><span lang=EN-US> </span><i><span lang=EN-US style='font-size:
780 10.0pt;font-family:"Courier New";color:#0000C0'>MIN_WIDTH</span></i><span
781 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>) {</span></p>
782 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
783 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;
784 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;containerGa.setWidth(</span><i><span
785 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>MIN_WIDTH</span></i><span
786 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span></p>
787 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
788 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
789 anythingChanged =</span><span lang=EN-US> </span><b><span lang=EN-US
790 style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>true</span></b><span
791 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
792 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
793 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
794 }</span></p>
795 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
796 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
797 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
798 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
799 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
800 color:#3F7F5F'>// width of visible rectangle (smaller than invisible
801 rectangle)</span></p>
802 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
803 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
804 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
805 "Courier New";color:#7F0055'>int</span></b><span lang=EN-US> </span><span
806 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>rectangleWidth
807 =</span></p>
808 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
809 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
810 containerGa.getWidth()</span></p>
811 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
812 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
jpasch6e886342010-09-17 13:28:25 +0000813 - TutorialAddEClassFeature.</span><i><span lang=EN-US style='font-size:10.0pt;
jpasch3e395602010-07-08 11:41:42 +0000814 font-family:"Courier New";color:#0000C0'>INVISIBLE_RECT_RIGHT</span></i><span
815 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
816 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
817 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
818 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
819 "Courier New";color:#7F0055'>if</span></b><span lang=EN-US> </span><span
820 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>(rectangle.getWidth()
821 != rectangleWidth) {</span></p>
822 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
823 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
824 rectangle.setWidth(rectangleWidth);</span></p>
825 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
826 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
827 anythingChanged =</span><span lang=EN-US> </span><b><span lang=EN-US
828 style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>true</span></b><span
829 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
830 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
831 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
832 }</span></p>
833 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
834 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
835 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
836 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
837 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
838 color:#3F7F5F'>// width of text and line (same as visible rectangle)</span></p>
839 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
840 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
841 Iterator iter = containerShape.getChildren().iterator();</span></p>
842 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
843 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
844 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
845 "Courier New";color:#7F0055'>while</span></b><span lang=EN-US> </span><span
846 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>(iter.hasNext())
847 {</span></p>
848 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
849 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
850 Shape shape = (Shape) iter.next();</span></p>
851 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
852 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
853 GraphicsAlgorithm graphicsAlgorithm = shape.getGraphicsAlgorithm();</span></p>
854 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
855 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
856 IGaService gaService = Graphiti.getGaService();</span></p>
857 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
858 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
859 IDimension size =</span></p>
860 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
861 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
862 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>gaService<span
863 style='color:black'>.<i>calculateSize</i>(graphicsAlgorithm);</span></span></p>
864 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
865 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
866 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
867 "Courier New";color:#7F0055'>if</span></b><span lang=EN-US> </span><span
868 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>(rectangleWidth
869 != size.getWidth()) {</span></p>
870 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
871 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
872 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
873 "Courier New";color:#7F0055'>if</span></b><span lang=EN-US> </span><span
874 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>(graphicsAlgorithm</span><span
875 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
876 "Courier New";color:#7F0055'>instanceof</span></b><span lang=EN-US> </span><span
877 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>Polyline)
878 {</span></p>
879 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
880 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
881 Polyline polyline = (Polyline) graphicsAlgorithm;</span></p>
882 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
883 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
884 Point secondPoint = polyline.getPoints().get(1);</span></p>
885 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
886 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
887 Point newSecondPoint =</span></p>
888 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
889 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
890 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>gaService<span
891 style='color:black'>.<i>createPoint</i>(rectangleWidth,</span></span></p>
892 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
893 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
894 secondPoint.getY());</span></p>
895 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
896 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
897 polyline.getPoints().set(1, newSecondPoint);</span></p>
898 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
899 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
900 anythingChanged =</span><span lang=EN-US> </span><b><span lang=EN-US
901 style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>true</span></b><span
902 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
903 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
904 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
905 }</span><span lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;
906 font-family:"Courier New";color:#7F0055'>else</span></b><span lang=EN-US> </span><span
907 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>{</span></p>
908 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
909 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
910 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>gaService<span
jpasch6e886342010-09-17 13:28:25 +0000911 style='color:black'>.<i>setWidth</i>(graphicsAlgorithm,</span></span></p>
jpasch3e395602010-07-08 11:41:42 +0000912 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
913 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
914 rectangleWidth);</span></p>
915 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
916 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
917 anythingChanged =</span><span lang=EN-US> </span><b><span lang=EN-US
918 style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>true</span></b><span
919 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
920 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
921 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
922 }</span></p>
923 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
924 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
925 }</span></p>
926 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
927 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
928 }</span></p>
929 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
930 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
931 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
932 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
933 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
934 "Courier New";color:#7F0055'>return</span></b><span lang=EN-US> </span><span
935 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>anythingChanged;</span></p>
936 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
937 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
938 lang=EN-US> </span><span style='font-size:10.0pt;font-family:"Courier New";
939 color:black'>}</span></p>
940 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
941 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;</span></p>
942 </td>
943 </tr>
944</table>
945
946<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
947
948<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
949
950<h2><span lang=EN-US>Test: Create a EClass with Extended Rendering Area</span></h2>
951
952<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
953
954<p class=MsoNormal><span lang=EN-US style='color:black'>Start the editor and
955create a new EClass. Verify that the EClass and its selection-handles look
956similar to the figures above.&nbsp;</span></p>
957
958<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
959
960<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
961
962<h2><span lang=EN-US>Adjusting the Selection Behavior</span></h2>
963
964<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
965
966<p class=MsoNormal><span lang=EN-US style='color:black'>As you can see above
967the selection-handles of the EClass are around the invisible rectangle.</span></p>
968
969<p class=MsoNormal><span lang=EN-US style='color:black'>This is not a good
970selection-behavior, because the user considers the visible rectangle as the
971&#8216;main&#8217; graphics algorithm and doesn&#8217;t care about the extra
972space needed to show the anchor. This also means that when resizing/moving the
973EClass, this should be done on the visible rectangle and not the invisible
974rectangle.</span></p>
975
976<p class=MsoNormal><span lang=EN-US style='color:black'>In the following we
977want to change the selection behavior in a way that the selection-handles
978appear directly around the visible rectangle, as you can see in the following
979figure:</span></p>
980
981<p class=MsoNormal><span style='color:black'><img border=0 width=121 height=71
982src="visio/rendering-area-2c.gif"></span></p>
983
984<p class=MsoCaption><span class=code1><span lang=EN-US style='font-style:normal'>Figure:
985Selection-handles around the visible rectangle</span></span><span lang=EN-US>&nbsp;</span></p>
986
987<p class=MsoNormal><span lang=EN-US style='color:black'>Additionally we want to
988define the visible rectangle as the selection-area, which activates the
989selection when the mouse clicks into it. So a mouse click on the invisible
990rectangle outside the visible rectangle will no longer activate the
991selection.&nbsp;</span></p>
992
993<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
994
995<p class=MsoNormal><span lang=EN-GB style='color:black'>Selection areas are
996defined in the tool behavior provider.</span></p>
997
998<p class=MsoNormal><span lang=EN-GB style='color:black'>If you didn&#8217;t do
999so already you must <b>first create a tool behavior provider and add it to the
1000diagram type provider as described <a href="tool-behavior-provider.htm">here</a>.</b></span></p>
1001
1002<p class=MsoNormal><span lang=EN-GB style='color:black'>The following methods
1003of the tool behavior provider must be overwritten:</span></p>
1004
jpasch6e886342010-09-17 13:28:25 +00001005<p class=MsoNormal><span lang=EN-GB style='color:black'>The method
1006<a href="../../../javadoc/org/eclipse/graphiti/tb/IToolBehaviorProvider.html#getSelectionBorder(org.eclipse.graphiti.mm.pictograms.PictogramElement)">
1007getSelectionBorder</a>
jpasch3e395602010-07-08 11:41:42 +00001008has to return one graphics algorithm, which defines the selection-handle.</span></p>
1009
jpasch6e886342010-09-17 13:28:25 +00001010<p class=MsoNormal><span lang=EN-GB style='color:black'>The method
1011<a href="../../../javadoc/org/eclipse/graphiti/tb/IToolBehaviorProvider.html#getClickArea(org.eclipse.graphiti.mm.pictograms.PictogramElement)">
1012getClickArea</a>
jpasch3e395602010-07-08 11:41:42 +00001013has to return multiple graphics algorithms, which union defines the
1014selection-area inside which mouse-clicks activate the selection.</span></p>
1015
1016<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
1017
1018<p class=MsoNormal><span lang=EN-GB style='color:black'>In this example we want
1019to return the visible rectangle in both methods. &nbsp;</span></p>
1020
1021<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
1022
1023<p class=MsoNormal><span lang=EN-GB style='color:black'>You can see the
1024complete implementation of the selection area here:</span></p>
1025
1026<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
1027
1028<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=851
1029 style='width:18.0cm;border-collapse:collapse'>
1030 <tr>
1031 <td width=851 valign=top style='width:18.0cm;border:solid windowtext 1.0pt;
1032 padding:0cm 5.4pt 0cm 5.4pt'>
1033 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1034 style='color:black'>&nbsp;&nbsp;</span></p>
1035 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1036 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
1037 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
1038 color:#646464'>@Override</span></p>
1039 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1040 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
1041 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
1042 "Courier New";color:#7F0055'>public</span></b><span lang=EN-US> </span><span
1043 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>GraphicsAlgorithm[]
jpasch255f62c2010-09-20 11:31:43 +00001044 getClickArea(PictogramElement pe) {</span></p>
jpasch3e395602010-07-08 11:41:42 +00001045 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1046 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1047 IFeatureProvider featureProvider = getFeatureProvider();</span></p>
1048 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1049 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1050 Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);</span></p>
1051 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1052 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
1053 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
1054 "Courier New";color:#7F0055'>if</span></b><span lang=EN-US> </span><span
1055 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>(bo</span><span
1056 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
1057 "Courier New";color:#7F0055'>instanceof</span></b><span lang=EN-US> </span><span
1058 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>EClass)
1059 {</span></p>
1060 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1061 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1062 GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm();</span></p>
1063 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1064 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1065 GraphicsAlgorithm rectangle =</span></p>
1066 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1067 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1068 invisible.getGraphicsAlgorithmChildren().get(0);</span></p>
1069 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1070 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
1071 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
1072 "Courier New";color:#7F0055'>return</span></b><span lang=EN-US> </span><b><span
1073 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>new</span></b><span
1074 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
1075 color:black'>GraphicsAlgorithm[] { rectangle };</span></p>
1076 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1077 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1078 }</span></p>
1079 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1080 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
1081 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
1082 "Courier New";color:#7F0055'>return</span></b><span lang=EN-US> </span><b><span
1083 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>super</span></b><span
jpasch255f62c2010-09-20 11:31:43 +00001084 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>.getClickArea(pe);</span></p>
jpasch3e395602010-07-08 11:41:42 +00001085 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1086 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
1087 }</span></p>
1088 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1089 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
1090 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1091 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
1092 lang=EN-US> </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
1093 color:#646464'>@Override</span></p>
1094 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1095 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
1096 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
1097 "Courier New";color:#7F0055'>public</span></b><span lang=EN-US> </span><span
1098 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>GraphicsAlgorithm
jpasch6e886342010-09-17 13:28:25 +00001099 getSelectionBorder(</span></p>
jpasch3e395602010-07-08 11:41:42 +00001100 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1101 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1102 PictogramElement pe) {</span></p>
1103 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1104 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1105 IFeatureProvider featureProvider = getFeatureProvider();</span></p>
1106 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1107 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1108 Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);</span></p>
1109 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1110 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
1111 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
1112 "Courier New";color:#7F0055'>if</span></b><span lang=EN-US> </span><span
1113 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>(bo</span><span
1114 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
1115 "Courier New";color:#7F0055'>instanceof</span></b><span lang=EN-US> </span><span
1116 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>EClass)
1117 {</span></p>
1118 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1119 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1120 GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm();<br>
1121 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1122 EList&lt;GraphicsAlgorithm&gt; graphicsAlgorithmChildren =<br>
1123 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1124 invisible.getGraphicsAlgorithmChildren();</span></p>
1125 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1126 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
1127 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1128 style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1129 <b><span style='color:purple'>if</span></b>
1130 (!graphicsAlgorithmChildren.isEmpty()) {<br>
1131 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1132 <b><span style='color:purple'>return</span></b>
1133 graphicsAlgorithmChildren.get(0);<br>
1134 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
1135 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1136 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1137 }</span></p>
1138 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1139 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
1140 lang=EN-US> </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
1141 "Courier New";color:#7F0055'>return</span></b><span lang=EN-US> </span><b><span
1142 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>super</span></b><span
jpasch6e886342010-09-17 13:28:25 +00001143 lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>.getSelectionBorder(pe);</span></p>
jpasch3e395602010-07-08 11:41:42 +00001144 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1145 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;</span><span
1146 lang=EN-US> </span><span style='font-size:10.0pt;font-family:"Courier New";
1147 color:black'>}</span></p>
1148 <p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
1149 font-family:"Courier New"'>&nbsp;</span></p>
1150 <p class=MsoNormal style='text-autospace:none'><span lang=EN-US
1151 style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;</span></p>
1152 </td>
1153 </tr>
1154</table>
1155
1156<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
1157
1158<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
1159
1160<h2><span lang=EN-US>Test: Verify the Adjusted Selection Behavior</span></h2>
1161
1162<p class=MsoNormal><i><span lang=EN-US style='color:black'>Note</span></i><span
1163lang=EN-US style='color:black'>: This change is incompatible with diagrams
1164created in earlier stages of the tutorial. You will get an exception, when
1165opening these diagrams.</span></p>
1166
1167<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
1168
1169<p class=MsoNormal><span lang=EN-US>S<span style='color:black'>tart the editor
1170and create a new EClass. Click on the visible rectangle and verify that the
1171selection-handles are only around the visible rectangle.&nbsp;Click slightly
1172right of the visible rectangle on the invisible rectangle and verify that the
1173EClass becomes deselected.</span></span></p>
1174
1175<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
1176
1177<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
1178
1179<div class=MsoNormal align=center style='text-align:center'>
1180
1181<hr size=3 width="100%" align=center>
1182
mwenzb5dc2f92010-06-16 13:24:52 +00001183</div>
jpasch3e395602010-07-08 11:41:42 +00001184
1185<p class=MsoNormal><a href="http://www.eclipse.org/legal/epl-v10.html"
1186shape=rect>Copyright (c) SAP AG 2005, 2010.</a> </p>
1187
1188</div>
1189
mwenzb5dc2f92010-06-16 13:24:52 +00001190</body>
jpasch3e395602010-07-08 11:41:42 +00001191
mwenzb5dc2f92010-06-16 13:24:52 +00001192</html>