~cdparra/gelee/trunk

« back to all changes in this revision

Viewing changes to webui/editor/draw2d/ConnectionAnchor.js

  • Committer: parra
  • Date: 2010-03-15 15:56:56 UTC
  • Revision ID: svn-v4:ac5bba68-f036-4e09-846e-8f32731cc928:trunk/gelee:1448
merged gelee at svn

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This notice must be untouched at all times.
 
2
 
 
3
Open-jACOB Draw2D
 
4
The latest version is available at
 
5
http://www.openjacob.org
 
6
 
 
7
Copyright (c) 2006 Andreas Herz. All rights reserved.
 
8
Created 5. 11. 2006 by Andreas Herz (Web: http://www.freegroup.de )
 
9
 
 
10
LICENSE: LGPL
 
11
 
 
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.
 
16
 
 
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.
 
21
 
 
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
 
26
*/
 
27
 
 
28
/**
 
29
 * Provides support for a anchor. A anchor is one of the end points
 
30
 * of a {@link draw2d.Connection}.
 
31
 *
 
32
 * @version 0.9.14
 
33
 * @author Andreas Herz
 
34
 * @constructor
 
35
 */
 
36
draw2d.ConnectionAnchor=function(/*:draw2d.Port*/ owner)
 
37
{
 
38
   this.owner = owner;
 
39
}
 
40
 
 
41
draw2d.ConnectionAnchor.prototype.type="ConnectionAnchor";
 
42
 
 
43
/**
 
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
 
48
 */
 
49
draw2d.ConnectionAnchor.prototype.getLocation=function(/*:draw2d.Point*/ reference)
 
50
{
 
51
   // return the center of the owner.
 
52
   return this.getReferencePoint();
 
53
}
 
54
 
 
55
/**
 
56
 * Returns the Figure that contains this ConnectionAnchor.
 
57
 * @return The Figure that contains this ConnectionAnchor
 
58
 */
 
59
draw2d.ConnectionAnchor.prototype.getOwner = function()
 
60
{
 
61
   return this.owner;
 
62
}
 
63
 
 
64
/**
 
65
 * Set the owner of the Anchor.
 
66
 */
 
67
draw2d.ConnectionAnchor.prototype.setOwner = function(/*:draw2d.Port*/ owner)
 
68
{
 
69
   this.owner=owner;
 
70
}
 
71
 
 
72
/**
 
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)
 
75
 *
 
76
 * @return The bounds of this Anchor's owner
 
77
 */
 
78
draw2d.ConnectionAnchor.prototype.getBox=function()
 
79
{
 
80
  return this.getOwner().getAbsoluteBounds();
 
81
}
 
82
 
 
83
/**
 
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
 
87
 */
 
88
draw2d.ConnectionAnchor.prototype.getReferencePoint = function()
 
89
{
 
90
   if (this.getOwner() == null)
 
91
     return null;
 
92
   else 
 
93
     return this.getOwner().getAbsolutePosition();
 
94
}