コード例 #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);
  }
コード例 #2
0
 public void add(TreeableReportRow newChild) {
   if (newChild != null && newChild.getParent() == this) insert(newChild, getChildCount() - 1);
   else insert(newChild, getChildCount());
 }