| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta name="generator" content= |
| "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org"> |
| <meta http-equiv="Content-Type" content= |
| "text/html; charset=us-ascii"> |
| <meta name="Generator" content="Microsoft Word 12 (filtered)"> |
| <title>Connection anchors</title> |
| <link rel="Stylesheet" type="text/css" media="all" href= |
| "../book.css"> |
| <style type="text/css"> |
| <!-- |
| /* Font Definitions */ |
| @font-face |
| {font-family:"Cambria Math"; |
| panose-1:2 4 5 3 5 4 6 3 2 4;} |
| @font-face |
| {font-family:Tahoma; |
| panose-1:2 11 6 4 3 5 4 4 2 4;} |
| @font-face |
| {font-family:Consolas; |
| panose-1:2 11 6 9 2 2 4 3 2 4;} |
| /* Style Definitions */ |
| p.MsoNormal, li.MsoNormal, div.MsoNormal |
| {margin:0cm; |
| margin-bottom:.0001pt; |
| font-size:12.0pt; |
| font-family:"Times New Roman","serif";} |
| h1 |
| {mso-style-link:"Überschrift 1 Zchn"; |
| margin-top:12.0pt; |
| margin-right:0cm; |
| margin-bottom:3.0pt; |
| margin-left:0cm; |
| page-break-after:avoid; |
| font-size:16.0pt; |
| font-family:"Times New Roman","serif"; |
| font-weight:bold;} |
| h2 |
| {mso-style-link:"Überschrift 2 Zchn"; |
| margin-top:12.0pt; |
| margin-right:0cm; |
| margin-bottom:3.0pt; |
| margin-left:0cm; |
| page-break-after:avoid; |
| font-size:14.0pt; |
| font-family:"Times New Roman","serif"; |
| font-weight:bold; |
| font-style:italic;} |
| h3 |
| {mso-style-link:"Überschrift 3 Zchn"; |
| margin-top:12.0pt; |
| margin-right:0cm; |
| margin-bottom:3.0pt; |
| margin-left:0cm; |
| page-break-after:avoid; |
| font-size:13.0pt; |
| font-family:"Times New Roman","serif"; |
| font-weight:bold;} |
| h4 |
| {mso-style-link:"Überschrift 4 Zchn"; |
| margin-top:11.25pt; |
| margin-right:0cm; |
| margin-bottom:1.7pt; |
| margin-left:0cm; |
| font-size:12.0pt; |
| font-family:"Times New Roman","serif"; |
| font-weight:bold; |
| font-style:italic;} |
| h5 |
| {mso-style-link:"Überschrift 5 Zchn"; |
| margin-right:0cm; |
| margin-left:0cm; |
| font-size:10.0pt; |
| font-family:"Times New Roman","serif"; |
| font-weight:bold;} |
| p.MsoCaption, li.MsoCaption, div.MsoCaption |
| {margin-top:6.0pt; |
| margin-right:0cm; |
| margin-bottom:24.0pt; |
| margin-left:0cm; |
| text-align:justify; |
| font-size:10.0pt; |
| font-family:"Times New Roman","serif"; |
| font-weight:bold;} |
| a:link, span.MsoHyperlink |
| {color:blue; |
| text-decoration:underline;} |
| a:visited, span.MsoHyperlinkFollowed |
| {color:purple; |
| text-decoration:underline;} |
| p |
| {margin-top:5.65pt; |
| margin-right:0cm; |
| margin-bottom:5.65pt; |
| margin-left:0cm; |
| font-size:12.0pt; |
| font-family:"Times New Roman","serif";} |
| pre |
| {mso-style-link:"HTML Vorformatiert Zchn"; |
| margin-top:0cm; |
| margin-right:0cm; |
| margin-bottom:0cm; |
| margin-left:3.4pt; |
| margin-bottom:.0001pt; |
| font-size:11.0pt; |
| font-family:"Courier New";} |
| p.MsoAcetate, li.MsoAcetate, div.MsoAcetate |
| {mso-style-link:"Sprechblasentext Zchn"; |
| margin:0cm; |
| margin-bottom:.0001pt; |
| font-size:8.0pt; |
| font-family:"Tahoma","sans-serif";} |
| span.berschrift1Zchn |
| {mso-style-name:"Überschrift 1 Zchn"; |
| mso-style-link:"Überschrift 1"; |
| font-family:"Cambria","serif"; |
| color:#365F91; |
| font-weight:bold;} |
| span.berschrift2Zchn |
| {mso-style-name:"Überschrift 2 Zchn"; |
| mso-style-link:"Überschrift 2"; |
| font-family:"Cambria","serif"; |
| color:#4F81BD; |
| font-weight:bold;} |
| span.berschrift3Zchn |
| {mso-style-name:"Überschrift 3 Zchn"; |
| mso-style-link:"Überschrift 3"; |
| font-family:"Cambria","serif"; |
| color:#4F81BD; |
| font-weight:bold;} |
| span.berschrift4Zchn |
| {mso-style-name:"Überschrift 4 Zchn"; |
| mso-style-link:"Überschrift 4"; |
| font-family:"Cambria","serif"; |
| color:#4F81BD; |
| font-weight:bold; |
| font-style:italic;} |
| span.berschrift5Zchn |
| {mso-style-name:"Überschrift 5 Zchn"; |
| mso-style-link:"Überschrift 5"; |
| font-family:"Cambria","serif"; |
| color:#243F60;} |
| span.HTMLVorformatiertZchn |
| {mso-style-name:"HTML Vorformatiert Zchn"; |
| mso-style-link:"HTML Vorformatiert"; |
| font-family:Consolas;} |
| span.SprechblasentextZchn |
| {mso-style-name:"Sprechblasentext Zchn"; |
| mso-style-link:Sprechblasentext; |
| font-family:"Tahoma","sans-serif";} |
| p.code, li.code, div.code |
| {mso-style-name:code; |
| margin-top:0cm; |
| margin-right:0cm; |
| margin-bottom:0cm; |
| margin-left:15.0pt; |
| margin-bottom:.0001pt; |
| font-size:12.0pt; |
| font-family:"Times New Roman","serif";} |
| p.note, li.note, div.note |
| {mso-style-name:note; |
| margin-top:19.5pt; |
| margin-right:0cm; |
| margin-bottom:19.5pt; |
| margin-left:30.0pt; |
| font-size:13.0pt; |
| font-family:"Times New Roman","serif"; |
| font-style:italic;} |
| span.code1 |
| {mso-style-name:code1; |
| font-style:italic;} |
| span.code0 |
| {mso-style-name:code0; |
| font-style:italic;} |
| .MsoChpDefault |
| {font-size:10.0pt;} |
| @page Section1 |
| {size:595.45pt 841.7pt; |
| margin:72.0pt 89.85pt 72.0pt 89.85pt;} |
| div.Section1 |
| {page:Section1;} |
| --> |
| </style> |
| </head> |
| <body bgcolor="white" lang="DE" link="blue" vlink="purple" style= |
| 'margin-bottom:12.0pt'> |
| <div class="Section1"> |
| <h1><span lang="EN-GB">Connection Anchors</span></h1> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <h2><span lang="EN-US">Different Types of Connection |
| Anchors</span></h2> |
| <p class="MsoNormal"><span lang="EN-US" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-US" style= |
| 'color:black'>Currently the following different types of |
| connection anchors are supported:</span></p> |
| <p class="MsoNormal"><span lang="EN-US" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><b><span lang="EN-US" style= |
| 'color:black'>Chop Box Anchor</span></b></p> |
| <p class="MsoNormal"><span lang="EN-US" style='color:black'>It |
| can be created calling <a href= |
| "file://///wdfd00184898a/../javadoc/com/sap/tc/emf/gfw/util/PeUtil.html#createChopboxAnchor(AnchorContainer)"> |
| createChopboxAnchor</a>. A chop box anchor is located virtually |
| in the center of the parent. However, the connection line does |
| not end at the center of the parent but already at the |
| intersection-point with the parent boundaries. This means |
| especially, that the intersection-point is re-calculated not only |
| when the parents size or location changes, but also when the |
| direction of the connection changes.</span></p> |
| <p class="MsoNormal"><span style='color:black'><img border="0" |
| width="164" height="104" src="visio/anchor-chopbox.gif" alt= |
| ""></span></p> |
| <p class="MsoCaption"><span class="code1"><span lang="EN-US" |
| style='font-style:normal'>Figure: Chop box anchor (always |
| pointing to the center)</span></span></p> |
| <p class="MsoNormal"><b><span lang="EN-US" style= |
| 'color:black'>Box Relative Anchor</span></b></p> |
| <p class="MsoNormal"><span lang="EN-US" style='color:black'>It |
| can be created calling <a href= |
| "file://///wdfd00184898a/../javadoc/com/sap/tc/emf/gfw/util/PeUtil.html#createBoxRelativeAnchor(AnchorContainer)"> |
| createBoxRelativeAnchor</a>. A box relative anchor is located |
| relative to the size and location of the parent. The |
| x/y-coordinates are defined as percentage values between 0.0 and |
| 1.0. This allows for example to locate an anchor always at the |
| middle-right border of the parent (x=1.0, y=0.5). The location of |
| the anchor is re-calculated whenever the parents size or location |
| changes.</span></p> |
| <p class="MsoNormal"><span style='color:black'><img border="0" |
| width="165" height="95" src="visio/anchor-boxrelative.gif" alt= |
| ""></span></p> |
| <p class="MsoCaption"><span class="code1"><span lang="EN-US" |
| style='font-style:normal'>Figure: Box relative anchor (on |
| middle-right border)</span></span></p> |
| <p class="MsoNormal"><b><span lang="EN-US" style= |
| 'color:black'>Fix Point Anchor</span></b></p> |
| <p class="MsoNormal"><span lang="EN-US" style='color:black'>It |
| can be created calling <a href= |
| "file://///wdfd00184898a/../javadoc/com/sap/tc/emf/gfw/util/PeUtil.html#createFixPointAnchor(AnchorContainer)"> |
| createFixPointAnchor</a>. A fix point anchor is located at fix |
| x/y-coordinates (relative to the parent).</span></p> |
| <p class="MsoNormal"><span lang="EN-US"> </span></p> |
| <p class="MsoNormal"><span lang="EN-US"> </span></p> |
| <h2><span lang="EN-US">Connection Anchor Points |
| Explained</span></h2> |
| <p class="MsoNormal"><span lang="EN-US" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-US" style='color:black'>Every |
| connection has two connection anchors which provide the points |
| where the connection starts/ends. Additionally the connection can |
| have multiple bend-points in between.</span></p> |
| <p class="MsoNormal"><span lang="EN-US" style='color:black'>An |
| anchor has two points: the “reference-point” is the |
| logical end-point of the connection and the |
| “location” is the visible end-point of the |
| connection.</span></p> |
| <p class="MsoNormal"><span lang="EN-US" style='color:black'>The |
| following sketch explains those points for a chop box |
| anchor.</span></p> |
| <p class="MsoNormal"><span lang="EN-US"> </span></p> |
| <p class="MsoNormal"><img border="0" width="444" height="154" |
| src="visio/anchor-points.gif" alt=""></p> |
| <p class="MsoCaption"><span class="code1"><span lang="EN-US" |
| style='font-style:normal'>Figure: Points of a chop box |
| anchor</span></span></p> |
| <p class="MsoNormal"><span lang="EN-US">The reference-point (R) |
| of the chop box anchor is the middle of the figure, because this |
| is the point where the connection logically ends. The |
| reference-point changes if the figure changes, but it does not |
| change depending on the connection.</span></p> |
| <p class="MsoNormal"><span lang="EN-US">We define the point (O) |
| as the other point where the connection logically ends. If the |
| connection has bend-points, then (O) is the bend-point (B) next |
| to the anchor, otherwise (O) is the reference-point (R) of the |
| other connection anchor. This means, that logically the |
| connection is a line from (R) to (O).</span></p> |
| <p class="MsoNormal"><span lang="EN-US">But a line drawn from (R) |
| to (O) would overlap the figure. To avoid this overlap the |
| location (L) of an anchor is calculated from (R) and (O) as the |
| visible end-point of the connection. In case of the chop box |
| anchor (L) is the intersection between the line (R - O) and the |
| border of the figure.</span></p> |
| <p class="MsoNormal"><span lang="EN-US"> </span></p> |
| <p class="MsoNormal"><span lang="EN-US">The same algorithm is |
| applied for all other anchor types, although often the |
| calculation is much simpler. For example in a fix point anchor |
| the reference-point (R) is the point the anchor was initialized |
| with and the location (L) is identical to (R).</span></p> |
| <p class="MsoNormal"><span lang="EN-US"> </span></p> |
| <p class="MsoNormal"><span lang="EN-US"> </span></p> |
| <h2><span lang="EN-US">Creating Connections with Drag & Drop |
| from Anchors</span></h2> |
| <p class="MsoNormal"><span lang="EN-US" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style='color:black'>If |
| the user shall be able to create connections directly via drag |
| & drop from an anchor without the connection-tool, this can |
| be implemented by so called drag & drop features. This does |
| not work for chop box anchors, because they have no visible |
| anchor which can be dragged.</span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style='color:black'>To |
| offer drag & drop functionality from anchors we have to |
| overwrite the <a href= |
| "file://///wdfd00184898a/../javadoc/com/sap/tc/emf/gfw/features/IFeatureProvider.html#getDragAndDropFeatures(com.sap.tc.emf.gfw.features.context.IPictogramElementContext)"> |
| getDragAndDropFeatures</a>.</span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style='color:black'>If |
| this method returns exactly one feature it will be executed |
| directly on drop (if applicable). If you provide more than one |
| feature the user will be presented a popup menu on drop showing |
| all applicable features (applicable means <a href= |
| "file://///wdfd00184898a/../javadoc/com/sap/tc/emf/gfw/features/IFeature.html#canExecute(com.sap.tc.emf.gfw.features.context.IContext)"> |
| canExecute</a> returns true). The user can select the desired |
| feature which will be executed then.</span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style='color:black'>In |
| this example we first add a box relative anchor on the |
| middle-right border of a EClass. Then we support drag & drop |
| from that anchor to another EClass, which will create a new |
| connection.</span></p> |
| <p class="MsoNormal"><span lang="EN-US" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style='color:black'>First |
| the box relative anchors have to be created at end of the add |
| method of the</span> <span class="code1"><span lang="EN-US" |
| style='color:black'>TutorialAddEClassFeature</span></span><span class="code1"><span lang="EN-US" |
| style='color:black;font-style:normal'>, as explained in the |
| following code snippet. Note, that the previously created chop |
| box anchor (see <a href="create-connection-feature.htm">create |
| connection feature</a>) remains, so that the EClass has then two |
| anchors:</span></span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <table class="MsoNormalTable" border="0" cellspacing="0" |
| cellpadding="0" width="851" style= |
| 'width:18.0cm;border-collapse:collapse'> |
| <tr> |
| <td width="851" valign="top" style= |
| 'width:18.0cm;border:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt'> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-GB" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'> </span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <b><span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#7F0055'>public</span></b> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt; font-family:"Courier New";color:black'>PictogramElement |
| add(IAddContext context) {</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#3F7F5F'>// |
| ... EXiSTING CODING ...</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'> </span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#3F7F5F'>// |
| add a chopbox anchor to the shape</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'> |
| IPeCreateService peCreateService = |
| Graphiti.getPeCreateService();</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'>peCreateService<span style='color:black'>.createChopboxAnchor(containerShape);</span></span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'> </span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#3F7F5F'>// |
| add a box relative anchor to the shape at middle-right</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> |
| BoxRelativeAnchor boxAnchor =</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'>peCreateService<span style='color:black'>.createBoxRelativeAnchor(containerShape);</span></span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> |
| boxAnchor.setRelativeWidth(1.0);</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> |
| boxAnchor.setRelativeHeight(0.5);</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#3F7F5F'>// |
| assign a rectangle graphics algorithm for the box relative |
| anchor</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#3F7F5F'>// |
| note, that the rectangle is inside the border of the rectangle |
| shape</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'>IGaService gaService |
| = Graphiti.getGaService();</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> |
| Rectangle boxRect =</span> <span lang="EN-US" style= |
| 'font-size:10.0pt; font-family:"Courier New"'>gaService<span style='color:black'>.createRectangle(boxAnchor);</span></span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'>gaService<span style='color:black'>.setLocationAndSizeOfGraphicsAlgorithm(boxRect, |
| -8, -4, 8, 8);</span></span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> |
| Color c =</span> <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'>gaService<span style='color:black'>.manageColor(getDiagram(), |
| IColorConstant.</span><i><span style= |
| 'color:#0000C0'>DARK_BLUE</span></i><span style= |
| 'color:black'>);</span></span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> |
| boxRect.setBackground(c);</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'> </span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"'> <span style= |
| 'color:black'> </span> |
| <span style='color:#3F7F5F'>// call the layout |
| feature</span></span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'>layoutPictogramElement(containerShape);</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span style= |
| 'font-family:"Courier New"'> </span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <b><span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#7F0055'>return</span></b> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt; font-family:"Courier New";color:black'>containerShape;</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'>}</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span style= |
| 'font-size:10.0pt; font-family:"Courier New";color:black'> </span></p> |
| </td> |
| </tr> |
| </table> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-US" style= |
| 'color:black'>Additionally the feature provider has to deliver |
| the drag & drop features (overwrite the method <a href= |
| "file://///wdfd00184898a/../javadoc/com/sap/tc/emf/gfw/features/IFeatureProvider.html#getDragAndDropFeatures(com.sap.tc.emf.gfw.features.context.IPictogramElementContext)"> |
| getDragAndDropFeatures</a><span class= |
| "code1">)</span>.</span></p> |
| <p class="MsoNormal"><span lang="EN-US" style='color:black'>In |
| this very simple implementation all create connection features |
| are returned independent of the given context:</span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <table class="MsoNormalTable" border="0" cellspacing="0" |
| cellpadding="0" width="851" style= |
| 'width:18.0cm;border-collapse:collapse'> |
| <tr> |
| <td width="851" valign="top" style= |
| 'width:18.0cm;border:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt'> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style='color:black'> </span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#646464'>@Override</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <b><span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#7F0055'>public</span></b> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt; font-family:"Courier New";color:black'>IFeature[] |
| getDragAndDropFeatures(IPictogramElementContext context) |
| {</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <span lang="EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New"; color:#3F7F5F'>// |
| simply return all create connection features</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span lang= |
| "EN-US" style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'> </span> |
| <b><span style= |
| 'font-size:10.0pt;font-family:"Courier New";color:#7F0055'>return</span></b> |
| <span style= |
| 'font-size:10.0pt;font-family:"Courier New";color:black'>getCreateConnectionFeatures();</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span style= |
| 'font-size:10.0pt; font-family:"Courier New";color:black'> |
| }</span></p> |
| <p class="MsoNormal" style='text-autospace:none'><span style= |
| 'font-size:10.0pt; font-family:"Courier New";color:black'> </span></p> |
| </td> |
| </tr> |
| </table> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <h2><span lang="EN-GB">Test: Create a Connection with Drag & |
| Drop from Anchor</span></h2> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style='color:black'>Start |
| the editor again and create two new EClasses (existing EClasses |
| don’t work, because they have no anchor at the middle-right |
| border).</span></p> |
| <p class="MsoNormal"><span lang="EN-GB" style= |
| 'color:black'>Then</span> <span lang="EN-US" style= |
| 'color:black'>drag the anchor at the middle-right border of the |
| first EClass and drop it onto the second EClass. This will create |
| a new connection between those two EClasses.</span></p> |
| <p class="MsoNormal"><span lang="EN-US" style= |
| 'color:black'> </span></p> |
| <p class="MsoNormal"><span lang="EN-US" style= |
| 'color:black'> </span></p> |
| </div> |
| <hr> |
| <a href="http://www.eclipse.org/legal/epl-v10.html" shape="rect">Copyright (c) SAP AG 2005, 2010.</a> |
| </body> |
| </html> |