Index: trunk/hiptop/pester/net/sabi/pester/Pester.java
===================================================================
--- trunk/hiptop/pester/net/sabi/pester/Pester.java	(revision 288)
+++ trunk/hiptop/pester/net/sabi/pester/Pester.java	(revision 296)
@@ -3,21 +3,62 @@
 import danger.app.Application;
 import danger.app.Event;
-import danger.app.IPCMessage;
+import danger.ui.AlertWindow;
+import danger.ui.Container;
+import danger.ui.Control;
+import danger.ui.Font;
 import danger.ui.Layout;
-import danger.ui.TextField;
-import danger.ui.TextInputAlertWindow;
+import danger.ui.RecordingPen;
 import danger.ui.ScreenWindow;
 import danger.ui.StaticText;
+import danger.ui.TextField;
 import danger.util.DEBUG;
-import java.util.Stack;
+import danger.util.TextInputFilter;
 
 public class Pester extends Application implements Resources, Commands {
     private static ScreenWindow sAlarmListWindow;
-    private static Stack sAlarmStack;
 
     public Pester() {
 	sAlarmListWindow = (ScreenWindow)getResources().getScreen(ID_ALARM_LIST_SCREEN);
 	sAlarmListWindow.show();
-	sAlarmStack = new Stack();
+    }
+
+    private void showAlertForAlarm(Alarm alarm) {
+	AlertWindow alert = (AlertWindow)getAlert(ID_ALARM_ALERT, this);
+	alert.setTitle(alarm.getDateTimeString());
+	alert.setMessage(alarm.getMessage());
+	alert.setShowTone(alarm.getAlert());
+
+	Font font = Font.findBoldSystemFont();
+	StaticText label = new StaticText(getString(ID_SNOOZE_LABEL_LEFT), font);
+	TextField field = new TextField();
+	field.setAlignment(TextField.JUSTIFY_RIGHT);
+	field.attachInputFilter(TextInputFilter.newLengthFilter(2));
+	field.attachInputFilter(TextInputFilter.newNumericFilter());
+	label.setLeft(35); // XXX alert.getMessageView().getLeft()
+	Layout.positionToRight(field, label, 3);
+	Layout.alignBaseline(label, field);
+	alert.addChildBelowMessageArea(label, label.getLeft(), label.getTop());
+	alert.addChildBelowMessageArea(field, field.getLeft(), field.getTop());
+	label = new StaticText(getString(ID_SNOOZE_LABEL_RIGHT), font);
+	Layout.positionToRight(label, field, 3);
+	Layout.alignBaseline(label, field);
+	alert.addChildBelowMessageArea(label, label.getLeft(), label.getTop());
+	
+	alert.setEventArgForControlWithID(ID_RESCHEDULE_BUTTON, alarm);
+	alert.setEventArgForControlWithID(ID_DISMISS_BUTTON, alarm);
+	alert.setDefaultFocus(field);
+
+	alert.paint(new RecordingPen()); // force layout
+	int fieldID = alert.incrementMaxChildID();
+	alert.removeChild(field);
+	alert.addChild(field, fieldID);
+	Control snoozeButton = alert.getControlWithID(ID_SNOOZE_BUTTON);
+	Event event = snoozeButton.getEvent();
+	event.argument = alert;
+	event.data = fieldID;
+	snoozeButton.setEvent(event);
+	alert.disableButtonOnEmptyField(ID_SNOOZE_BUTTON, fieldID);
+
+	alert.show(AlertWindow.SYSTEM_ALERT_TYPE_ALARM);
     }
 
@@ -25,26 +66,19 @@
 	switch (e.type) {
 	case Event.EVENT_ALARM:
-	    Alarm alarm = (Alarm)e.argument;
-	    TextInputAlertWindow alert = getTextInputAlert(ID_ALARM_ALERT, this);
-	    alert.setTitle(alarm.getDateTimeString());
-	    alert.setMessage(alarm.getMessage());
-	    alert.setShowTone(alarm.getAlert());
-	    alert.disableButtonOnEmptyField(ID_SNOOZE_BUTTON, ID_SNOOZE_MINUTES);
-	    alert.setShowCancel(false);
-	    alert.show(TextInputAlertWindow.SYSTEM_ALERT_TYPE_ALARM);
-	    sAlarmStack.push(alarm);
+	    showAlertForAlarm((Alarm)e.argument);
 	    return true;
 	case EVENT_SET_ALARM:
-	    AlarmSetDialog.getDialog().rescheduleAlarm((Alarm)sAlarmStack.pop());
+	    AlarmSetDialog.getDialog().rescheduleAlarm((Alarm)e.argument);
 	    return true;
 	case EVENT_SNOOZE_ALARM:
+	    AlertWindow alert = (AlertWindow)e.argument;
 	    int snoozeMinutes =
-		Integer.parseInt(TextInputAlertWindow.
-				 getTextFieldValue((IPCMessage)e.argument,
-						   ID_SNOOZE_MINUTES));
-	    ((Alarm)sAlarmStack.pop()).snoozeForMinutes(snoozeMinutes);
+		Integer.parseInt(alert.getControlWithID(e.data).toString());
+	    Control dismissButton = alert.getControlWithID(ID_DISMISS_BUTTON);
+	    Alarm alarm = (Alarm)dismissButton.getEvent().argument;
+	    alarm.snoozeForMinutes(snoozeMinutes);
 	    return true;
 	case EVENT_DISMISS_ALARM:
-	    ((Alarm)sAlarmStack.pop()).dismiss();
+	    ((Alarm)e.argument).dismiss();
 	    return true;
 	}
