Example #1
0
  public void insert(TreeableReportRow newChild, int childIndex) {
    if (newChild == null) {
      throw new IllegalArgumentException("new child is null");
    } else if (isNodeAncestor(newChild)) {
      throw new IllegalArgumentException("new child is an ancestor");
    }

    TreeableReportRow oldParent = (TreeableReportRow) newChild.getParent();

    if (oldParent != null) {
      oldParent.remove(newChild);
    }
    newChild.setParent(this);
    if (children == null) {
      children = new Vector();
    }
    children.insertElementAt(newChild, childIndex);
  }
Example #2
0
 public void remove(int childIndex) {
   TreeableReportRow child = (TreeableReportRow) getChildAt(childIndex);
   children.removeElementAt(childIndex);
   child.setParent(null);
 }