/**
  * Removes a figure from the composite.
  *
  * @see #removeAll
  */
 public Figure remove(Figure figure) {
   if (fFigures.contains(figure)) {
     figure.removeFromContainer(this);
     fFigures.removeElement(figure);
   }
   return figure;
 }
 /** Adds a figure to the list of figures. Initializes the the figure's container. */
 public Figure add(Figure figure) {
   if (!fFigures.contains(figure)) {
     fFigures.addElement(figure);
     figure.addToContainer(this);
   }
   return figure;
 }
 /** Brings a figure to the front. */
 public synchronized void bringToFront(Figure figure) {
   if (fFigures.contains(figure)) {
     fFigures.removeElement(figure);
     fFigures.addElement(figure);
     figure.changed();
   }
 }
 /** Sends a figure to the back of the drawing. */
 public synchronized void sendToBack(Figure figure) {
   if (fFigures.contains(figure)) {
     fFigures.removeElement(figure);
     fFigures.insertElementAt(figure, 0);
     figure.changed();
   }
 }
 /** Replaces a figure in the drawing without removing it from the drawing. */
 public synchronized void replace(Figure figure, Figure replacement) {
   int index = fFigures.indexOf(figure);
   if (index != -1) {
     replacement.addToContainer(this); // will invalidate figure
     figure.changed();
     fFigures.setElementAt(replacement, index);
   }
 }
 /**
  * Gets the handles of the figure. It returns the normal PolyLineHandles but adds
  * ChangeConnectionHandles at the start and end.
  */
 public Vector handles() {
   Vector handles = new Vector(fPoints.size());
   handles.addElement(new ChangeConnectionStartHandle(this));
   for (int i = 1; i < fPoints.size() - 1; i++) {
     handles.addElement(new PolyLineHandle(this, locator(i), i));
   }
   handles.addElement(new ChangeConnectionEndHandle(this));
   return handles;
 }
 /**
  * Removes all children.
  *
  * @see #remove
  */
 public void removeAll() {
   FigureEnumeration k = figures();
   while (k.hasMoreElements()) {
     Figure figure = k.nextFigure();
     figure.removeFromContainer(this);
   }
   fFigures.removeAllElements();
 }
 /**
  * Removes a vector of figures.
  *
  * @see #remove
  */
 public void removeAll(Vector figures) {
   Enumeration k = figures.elements();
   while (k.hasMoreElements()) remove((Figure) k.nextElement());
 }
 /**
  * Adds a vector of figures.
  *
  * @see #add
  */
 public void addAll(Vector newFigures) {
   Enumeration k = newFigures.elements();
   while (k.hasMoreElements()) add((Figure) k.nextElement());
 }
 public String getMap() {
   String areas = "";
   Enumeration k = fFigures.elements();
   while (k.hasMoreElements()) areas += ((Storable) k.nextElement()).getMap();
   return areas;
 }
 /** Writes the contained figures to the StorableOutput. */
 public void write(StorableOutput dw) {
   super.write(dw);
   dw.writeInt(fFigures.size());
   Enumeration k = fFigures.elements();
   while (k.hasMoreElements()) dw.writeStorable((Storable) k.nextElement());
 }
 /** Gets number of child figures. */
 public int figureCount() {
   return fFigures.size();
 }
 /** Gets a figure at the given index. */
 public Figure figureAt(int i) {
   return (Figure) fFigures.elementAt(i);
 }
 /**
  * Removes a figure from the figure list, but doesn't release it. Use this method to temporarily
  * manipulate a figure outside of the drawing.
  */
 public synchronized Figure orphan(Figure figure) {
   fFigures.removeElement(figure);
   return figure;
 }