Package org.eclipse.draw2d

# Class XYAnchor

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

All Implemented Interfaces:
  `ConnectionAnchor`

public class XYAnchor extends ConnectionAnchorBase
Supports an anchor in the XY layout. This anchor exists independently without an owner.

## Field Summary

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

`listeners`

## Constructor Summary

Constructors
Constructor
Description
`XYAnchor(Point p)`
Constructs an XYAnchor at the Point p.

## Method Summary

Modifier and Type
Method
Description
`Point`
`getLocation(Point reference)`
Returns the location of this anchor relative to the reference point given in as input.
`IFigure`
`getOwner()`
Returns `null` as these anchors inherently do not depend on other figures for their location.
`Point`
`getReferencePoint()`
Returns the point which is used as the reference by this connection anchor.
`void`
`setLocation(Point p)`
Sets the location of this anchor and notifies all the listeners of the update.

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

`addAnchorListener, fireAnchorMoved, removeAnchorListener`

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

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

## Constructor Details

### XYAnchor

public XYAnchor(Point p)
Constructs an XYAnchor at the Point p.

Parameters:
  `p` - the point where this anchor will be located
Since:
  2.0

## Method Details

### getLocation

public Point getLocation(Point reference)
Returns the location of this anchor relative to the reference point given in as input. Since this is XY layout, the location of the point is independent of the reference point.

Parameters:
  `reference` - The reference Point in absolute coordinates
Returns:
  The anchor's location
See Also:
  - `ConnectionAnchor.getLocation(Point)`

### getOwner

public IFigure getOwner()
Returns `null` as these anchors inherently do not depend on other figures for their location.

Returns:
  The IFigure that contains this ConnectionAnchor
Since:
  2.0
See Also:
  - `ConnectionAnchor.getOwner()`

### getReferencePoint

public Point getReferencePoint()
Returns the point which is used as the reference by this connection anchor. In the case of the XYAnchor, this point is the same as its location.

Returns:
  The reference Point
See Also:
  - `ConnectionAnchor.getReferencePoint()`

### setLocation

public void setLocation(Point p)
Sets the location of this anchor and notifies all the listeners of the update.

Parameters:
  `p` - the new location of this anchor
Since:
  2.0
See Also:
  - `getLocation(Point)`