- Timestamp:
- 07/20/06 02:05:30 (18 years ago)
- Location:
- trunk/hiptop/pester/net/sabi/pester
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hiptop/pester/net/sabi/pester/Alarm.java
r255 r259 9 9 import danger.internal.Date; 10 10 import danger.system.Hardware; 11 import danger.text.Collator; 11 12 import danger.util.LocaleUtils; 12 13 import danger.util.StdActiveList; … … 15 16 import danger.util.format.DateFormat; 16 17 import danger.util.format.StringFormat; 17 18 public class Alarm extends StdActiveObject { 18 import java.util.Comparator; 19 20 public class Alarm extends StdActiveObject implements Comparator { 19 21 private static final int VERSION_1 = 1; 20 22 … … 263 265 } 264 266 267 public int compare(Object arg0, Object arg1) { 268 Alarm alarm0 = (Alarm)arg0, alarm1 = (Alarm)arg1; 269 int result = alarm0.getDate().compareTo(alarm1.getDate()); 270 if (result != 0) return result; 271 result = Collator.getInstance().compare(alarm0.getMessage(), 272 alarm1.getMessage()); 273 if (result != 0) return result; 274 return alarm0.hashCode() - alarm1.hashCode(); 275 } 276 265 277 public static final int TYPE_PERIODIC = 0; 266 278 public static final int TYPE_PERIODIC_REPEATING = 1; -
trunk/hiptop/pester/net/sabi/pester/AlarmListView.java
r257 r259 5 5 import danger.ui.ActiveListView; 6 6 import danger.util.ActiveList; 7 import danger.util.DEBUG; 7 8 8 9 public class AlarmListView extends ActiveListView … … 59 60 public void onItemAdded(ActiveList list, Object item, int index) { 60 61 sAlarmListWindow.updateAlarmCount(); 62 super.onItemAdded(list, item, index); 63 // super's default behavior is to preserve the existing selection, 64 // which is admirable in general, but not what we want 61 65 setFocus(index); 62 super.onItemAdded(list, item, index);63 66 } 64 67 public void onItemRemoved(ActiveList list, Object item, int index) { -
trunk/hiptop/pester/net/sabi/pester/Alarms.java
r258 r259 35 35 36 36 public static void addAlarm(Alarm alarm) { 37 sAlarmList. addItem(alarm);37 sAlarmList.insertItemSorted(alarm, alarm); 38 38 } 39 39 public static void removeAlarm(Alarm alarm) { … … 58 58 } 59 59 60 /*61 private static Alarm sAlarm0 = new Alarm();62 private static Alarm sAlarm1 = new Alarm();63 public int compare(Object arg0, Object arg1) {64 65 return Collator.getInstance().compare(66 }67 */68 69 60 static class Listener extends danger.app.Listener 70 61 implements danger.util.ActiveList.ForEach {
Note:
See TracChangeset
for help on using the changeset viewer.