/**
   * Connects the figure to the new target. If there is no new target the connection reverts to its
   * original one.
   */
  public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) {
    Connector target = findConnectionTarget(x, y, view.drawing());
    if (target == null) {
      target = fOriginalTarget;
    }

    setPoint(x, y);
    connect(target);
    getConnection().updateConnection();

    Connector oldConnector =
        ((ChangeConnectionHandle.UndoActivity) getUndoActivity()).getOldConnector();
    // there has been no change so there is nothing to undo
    if ((oldConnector == null)
        || (target() == null)
        || (oldConnector.owner() == target().owner())) {
      setUndoActivity(null);
    } else {
      getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(getConnection()));
    }

    if (getTargetFigure() != null) {
      getTargetFigure().connectorVisibility(false);
      setTargetFigure(null);
    }
  }
 /**
  * Gets the end figure of the connection.
  *
  * @return The end figure or null if not connected
  * @see CH.ifa.draw.framework.ConnectionFigure#endFigure()
  */
 public Figure endFigure() {
   if (endConnector != null) {
     return endConnector.owner();
   }
   return null;
 }
 /**
  * Gets the start figure of the connection.
  *
  * @return The start figure or null if not connected
  * @see CH.ifa.draw.framework.ConnectionFigure#startFigure()
  */
 public Figure startFigure() {
   if (startConnector != null) {
     return startConnector.owner();
   }
   return null;
 }