Ignore:
Timestamp:
07/08/06 18:37:31 (18 years ago)
Author:
Nicholas Riley
Message:

First pass at control set for edit dialog.

Location:
trunk/hiptop/pester
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/hiptop/pester

    • Property svn:ignore set to
      work
  • trunk/hiptop/pester/net/sabi/pester/AlarmListView.java

    r237 r238  
    44import danger.app.Event;
    55import danger.ui.ActiveListView;
     6import danger.ui.Button;
    67import danger.ui.DialogWindow;
    78import danger.ui.Rect;
     
    2122    private static DialogWindow sEditWindow;
    2223    private TypeAheadTextField sMessageField;
     24    private Button sDiscardAlarmButton;
    2325
    2426    private static Alarm sFocusedAlarm, sEditingAlarm;
     
    3638        sMessageField = (TypeAheadTextField)sEditWindow.getDescendantWithID(ID_MESSAGE_FIELD);
    3739        sEditWindow.disableBottomRightButtonOnEmptyField(sMessageField);
     40        sDiscardAlarmButton = (Button)sEditWindow.getDescendantWithID(ID_DISCARD_ALARM_BUTTON);
    3841
    3942        super.onDecoded();
     
    5053    }
    5154
    52     void editAlarm(Alarm alarm) {
     55    void editAlarm(Alarm alarm, boolean asNew) {
    5356        sEditingAlarm = alarm;
    5457        alarm.beginEditing();
    5558        sMessageField.setText(sEditingAlarm.getMessage());
     59        if (asNew) {
     60            sDiscardAlarmButton.hide();
     61        } else {
     62            sDiscardAlarmButton.show();
     63        }
     64        boolean usesPeriod = sEditingAlarm.getUsesPeriod();
     65       
    5666        sEditWindow.show();
    5767    }
     
    6070        switch (e.type) {
    6171        case EVENT_NEW_ALARM:
    62             editAlarm(new Alarm());
     72            editAlarm(new Alarm(), true);
    6373            return true;
    6474        case EVENT_SET_ALARM:
     
    8393    protected void itemActivated(Object item) {
    8494        // XXX deschedule alarm
    85         editAlarm(sFocusedAlarm);
     95        editAlarm(sFocusedAlarm, false);
    8696    }
    8797    protected void itemFocused(Object item) {
Note: See TracChangeset for help on using the changeset viewer.