public int compare(Object o1, Object o2) { if (sorting_column == -1) return 0; if ((o1 instanceof ITask) == false) return 0; if ((o2 instanceof ITask) == false) return 0; ITask task1 = (ITask) o1; ITask task2 = (ITask) o2; // based on TaskTableModel.columnNames switch (sorting_column) { case 1: return task1.getText().compareTo(task2.getText()); case 2: return task1.getStartDate().getDate().compareTo(task2.getStartDate().getDate()); case 3: return task1.getEndDate().getDate().compareTo(task2.getEndDate().getDate()); case 0: // task priority, same as 4 case 4: return task1.getPriority() - task2.getPriority(); case 5: return task1.getStatus(CurrentDate.get()) - task2.getStatus(CurrentDate.get()); case 6: return task1.getProgress() - task2.getProgress(); } return 0; }
/** @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 ""; }