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 Details

  • Constructor Details

    • 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
  • Method Details

    • 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