Runtime

## org.eclipse.gmf.runtime.diagram.ui.handles
Class ConnectionHandleLocator

    java.lang.Object
      org.eclipse.gmf.runtime.diagram.ui.handles.ConnectionHandleLocator

All Implemented Interfaces:
  Locator

public class ConnectionHandleLocator
extends java.lang.Object
implements Locator

This locator is used to locate all the handles around the shape the closest distance to the mouse location. It spaces the handles a certain distance apart. Call setEastWestSouth(true) to indicate that the connection handle can only be located on the east, west, or south side of the reference figure.

Constructor Summary
`ConnectionHandleLocator(IFigure reference, Point cursorPosition)` Constructor for ConnectionHandleLocator.

Method Summary
`void` `addHandle(ConnectionHandle handle)` Adds a connection handle to the list of handles.
`int` `getBorderSide()` Gets the side (West, South, or East) on which the handles will appear, using the cursor position passed in to the constructor.
`protected Point` `getCursorPosition()` Gets the cursor position.
`protected IFigure` `getReference()` Gets the reference figure.
`boolean` `isEastWestSouth()` Can the connection handle can only be located on the east, west, or south side of the reference figure.
`void` `relocate(IFigure target)` Locates the figure on the appropriate edge of the parent depending on which side is closest to the reference point.
`void` `setEastWestSouth(boolean eastWestSouth)` Set to true if the connection handle can only be located on the east, west, or south side of the reference figure.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ConnectionHandleLocator

    public ConnectionHandleLocator(IFigure reference,
                                   Point cursorPosition)

  Constructor for ConnectionHandleLocator.

Parameters:
  `reference` - the figure
  `cursorPosition` - the handles will be located on the border of the shape as close to this position as possible

Method Detail

### addHandle

    public void addHandle(ConnectionHandle handle)

  Adds a connection handle to the list of handles.

  Parameters:
    `handle` - the `ConnectionHandle` to add

### getBorderSide

    public int getBorderSide()

  Gets the side (West, South, or East) on which the handles will appear, using the cursor position passed in to the constructor.

  Returns:
    the side, a value in PositionContstants

### relocate

    public void relocate(IFigure target)

  Locates the figure on the appropriate edge of the parent depending on which side is closest to the reference point. Then adjusts the figure depending on the number of handles that this locator has so that the handles are spaced out from the center along the edge of the shape.

  Specified by:
    `relocate` in interface `Locator`
  See Also:
    `Locator.relocate(org.eclipse.draw2d.IFigure)`

### getReference

    protected IFigure getReference()

  Gets the reference figure.

  Returns:
    Returns the reference.

### getCursorPosition

    protected Point getCursorPosition()

  Gets the cursor position.

  Returns:
    Returns the cursorPosition.

### isEastWestSouth

    public boolean isEastWestSouth()

  Can the connection handle can only be located on the east, west, or south side of the reference figure.

  Returns:
    Returns true if the connection handle can only be located on the east, west, or south side of the reference figure; false otherwise.

### setEastWestSouth

    public void setEastWestSouth(boolean eastWestSouth)

  Set to true if the connection handle can only be located on the east, west, or south side of the reference figure.

  Parameters:
    `eastWestSouth` - The bEastWestSouth to set.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.