1
/* This notice must be untouched at all times.
4
The latest version is available at
5
http://www.openjacob.org
7
Copyright (c) 2006 Andreas Herz. All rights reserved.
8
Created 5. 11. 2006 by Andreas Herz (Web: http://www.freegroup.de )
12
This library is free software; you can redistribute it and/or
13
modify it under the terms of the GNU Lesser General Public
14
License (LGPL) as published by the Free Software Foundation; either
15
version 2.1 of the License, or (at your option) any later version.
17
This library is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
Lesser General Public License for more details.
22
You should have received a copy of the GNU Lesser General Public
23
License along with this library; if not, write to the Free Software
24
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,
25
or see http://www.gnu.org/copyleft/lesser.html
29
* Provides support for a anchor. A anchor is one of the end points
30
* of a {@link draw2d.Connection}.
33
* @author Andreas Herz
36
draw2d.ConnectionAnchor=function(/*:draw2d.Port*/ owner)
41
draw2d.ConnectionAnchor.prototype.type="ConnectionAnchor";
44
* Returns the location where the Connection should be anchored in absolute coordinates.
45
* The anchor may use the given reference Point to calculate this location.
46
* @param reference The reference Point in absolute coordinates
47
* @return The anchor's location
49
draw2d.ConnectionAnchor.prototype.getLocation=function(/*:draw2d.Point*/ reference)
51
// return the center of the owner.
52
return this.getReferencePoint();
56
* Returns the Figure that contains this ConnectionAnchor.
57
* @return The Figure that contains this ConnectionAnchor
59
draw2d.ConnectionAnchor.prototype.getOwner = function()
65
* Set the owner of the Anchor.
67
draw2d.ConnectionAnchor.prototype.setOwner = function(/*:draw2d.Port*/ owner)
73
* Returns the bounds of this Anchor's owner. Subclasses can override this method
74
* to adjust the box. Maybe you return the box of the port parent (the parent figure)
76
* @return The bounds of this Anchor's owner
78
draw2d.ConnectionAnchor.prototype.getBox=function()
80
return this.getOwner().getAbsoluteBounds();
84
* Returns the reference point for this anchor in absolute coordinates. This might be used
85
* by another anchor to determine its own location.
86
* @return The reference Point
88
draw2d.ConnectionAnchor.prototype.getReferencePoint = function()
90
if (this.getOwner() == null)
93
return this.getOwner().getAbsolutePosition();