/*
 * @(#)FigureChangeEvent.java 5.1
 *
 */

package CH.ifa.draw.framework;

import java.awt.Rectangle;
import java.util.EventObject;

import de.renew.draw.storables.ontology.Figure;


/**
 * FigureChange event passed to FigureChangeListeners.
 * @deprecated This class is not to be used externally. Please use {@link de.renew.draw.storables.ontology.FigureChangeEvent} instead.
 */
@Deprecated
public class FigureChangeEvent extends EventObject
    implements de.renew.draw.storables.ontology.FigureChangeEvent
{

    private static final Rectangle EMPTY_RECTANGLE = new Rectangle(0, 0, 0, 0);
    /**
     * Represents the area in the drawing that is being modified or tracked.
     */
    private final Rectangle _rectangle;

    /**
     * Constructs an event for the given source Figure. The rectangle is the
     * area to be invalidated.
     * @param source the object on which the Event initially occurred.
     * @param r the area to be invalidated.
     * @deprecated This constructor is not to be used externally. Please use the method {@link de.renew.draw.storables.api.StorableApi#createFigureChangeEvent(Figure, Rectangle)} instead.
     */
    @Deprecated
    public FigureChangeEvent(Figure source, Rectangle r) {
        super(source);
        _rectangle = r;
    }

    /**
     * Constructs an event for the given source Figure.
     *
     * @param source the object on which the Event initially occurred.
     * @deprecated This constructor is not to be used externally. Please use the method {@link de.renew.draw.storables.api.StorableApi#createFigureChangeEvent(Figure)} instead.
     */
    @Deprecated
    public FigureChangeEvent(Figure source) {
        super(source);
        _rectangle = EMPTY_RECTANGLE;
    }

    /**
     *  Gets the changed figure
     * @return the changed figure.
     */
    public Figure getFigure() {
        return (Figure) getSource();
    }

    /**
     *  Gets the changed rectangle
     * @return the invalidated rectangle
     */
    public Rectangle getInvalidatedRectangle() {
        return _rectangle;
    }

}