Package org.eclipse.draw2d

# Class AbstractConnectionAnchor

java.lang.Object
org.eclipse.draw2d.ConnectionAnchorBase
org.eclipse.draw2d.AbstractConnectionAnchor

All Implemented Interfaces:
  `AncestorListener`, `ConnectionAnchor`

Direct Known Subclasses:
  `ChopboxAnchor`, `EllipseAnchor`

public abstract class AbstractConnectionAnchor extends ConnectionAnchorBase implements AncestorListener
Provides support for anchors which depend on a figure for thier location.

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.draw2d.AncestorListener

`AncestorListener.Stub`

## Field Summary

### Fields inherited from class org.eclipse.draw2d.ConnectionAnchorBase

`listeners`

## Constructor Summary

Constructors
Constructor
Description
`AbstractConnectionAnchor()`
Constructs an AbstractConnectionAnchor with no owner.
`AbstractConnectionAnchor(IFigure owner)`
Constructs an AbstractConnectionAnchor with the owner supplied as input.

## Method Summary

Modifier and Type
Method
Description
`void`
`addAnchorListener(AnchorListener listener)`
Adds the given listener to the listeners to be notified of anchor location changes.
`void`
`ancestorAdded(IFigure ancestor)`
Called when an ancestor has been added into the listening figure's hierarchy.
`void`
`ancestorMoved(IFigure figure)`
Notifies all the listeners of this anchor's location change.
`void`
`ancestorRemoved(IFigure ancestor)`
Called when an ancestor has been removed from the listening figure's hierarchy.
`IFigure`
`getOwner()`
Returns the owner Figure on which this anchor's location is dependent.
`Point`
`getReferencePoint()`
Returns the point which is used as the reference by this AbstractConnectionAnchor.
`void`
`removeAnchorListener(AnchorListener listener)`
Removes the given listener from this anchor.
`void`
`setOwner(IFigure owner)`
Sets the owner of this anchor, on whom this anchors location is dependent.

### Methods inherited from class org.eclipse.draw2d.ConnectionAnchorBase

`fireAnchorMoved`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.eclipse.draw2d.ConnectionAnchor

`getLocation`

## Constructor Details

### AbstractConnectionAnchor

public AbstractConnectionAnchor()
Constructs an AbstractConnectionAnchor with no owner.

Since:
  2.0

### AbstractConnectionAnchor

public AbstractConnectionAnchor(IFigure owner)
Constructs an AbstractConnectionAnchor with the owner supplied as input.

Parameters:
  `owner` - Owner of this anchor
Since:
  2.0

## Method Details

### addAnchorListener

public void addAnchorListener(AnchorListener listener)
Adds the given listener to the listeners to be notified of anchor location changes.

Specified by:
  `addAnchorListener` in interface `ConnectionAnchor`
Overrides:
  `addAnchorListener` in class `ConnectionAnchorBase`
Parameters:
  `listener` - Listener to be added
Since:
  2.0
See Also:
  - `removeAnchorListener(AnchorListener)`

### ancestorMoved

public void ancestorMoved(IFigure figure)
Notifies all the listeners of this anchor's location change.

Specified by:
  `ancestorMoved` in interface `AncestorListener`
Parameters:
  `figure` - Anchor-owning Figure which has moved
Since:
  2.0
See Also:
  - `AncestorListener.ancestorMoved(IFigure)`

### ancestorAdded

public void ancestorAdded(IFigure ancestor)
Description copied from interface: `AncestorListener`
Called when an ancestor has been added into the listening figure's hierarchy.

Specified by:
  `ancestorAdded` in interface `AncestorListener`
Parameters:
  `ancestor` - The ancestor that was added
See Also:
  - `AncestorListener.ancestorAdded(IFigure)`

### ancestorRemoved

public void ancestorRemoved(IFigure ancestor)
Description copied from interface: `AncestorListener`
Called when an ancestor has been removed from the listening figure's hierarchy.

Specified by:
  `ancestorRemoved` in interface `AncestorListener`
Parameters:
  `ancestor` - The ancestor that has been removed
See Also:
  - `AncestorListener.ancestorRemoved(IFigure)`

### getOwner

public IFigure getOwner()
Returns the owner Figure on which this anchor's location is dependent.

Specified by:
  `getOwner` in interface `ConnectionAnchor`
Returns:
  Owner of this anchor
Since:
  2.0
See Also:
  - `setOwner(IFigure)`

### getReferencePoint

public Point getReferencePoint()
Returns the point which is used as the reference by this AbstractConnectionAnchor. It is generally dependent on the Figure which is the owner of this AbstractConnectionAnchor.

Specified by:
  `getReferencePoint` in interface `ConnectionAnchor`
Returns:
  The reference point of this anchor
Since:
  2.0
See Also:
  - `ConnectionAnchor.getReferencePoint()`

### removeAnchorListener

public void removeAnchorListener(AnchorListener listener)
Removes the given listener from this anchor. If all the listeners are removed, then this anchor removes itself from its owner.

Specified by:
  `removeAnchorListener` in interface `ConnectionAnchor`
Overrides:
  `removeAnchorListener` in class `ConnectionAnchorBase`
Parameters:
  `listener` - Listener to be removed from this anchors listeners list
Since:
  2.0
See Also:
  - `addAnchorListener(AnchorListener)`

### setOwner

public void setOwner(IFigure owner)
Sets the owner of this anchor, on whom this anchors location is dependent.

Parameters:
  `owner` - Owner of this anchor
Since:
  2.0