Draw2D v2.0

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, middle, or end of the Connection.


Field Summary
static int END
           
static int MIDDLE
           
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 START
           
 
Constructor Summary
ConnectionLocator(Connection connection)
          Constructs a ConnectionLocator with the passed connection and MIDDLE alignment.
ConnectionLocator(Connection connection, int align)
          Constructs a ConnectionLocator with the passed Connection and alignment.
 
Method Summary
 int getAlignment()
          Returns 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.
protected  void setAlignment(int align)
          Sets alignment to passed value.
protected  void setConnection(Connection connection)
          Sets Connection associated with ConnectionLocator to passed Connection.
 
Methods inherited from class org.eclipse.draw2d.AbstractLocator
getGap, getNewBounds, getRelativePosition, relocate, setGap, setRelativePosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START

public static final int START

END

public static final int END

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.


MIDDLE

public static final int MIDDLE
Constructor Detail

ConnectionLocator

public ConnectionLocator(Connection connection)
Constructs a ConnectionLocator with the passed connection and MIDDLE alignment.
Since:
2.0

ConnectionLocator

public ConnectionLocator(Connection connection,
                         int align)
Constructs a ConnectionLocator with the passed Connection and alignment.
Parameters:
connection - Connection that ConnectionLocator is associated with.
align - Alignment of ConnectionLocator. Valid values are integer constants START, MIDDLE, or END
Since:
2.0
Method Detail

getAlignment

public int getAlignment()
Returns alignment of ConnectionLocator.
Since:
2.0

getConnection

protected Connection getConnection()
Returns connection associated with ConnectionLocator.
Since:
2.0

getReferencePoint

protected Point getReferencePoint()
Returns ConnectionLocator's reference point.
Overrides:
getReferencePoint in class AbstractLocator
Since:
2.0

getLocation

protected Point getLocation(PointList points)
Returns a point from the passed PointList dependent on ConnectionLocator's alignment. If START, returns first point in points If END, returns last point in points If MIDDLE, returns middle of line represented by points.
Since:
2.0

setAlignment

protected void setAlignment(int align)
Sets alignment to passed value.
Since:
2.0

setConnection

protected void setConnection(Connection connection)
Sets Connection associated with ConnectionLocator to passed Connection.
Since:
2.0

Draw2D v2.0