예제 #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());
 }
예제 #3
0
 public void remove(int childIndex) {
   TreeableReportRow child = (TreeableReportRow) getChildAt(childIndex);
   children.removeElementAt(childIndex);
   child.setParent(null);
 }