/** @see net.sf.memoranda.ui.treetable.ITreeTableModel#getValueAt(java.lang.Object, int) */ public Object getValueAt(Object node, int column) { if (node instanceof IProject) return null; ITask t = (ITask) node; switch (column) { case 0: return ""; case 1: return t; case 2: return t.getStartDate().getDate(); case 3: if (t.getEndDate() == null) return null; else return t.getEndDate().getDate(); case 4: return getPriorityString(t.getPriority()); case 5: return getStatusString(t.getStatus(CurrentDate.get())); case 6: // return new Integer(t.getProgress()); return t; case TaskTable.TASK_ID: return t.getID(); case TaskTable.TASK: return t; } return ""; }
/** @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]; }