예제 #1
0
  /**
   * Called to create a map the parent of each bookmark.
   *
   * @param parent top level bookmark.
   * @param parentMap map to add children to.
   * @param pagenoVector vector of page numbers.
   * @param depth object indicating bookmark depth.
   */
  protected void mapChildren(
      final Bookmark parent,
      final Hashtable parentMap,
      final Vector pagenoVector,
      final Number depth) {
    getDepthMap().put(parent, depth);

    final int pageno = parent.getPageno();

    if (pageno >= 0) {
      while (pageno >= pagenoVector.size()) {
        pagenoVector.addElement(null);
      }

      pagenoVector.setElementAt(parent, pageno);
    }

    final Enumeration e = parent.elements();

    if (e.hasMoreElements()) {
      final Number childDepth = new Integer(depth.intValue() + 1);

      do {
        final Bookmark child = (Bookmark) e.nextElement();
        parentMap.put(child, parent);
        mapChildren(child, parentMap, pagenoVector, childDepth);
      } while (e.hasMoreElements());
    }
  }
예제 #2
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);
   }
 }
예제 #3
0
public void SortChilds ()
    {
	for (int i = childs.size(); i >= 2; --i) {
	    for (int j = 0; j < i-1; ++j) {
		Point p1 = ((CGNode)childs.elementAt(j)).GetPos();
		Point p2 = ((CGNode)childs.elementAt(j+1)).GetPos();
		if (p1.y > p2.y) {
		    Object tmp = childs.elementAt (j);
		    childs.setElementAt (childs.elementAt (j+1), j);
		    childs.setElementAt (tmp, j+1);

		    tmp = arrows.elementAt (j);
		    arrows.setElementAt (arrows.elementAt (j+1), j);
		    arrows.setElementAt (tmp, j+1);
		}
	    }
	}
    }
예제 #4
0
private int LayoutPass1 (CGNode root, int y, Vector vdist, int level)
    {
	Rectangle bbox = root.Bbox();
	root.layout_y = y;
	root.SortChilds ();

	if (level >= vdist.size()) {
	    vdist.addElement (new Integer (bbox.width));
	} else {
	    int width = ((Integer)vdist.elementAt(level)).intValue();
	    if (width < bbox.width) {
		vdist.setElementAt (new Integer (bbox.width), level);
	    }
	}
	int nchilds = root.NumChilds(), y2 = y;
	for (int i = 0; i < nchilds; ++i) {
	    y2 = LayoutPass1 (root.ChildAt(i), y2, vdist, level+1);
	}
	return Math.max (y + bbox.height + layoutYDist, y2);
    }
예제 #5
0
  // set the sequence indexed by index
  public void setSequence(int index, String sequence) {
    while (index >= sequences.size()) sequences.add("");

    sequences.setElementAt(sequence, index);
  }
예제 #6
0
 public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
   if (timeList != null) {
     if (rowIndex < timeList.size()) timeList.setElementAt(aValue, rowIndex);
     else timeList.add(aValue);
   }
 }