/** Draws this handle. */
  public void draw(Graphics2D g) {
    Graphics2D gg = (Graphics2D) g.create();
    gg.transform(view.getDrawingToViewTransform());
    for (Connector c : connectors) {
      c.draw(gg);
    }

    gg.dispose();
    drawCircle(g, (getTarget() == null) ? Color.red : Color.green, Color.black);
  }
 /** Finds a new connectableConnector of the connection. */
 public void trackStep(Point anchor, Point lead, int modifiersEx) {
   Point2D.Double p = view.viewToDrawing(lead);
   view.getConstrainer().constrainPoint(p);
   connectableFigure = findConnectableFigure(p, view.getDrawing());
   if (connectableFigure != null) {
     Connector aTarget = findConnectionTarget(p, view.getDrawing());
     if (aTarget != null) {
       p = aTarget.getAnchor();
     }
   }
   getOwner().willChange();
   setLocation(p);
   getOwner().changed();
   repaintConnectors();
 }
 /**
  * Updates the list of connectors that we draw when the user moves or drags the mouse over a
  * figure to which can connect.
  */
 public void repaintConnectors() {
   Rectangle2D.Double invalidArea = null;
   for (Connector c : connectors) {
     if (invalidArea == null) {
       invalidArea = c.getDrawingArea();
     } else {
       invalidArea.add(c.getDrawingArea());
     }
   }
   connectors =
       (connectableFigure == null)
           ? new java.util.LinkedList<Connector>()
           : connectableFigure.getConnectors(getOwner());
   for (Connector c : connectors) {
     if (invalidArea == null) {
       invalidArea = c.getDrawingArea();
     } else {
       invalidArea.add(c.getDrawingArea());
     }
   }
   if (invalidArea != null) {
     view.getComponent().repaint(view.drawingToView(invalidArea));
   }
 }