/** @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object) */
 public int getChildCount(Object parent) {
   if (parent instanceof IProject) {
     if (activeOnly()) {
       return CurrentProject.getTaskList().getActiveSubTasks(null, CurrentDate.get()).size();
     } else return CurrentProject.getTaskList().getTopLevelTasks().size();
   }
   ITask t = (ITask) parent;
   if (activeOnly())
     return CurrentProject.getTaskList().getActiveSubTasks(t.getID(), CurrentDate.get()).size();
   else return t.getSubTasks().size();
 }
 /** @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int) */
 public Object getChild(Object parent, int index) {
   if (parent instanceof IProject)
     if (activeOnly())
       return CurrentProject.getTaskList()
           .getActiveSubTasks(null, CurrentDate.get())
           .toArray()[index];
     else return CurrentProject.getTaskList().getTopLevelTasks().toArray()[index];
   ITask t = (ITask) parent;
   if (activeOnly())
     return CurrentProject.getTaskList()
         .getActiveSubTasks(t.getID(), CurrentDate.get())
         .toArray()[index];
   else return t.getSubTasks().toArray()[index];
 }
  public Object getChild(Object parent, int index) {
    Collection c = null;

    if (parent instanceof IProject) {
      if (activeOnly()) c = CurrentProject.getTaskList().getActiveSubTasks(null, CurrentDate.get());
      else c = CurrentProject.getTaskList().getTopLevelTasks();
    } else {
      ITask t = (ITask) parent;
      if (activeOnly())
        c = CurrentProject.getTaskList().getActiveSubTasks(t.getID(), CurrentDate.get());
      else c = t.getSubTasks();
    }

    Object array[] = c.toArray();
    Arrays.sort(array, comparator);
    if (opposite) {
      return array[array.length - index - 1];
    }
    return array[index];
  }