dateSpinner.setSelectedItem(today);
}
@SuppressWarnings("unchecked")
private void initializeAlertButtons() {
alertButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
Button.Group messageTypeGroup = Button.getGroup("messageType");
Button selection = messageTypeGroup.getSelection();
Map<String, ?> userData = JSONSerializer.parseMap((String)selection.getUserData());
String messageType = (String)userData.get("type");
if (messageType.equals("custom")) {
ArrayList<String> options = new ArrayList<String>();
options.add("OK");
options.add("Cancel");
Component body = null;
WTKXSerializer wtkxSerializer = new WTKXSerializer();
try {
body = (Component)wtkxSerializer.readObject("pivot/tutorials/alert.wtkx");
} catch(Exception exception) {
System.out.println(exception);
}
Alert alert = new Alert(MessageType.QUESTION, "Please select your favorite icon:",
options, body);
alert.setTitle("Select Icon");
alert.setSelectedOption(0);
alert.getDecorators().update(0, new ReflectionDecorator());
alert.open(window);
} else {
String message = (String)userData.get("message");
Alert.alert(MessageType.decode(messageType), message, window);
}
}
});
promptButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
Button.Group messageTypeGroup = Button.getGroup("messageType");
Button selection = messageTypeGroup.getSelection();
Map<String, ?> userData = JSONSerializer.parseMap((String)selection.getUserData());