org.eclipse.draw2d
Class ConnectionLocator
java.lang.Object
org.eclipse.draw2d.AbstractLocator
org.eclipse.draw2d.ConnectionLocator
-
All Implemented Interfaces:
-
Locator
-
Direct Known Subclasses:
-
ArrowLocator,
BendpointLocator,
MidpointLocator
- public class ConnectionLocator
- extends
AbstractLocator
Repositions a
Figure
attached to a
Connection
when the Connection is
moved. Provides for alignment at the start (source), middle, or end (target) of the
Connection.
Field Summary
|
static int
|
END
Deprecated. Use
TARGET
|
static int
|
MIDDLE
The middle of the Connection |
static int
|
MIDPOINT
Deprecated. Use
MIDDLE instead, since the location is not the midpoint of a
line-segment, but the middle of a polyline.
|
static int
|
SOURCE
The start (or source) of the Connection |
static int
|
START
Deprecated. Use
SOURCE
|
static int
|
TARGET
The end (or target) of the Connection |
Method Summary
|
int
|
getAlignment
()
Returns the alignment of ConnectionLocator. |
protected
Connection
|
getConnection
()
Returns connection associated with ConnectionLocator. |
protected
Point
|
getLocation
(
PointList points)
Returns a point from the passed PointList, dependent on ConnectionLocator's alignment.
|
protected
Point
|
getReferencePoint
()
Returns ConnectionLocator's reference point in absolute coordinates. |
protected void
|
setAlignment
(int align)
Sets the alignment. |
protected void
|
setConnection
(
Connection connection)
Sets the Connection to be associated with this ConnectionLocator. |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
START
public static final int START
-
Deprecated. Use
SOURCE
-
See Also:
-
Constant Field Values
SOURCE
public static final int SOURCE
- The start (or source) of the Connection
-
See Also:
-
Constant Field Values
END
public static final int END
-
Deprecated. Use
TARGET
-
See Also:
-
Constant Field Values
TARGET
public static final int TARGET
- The end (or target) of the Connection
-
See Also:
-
Constant Field Values
MIDPOINT
public static final int MIDPOINT
-
Deprecated. Use
MIDDLE
instead, since the location is not the midpoint of a
line-segment, but the middle of a polyline.
-
See Also:
-
Constant Field Values
MIDDLE
public static final int MIDDLE
- The middle of the Connection
-
See Also:
-
Constant Field Values
ConnectionLocator
public ConnectionLocator(
Connection connection)
- Constructs a ConnectionLocator with the passed connection and
MIDDLE
alignment.
-
Parameters:
-
connection
- The Connection -
Since:
- 2.0
ConnectionLocator
public ConnectionLocator(
Connection connection,
int align)
- Constructs a ConnectionLocator with the passed Connection and alignment. Valid values
for the alignment are integer constants
SOURCE
,
MIDDLE
, and
TARGET
.
-
Parameters:
-
connection
- The Connection -
align
- The alignment -
Since:
- 2.0
getAlignment
public int getAlignment()
- Returns the alignment of ConnectionLocator.
-
-
Returns:
- The alignment
-
Since:
- 2.0
getConnection
protected
Connection getConnection()
- Returns connection associated with ConnectionLocator.
-
-
Returns:
- The Connection
-
Since:
- 2.0
getReferencePoint
protected
Point getReferencePoint()
- Returns ConnectionLocator's reference point in absolute coordinates.
-
-
Specified by:
-
getReferencePoint
in class
AbstractLocator
-
-
Returns:
- The reference point
-
Since:
- 2.0
getLocation
protected
Point getLocation(
PointList points)
- Returns a point from the passed PointList, dependent on ConnectionLocator's alignment.
If the alignment is
SOURCE
, it returns the first point in points. If
TARGET
, it returns the last point in points. If
MIDDLE
, it
returns the middle of line represented by points.
-
-
Parameters:
-
points
- The points in the Connection
-
Returns:
- The location
-
Since:
- 2.0
setAlignment
protected void setAlignment(int align)
- Sets the alignment. Possible values are
SOURCE
,
MIDDLE
, and
TARGET
.
-
-
Parameters:
-
align
- The alignment -
Since:
- 2.0
setConnection
protected void setConnection(
Connection connection)
- Sets the Connection to be associated with this ConnectionLocator.
-
-
Parameters:
-
connection
- The Connection -
Since:
- 2.0
Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.