/*
* @(#)FigureChangeEvent.java
*
* Project: JHotdraw - a GUI framework for technical drawings
* http://www.jhotdraw.org
* http://jhotdraw.sourceforge.net
* Copyright: (c) by the original author(s) and all contributors
* License: Lesser GNU Public License (LGPL)
* http://www.opensource.org/licenses/lgpl-license.html
*/
package org.jhotdraw.framework;
import java.awt.Rectangle;
import java.util.EventObject;
/**
* FigureChange event passed to FigureChangeListeners.
*
* @version <$CURRENT_VERSION$>
*/
public class FigureChangeEvent extends EventObject {
private Rectangle myRectangle;
private FigureChangeEvent myNestedEvent;
private static final Rectangle EMPTY_RECTANGLE = new Rectangle(0, 0, 0, 0);
/**
* Constructs an event for the given source Figure. The rectangle is the
* area to be invalvidated.
*/
public FigureChangeEvent(Figure newSource, Rectangle newRect) {
super(newSource);
myRectangle = newRect;
}
public FigureChangeEvent(Figure newSource) {
super(newSource);
myRectangle = EMPTY_RECTANGLE;
}
public FigureChangeEvent(Figure newSource, Rectangle newRect, FigureChangeEvent nestedEvent) {
this(newSource, newRect);
myNestedEvent = nestedEvent;
}
/**
* Gets the changed figure
*/
public Figure getFigure() {
return (Figure)getSource();
}
/**
* Gets the changed rectangle
*/
public Rectangle getInvalidatedRectangle() {
return myRectangle;
}
public FigureChangeEvent getNestedEvent() {
return myNestedEvent;
}
}