public void figureMoved(IFigure figure) {
    Rectangle bounds = figure.getBounds();

    if (relativeToParent) {
      bounds = Rectangle.SINGLETON.setBounds(bounds); // copy
      Rectangle parentBounds = figure.getParent().getBounds();
      bounds.translate(-parentBounds.x, -parentBounds.y);
    }

    Point loc = element.getLocation();
    if (loc == null || loc.x != bounds.x || loc.y != bounds.y) {
      Point newLocation = new Point(bounds.x, bounds.y);
      if (element instanceof FormElementGroup) {
        FormElementGroupPropertySource formElementGroupPropertySource =
            new FormElementGroupPropertySource((FormElementGroup) element, form);
        formElementGroupPropertySource.setLocation(newLocation);
      } else {
        element.setLocation(newLocation);
      }
    }
    Dimension dim = element.getSize();
    if (dim == null || dim.width != bounds.width || dim.height != bounds.height) {
      Dimension newSize = new Dimension(bounds.width, bounds.height);
      if (element instanceof FormElementGroup) {
        FormElementGroupPropertySource formElementGroupPropertySource =
            new FormElementGroupPropertySource((FormElementGroup) element, null);
        formElementGroupPropertySource.setSize(newSize);
      } else {
        element.setSize(newSize);
      }
    }
  }
 /**
  * Returns <code>true</code> if the point (x,y) is contained within this handle.
  *
  * @param x The x coordinate.
  * @param y The y coordinate.
  * @return <code>true</code> if the point (x,y) is contained within this handle.
  */
 public boolean containsPoint(int x, int y) {
   if (!super.containsPoint(x, y)) return false;
   return !Rectangle.SINGLETON.setBounds(getBounds()).shrink(INNER_PAD, INNER_PAD).contains(x, y);
 }