Hi,

I was playing with the Mail example this morning and saw a stack trace
casting the Message class to Comparable for the TreeMap inside of the
MailSelectionModel.toString(). Seemed to happen most reliably when
clicking "select all on this page". A simple fix is attached.

Thanks,
Stephen


-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors
Index: bikeshed/src/com/google/gwt/sample/bikeshed/cookbook/client/MailRecipe.java
===================================================================
--- bikeshed/src/com/google/gwt/sample/bikeshed/cookbook/client/MailRecipe.java	(revision 8239)
+++ bikeshed/src/com/google/gwt/sample/bikeshed/cookbook/client/MailRecipe.java	(working copy)
@@ -177,7 +177,7 @@
   }
 
   // Hashing, comparison, and equality are based on the message id
-  static class Message {
+  static class Message implements Comparable<Message> {
     Date date;
     int id;
     boolean isRead;
@@ -230,6 +230,11 @@
       return "Message [id=" + id + ", sender=" + sender + ", subject="
           + subject + ", read=" + isRead + ", date=" + date + "]";
     }
+
+    @Override
+    public int compareTo(Message o) {
+      return this.id - o.id;
+    }
   }
 
   private static Label messageIdsLabel = new Label("");

Reply via email to