public abstract class CompositeFigure extends AbstractFigure implements FigureChangeListener
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Figure> |
fFigures |
listenerList
Constructor and Description |
---|
CompositeFigure() |
Modifier and Type | Method and Description |
---|---|
Figure |
add(Figure figure) |
protected void |
basicMoveBy(int dx,
int dy)
This is the hook method to be overridden when a figure moves.
|
void |
draw(java.awt.Graphics g)
Draws the figure.
|
void |
figureChanged(FigureChangeEvent e)
Sent when a figure changed
|
void |
figureInvalidated(FigureChangeEvent e)
Sent when an area is invalid
|
void |
figureRemoved(FigureChangeEvent e)
Sent when a figure was removed
|
void |
figureRequestRemove(FigureChangeEvent e)
Sent when requesting to remove a figure.
|
void |
figureRequestUpdate(FigureChangeEvent e)
Sent when an update should happen.
|
Figure |
findFigure(int x,
int y) |
java.util.Iterator<Figure> |
iterator()
NOTE: Iteration is not thread safe.
|
Figure |
remove(Figure figure) |
addFigureChangeListener, changed, invalidate, moveBy, removeFigureChangeListener, willChange
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
displayBox
protected java.util.List<Figure> fFigures
public java.util.Iterator<Figure> iterator()
public Figure findFigure(int x, int y)
public void draw(java.awt.Graphics g)
Figure
protected void basicMoveBy(int dx, int dy)
AbstractFigure
basicMoveBy
in class AbstractFigure
dx
- the delta to move in x directiondy
- the delta to move in y directionpublic void figureInvalidated(FigureChangeEvent e)
FigureChangeListener
figureInvalidated
in interface FigureChangeListener
e
- the event containing information about the changepublic void figureChanged(FigureChangeEvent e)
FigureChangeListener
figureChanged
in interface FigureChangeListener
e
- the event containing information about the changepublic void figureRemoved(FigureChangeEvent e)
FigureChangeListener
figureRemoved
in interface FigureChangeListener
e
- the event containing information about the changepublic void figureRequestRemove(FigureChangeEvent e)
FigureChangeListener
figureRequestRemove
in interface FigureChangeListener
e
- the event containing information about the changepublic void figureRequestUpdate(FigureChangeEvent e)
FigureChangeListener
figureRequestUpdate
in interface FigureChangeListener
e
- the event containing information about the changeFrom the book: Flexible, Reliable Software, © CRC Press 2010. Author: Henrik B. Christensen, Aarhus University, Denmark