예제 #1
0
  public void remove(TreeableReportRow aChild) {
    if (aChild == null) {
      throw new IllegalArgumentException("argument is null");
    }

    if (!isNodeChild(aChild)) {
      throw new IllegalArgumentException("argument is not a child");
    }
    remove(getIndex(aChild)); // linear search
  }
예제 #2
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);
  }