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); }
public void add(TreeableReportRow newChild) { if (newChild != null && newChild.getParent() == this) insert(newChild, getChildCount() - 1); else insert(newChild, getChildCount()); }
public void remove(int childIndex) { TreeableReportRow child = (TreeableReportRow) getChildAt(childIndex); children.removeElementAt(childIndex); child.setParent(null); }