Modified priority display to flow left to right and to sort by category

within priority rather than complexity.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1339 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2003-12-10 19:39:26 +00:00
parent 09f0f28705
commit 919377e18a
2 changed files with 19 additions and 25 deletions
@@ -1,5 +1,5 @@
// //
// $Id: tasks.java,v 1.1 2003/11/15 22:55:32 mdb Exp $ // $Id: tasks.java,v 1.2 2003/12/10 19:39:26 mdb Exp $
package com.samskivert.twodue.logic; package com.samskivert.twodue.logic;
@@ -51,7 +51,7 @@ public class tasks extends UserLogic
} }
// sort the tasks by priority, then complexity // sort the tasks by priority, then complexity
Collections.sort(tasks, OPEN_PARATOR); Collections.sort(tasks, TASK_PARATOR);
CatList[] xtasks = categorize(tasks, new Categorizer() { CatList[] xtasks = categorize(tasks, new Categorizer() {
public String category (Task task) { public String category (Task task) {
@@ -111,26 +111,22 @@ public class tasks extends UserLogic
return ctasks; return ctasks;
} }
protected static final Comparator OPEN_PARATOR = new Comparator() { protected static final Comparator TASK_PARATOR = new Comparator() {
public int compare (Object o1, Object o2) { public int compare (Object o1, Object o2) {
Task t1 = (Task)o1, t2 = (Task)o2; Task t1 = (Task)o1, t2 = (Task)o2;
// sort first by reverse priority, then by complexity // sort first by reverse priority, then by category, then complexity
if (t1.priority == t2.priority) { if (t1.priority == t2.priority) {
return t1.getComplexityValue() - t2.getComplexityValue(); if (t1.category.equals(t2.category)) {
return t1.getComplexityValue() - t2.getComplexityValue();
} else {
return t1.category.compareTo(t2.category);
}
} else { } else {
return t2.priority - t1.priority; return t2.priority - t1.priority;
} }
} }
}; };
protected static final Comparator OWNED_PARATOR = new Comparator() {
public int compare (Object o1, Object o2) {
Task t1 = (Task)o1, t2 = (Task)o2;
// sort by complexity
return t1.getComplexityValue() - t2.getComplexityValue();
}
};
// used to easy category generation in UI // used to easy category generation in UI
public static class CategoryTool public static class CategoryTool
{ {
+10 -12
View File
@@ -24,27 +24,18 @@ Outstanding tasks:
#end #end
</b> </b>
<table><tr><td> <!-- two column table --> <table border=0><tr><td valign="top"> <!-- two column table -->
<table cellpadding="2" cellspacing="0" border="0" width="100%">
#foreach ($xtask in $xtasks) #foreach ($xtask in $xtasks)
#if ($xtask.name == "On the list")
</table>
</td><td width="15">&nbsp;</td><td valign="top">
<table cellpadding="2" cellspacing="0" border="0" width="100%"> <table cellpadding="2" cellspacing="0" border="0" width="100%">
#else
#if ($vidx > 0)
<tr><td colspan="4">&nbsp;</td></tr>
#end
#end
<tr style="color: $fcolor" bgcolor="$scolor"><td colspan="2" align="left">$xtask.name</td> <tr style="color: $fcolor" bgcolor="$scolor"><td colspan="2" align="left">$xtask.name</td>
<td colspan="2">&nbsp;</td></tr> <td colspan="2">&nbsp;</td></tr>
$xcats.clear() $xcats.clear()
#foreach ($task in $xtask.tasks) #foreach ($task in $xtask.tasks)
#if ($xcats.checkCategory($task.complexity)) #if ($xcats.checkCategory($task.category))
<tr><td colspan="4" class="small" style="border-bottom: 1px solid"><i>$task.complexity</i></td></tr> <tr><td colspan="4" class="small" style="border-bottom: 1px solid"><i>$task.category</i></td></tr>
#set ($border = "") #set ($border = "")
#else #else
#set ($border = 'style="border-top: 1px solid"') #set ($border = 'style="border-top: 1px solid"')
@@ -64,6 +55,13 @@ $xcats.clear()
<img src="images/edit.png" border="0" alt="Edit this task"></a></td> <img src="images/edit.png" border="0" alt="Edit this task"></a></td>
</tr> </tr>
#end #end
</table>
#if ($vidx%2 == 1)
</td></tr><tr><td valign="top">
#else
</td><td width="15">&nbsp;</td><td valign="top">
#end
#end #end
</table> </table>
</table> </table>