All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class CH.ifa.draw.standard.CompositeFigure

java.lang.Object
   |
   +----CH.ifa.draw.standard.AbstractFigure
           |
           +----CH.ifa.draw.standard.CompositeFigure

public abstract class CompositeFigure
extends AbstractFigure
implements FigureChangeListener
A Figure that is composed of several figures. A CompositeFigure doesn't define any layout behavior. It is up to subclassers to arrange the contained figures.
Design Patterns

 o Composite
CompositeFigure enables to treat a composition of figures like a single figure.

See Also:
Figure

Variable Index

 o fFigures
The figures that this figure is composed of

Constructor Index

 o CompositeFigure()

Method Index

 o add(Figure)
Adds a figure to the list of figures.
 o addAll(Vector)
Adds a vector of figures.
 o basicMoveBy(int, int)
Moves all the given figures by x and y.
 o bringToFront(Figure)
Brings a figure to the front.
 o draw(Graphics)
Draws all the contained figures
 o figureAt(int)
Gets a figure at the given index.
 o figureChanged(FigureChangeEvent)
 o figureCount()
Gets number of child figures.
 o figureInvalidated(FigureChangeEvent)
Propagates the figureInvalidated event to my listener.
 o figureRemoved(FigureChangeEvent)
 o figureRequestRemove(FigureChangeEvent)
Propagates the removeFromDrawing request up to the container.
 o figureRequestUpdate(FigureChangeEvent)
Propagates the requestUpdate request up to the container.
 o figures()
Returns an Enumeration for accessing the contained figures.
 o figuresReverse()
Returns an Enumeration for accessing the contained figures in the reverse drawing order.
 o findFigure(int, int)
Finds a top level Figure.
 o findFigure(Rectangle)
Finds a top level Figure that intersects the given rectangle.
 o findFigure(Rectangle, Figure)
Finds a top level Figure that intersects the given rectangle.
 o findFigureInside(int, int)
Finds a figure but descends into a figure's children.
 o findFigureInsideWithout(int, int, Figure)
Finds a figure but descends into a figure's children.
 o findFigureWithout(int, int, Figure)
Finds a top level Figure, but supresses the passed in figure.
 o includes(Figure)
Checks if the composite figure has the argument as one of its children.
 o orphan(Figure)
Removes a figure from the figure list, but doesn't release it.
 o orphanAll(Vector)
Removes a vector of figures from the figure's list without releasing the figures.
 o read(StorableInput)
Reads the contained figures from StorableInput.
 o release()
Releases the figure and all its children.
 o remove(Figure)
Removes a figure from the composite.
 o removeAll()
Removes all children.
 o removeAll(Vector)
Removes a vector of figures.
 o replace(Figure, Figure)
Replaces a figure in the drawing without removing it from the drawing.
 o sendToBack(Figure)
Sends a figure to the back of the drawing.
 o write(StorableOutput)
Writes the contained figures to the StorableOutput.

Variables

 o fFigures
 protected Vector fFigures
The figures that this figure is composed of

See Also:
add, remove

Constructors

 o CompositeFigure
 protected CompositeFigure()

Methods

 o add
 public Figure add(Figure figure)
Adds a figure to the list of figures. Initializes the the figure's container.

 o addAll
 public void addAll(Vector newFigures)
Adds a vector of figures.

See Also:
add
 o remove
 public Figure remove(Figure figure)
Removes a figure from the composite.

See Also:
removeAll
 o removeAll
 public void removeAll(Vector figures)
Removes a vector of figures.

See Also:
remove
 o removeAll
 public void removeAll()
Removes all children.

See Also:
remove
 o orphan
 public synchronized Figure orphan(Figure figure)
Removes a figure from the figure list, but doesn't release it. Use this method to temporarily manipulate a figure outside of the drawing.

 o orphanAll
 public void orphanAll(Vector newFigures)
Removes a vector of figures from the figure's list without releasing the figures.

See Also:
orphan
 o replace
 public synchronized void replace(Figure figure,
                                  Figure replacement)
Replaces a figure in the drawing without removing it from the drawing.

 o sendToBack
 public synchronized void sendToBack(Figure figure)
Sends a figure to the back of the drawing.

 o bringToFront
 public synchronized void bringToFront(Figure figure)
Brings a figure to the front.

 o draw
 public void draw(Graphics g)
Draws all the contained figures

Overrides:
draw in class AbstractFigure
See Also:
draw
 o figureAt
 public Figure figureAt(int i)
Gets a figure at the given index.

 o figures
 public final FigureEnumeration figures()
Returns an Enumeration for accessing the contained figures. The figures are returned in the drawing order.

Overrides:
figures in class AbstractFigure
 o figureCount
 public int figureCount()
Gets number of child figures.

 o figuresReverse
 public final FigureEnumeration figuresReverse()
Returns an Enumeration for accessing the contained figures in the reverse drawing order.

 o findFigure
 public Figure findFigure(int x,
                          int y)
Finds a top level Figure. Use this call for hit detection that should not descend into the figure's children.

 o findFigure
 public Figure findFigure(Rectangle r)
Finds a top level Figure that intersects the given rectangle.

 o findFigureWithout
 public Figure findFigureWithout(int x,
                                 int y,
                                 Figure without)
Finds a top level Figure, but supresses the passed in figure. Use this method to ignore a figure that is temporarily inserted into the drawing.

Parameters:
x - the x coordinate
y - the y coordinate
without - the figure to be ignored during the find.
 o findFigure
 public Figure findFigure(Rectangle r,
                          Figure without)
Finds a top level Figure that intersects the given rectangle. It supresses the passed in figure. Use this method to ignore a figure that is temporarily inserted into the drawing.

 o findFigureInside
 public Figure findFigureInside(int x,
                                int y)
Finds a figure but descends into a figure's children. Use this method to implement click-through hit detection, that is, you want to detect the inner most figure containing the given point.

Overrides:
findFigureInside in class AbstractFigure
 o findFigureInsideWithout
 public Figure findFigureInsideWithout(int x,
                                       int y,
                                       Figure without)
Finds a figure but descends into a figure's children. It supresses the passed in figure. Use this method to ignore a figure that is temporarily inserted into the drawing.

 o includes
 public boolean includes(Figure figure)
Checks if the composite figure has the argument as one of its children.

Overrides:
includes in class AbstractFigure
 o basicMoveBy
 protected void basicMoveBy(int x,
                            int y)
Moves all the given figures by x and y. Doesn't announce any changes. Subclassers override basicMoveBy. Clients usually call moveBy.

Overrides:
basicMoveBy in class AbstractFigure
See Also:
moveBy
 o release
 public void release()
Releases the figure and all its children.

Overrides:
release in class AbstractFigure
 o figureInvalidated
 public void figureInvalidated(FigureChangeEvent e)
Propagates the figureInvalidated event to my listener.

See Also:
FigureChangeListener
 o figureRequestRemove
 public void figureRequestRemove(FigureChangeEvent e)
Propagates the removeFromDrawing request up to the container.

See Also:
FigureChangeListener
 o figureRequestUpdate
 public void figureRequestUpdate(FigureChangeEvent e)
Propagates the requestUpdate request up to the container.

See Also:
FigureChangeListener
 o figureChanged
 public void figureChanged(FigureChangeEvent e)
 o figureRemoved
 public void figureRemoved(FigureChangeEvent e)
 o write
 public void write(StorableOutput dw)
Writes the contained figures to the StorableOutput.

Overrides:
write in class AbstractFigure
 o read
 public void read(StorableInput dr) throws IOException
Reads the contained figures from StorableInput.

Overrides:
read in class AbstractFigure

All Packages  Class Hierarchy  This Package  Previous  Next  Index