Changeset 294 for trunk/hiptop


Ignore:
Timestamp:
07/28/06 04:17:42 (18 years ago)
Author:
Nicholas Riley
Message:

Maximum alarm limit.

Location:
trunk/hiptop/pester
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/hiptop/pester/locale/en_US/Pester.rsrc

    r293 r294  
    262262endTextInputAlert
    263263
     264alert ID_LIMIT_ALERT
     265        appAlertStyle
     266        title = "Alarm Limit"
     267        text = "You have reached the limit of ^0 alarms. You must delete an alarm (or wait for it to expire) before creating another alarm."
     268        button
     269                title = okButton
     270                position = buttonBottom1
     271                shortcut = doneButton
     272endAlert
     273
    264274alert ID_DISCARD_ALERT
    265275        appAlertStyle
  • trunk/hiptop/pester/net/sabi/pester/AlarmListView.java

    r292 r294  
    1313import danger.util.DEBUG;
    1414import danger.util.StringUtils;
     15import danger.util.format.StringFormat;
    1516
    1617public class AlarmListView extends ActiveListView
     
    5253        switch (e.type) {
    5354        case EVENT_NEW_ALARM:
    54             // XXX check for max alarms
     55            if (!Alarms.canCreateAlarm()) {
     56                AlertWindow alert =
     57                    Application.getCurrentApp().getAlert(ID_LIMIT_ALERT, this);
     58                alert.setMessage(StringFormat.withFormat(alert.getMessage(),
     59                                 String.valueOf(Alarms.MAX_ALARM_COUNT)));
     60                alert.show();
     61                return true;
     62            }
    5563            alarmSetDialog().editAlarm(new Alarm(), true);
    5664            return true;
  • trunk/hiptop/pester/net/sabi/pester/Alarms.java

    r284 r294  
    1313public class Alarms extends StdActiveList {
    1414    // max # records in a datastore
    15     private static final int MAX_ALARM_COUNT = 50;
     15    public static final int MAX_ALARM_COUNT = 50;
    1616
    1717    private static Alarms sAlarmList = null;
     
    6262    }
    6363
     64    public static boolean canCreateAlarm() {
     65        return (sAlarmList.size() < MAX_ALARM_COUNT);
     66    }
    6467    public static void addAlarm(Alarm alarm) {
    6568        sAlarmList.insertItemSorted(alarm, alarm);
Note: See TracChangeset for help on using the changeset viewer.