rectangleManipulator.getHandleInteractor().addLayerListener(new LayerAdapter() {
public void mouseReleased(LayerEvent e) {
Figure fig = e.getFigureSource();
if (fig instanceof RectangleGrabHandle) {
Site site = ((RectangleGrabHandle) fig).getSite();
CanvasFigure f = (CanvasFigure)site.getFigure();
if (site.getID() == 0) {
f.fireCanvasFigureEvent(CanvasFigure.ROTATED);
} else {
f.fireCanvasFigureEvent(CanvasFigure.RESIZED);
}
}