예제 #1
0
 /**
  * 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;
 }
예제 #2
0
 /** 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;
 }
예제 #3
0
 /** Brings a figure to the front. */
 public synchronized void bringToFront(Figure figure) {
   if (fFigures.contains(figure)) {
     fFigures.removeElement(figure);
     fFigures.addElement(figure);
     figure.changed();
   }
 }
예제 #4
0
 /** 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();
   }
 }
예제 #5
0
 /** 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);
   }
 }
예제 #6
0
 /**
  * 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;
 }
예제 #7
0
 /**
  * Removes all children.
  *
  * @see #remove
  */
 public void removeAll() {
   FigureEnumeration k = figures();
   while (k.hasMoreElements()) {
     Figure figure = k.nextFigure();
     figure.removeFromContainer(this);
   }
   fFigures.removeAllElements();
 }
예제 #8
0
 /**
  * Removes a vector of figures.
  *
  * @see #remove
  */
 public void removeAll(Vector figures) {
   Enumeration k = figures.elements();
   while (k.hasMoreElements()) remove((Figure) k.nextElement());
 }
예제 #9
0
 /**
  * Adds a vector of figures.
  *
  * @see #add
  */
 public void addAll(Vector newFigures) {
   Enumeration k = newFigures.elements();
   while (k.hasMoreElements()) add((Figure) k.nextElement());
 }
예제 #10
0
 public String getMap() {
   String areas = "";
   Enumeration k = fFigures.elements();
   while (k.hasMoreElements()) areas += ((Storable) k.nextElement()).getMap();
   return areas;
 }
예제 #11
0
 /** 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());
 }
예제 #12
0
 /** Gets number of child figures. */
 public int figureCount() {
   return fFigures.size();
 }
예제 #13
0
 /** Gets a figure at the given index. */
 public Figure figureAt(int i) {
   return (Figure) fFigures.elementAt(i);
 }
예제 #14
0
 /**
  * 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;
 }