Alert alert = new Alert(MessageType.QUESTION, "Please select your favorite icon:",
options, body);
alert.setTitle("Select Icon");
alert.setSelectedOptionIndex(0);
alert.getDecorators().update(0, new ReflectionDecorator());
alert.open(KitchenSink.this.window);
} else {
String message = (String)userData.get("message");
Alert.alert(MessageType.valueOf(messageType.toUpperCase()), message, KitchenSink.this.window);
}
}
});
this.promptButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
public void buttonPressed(Button button) {
Button selection = AlertsRollupStateHandler.this.messageTypeGroup.getSelection();
Map<String, ?> userData;
try {
userData = JSONSerializer.parseMap((String)selection.getUserData().get("messageInfo"));
} catch (SerializationException exception) {
throw new RuntimeException(exception);
}
String messageType = (String)userData.get("messageType");
if (messageType == null) {
ArrayList<String> options = new ArrayList<String>();
options.add("OK");
options.add("Cancel");
Component body = null;
BXMLSerializer serializer = new BXMLSerializer();
try {
body = (Component)serializer.readObject(KitchenSink.class, "alert.bxml");
} catch(Exception exception) {
System.err.println(exception);
}
Prompt prompt = new Prompt(MessageType.QUESTION, "Please select your favorite icon:",
options, body);
prompt.setTitle("Select Icon");
prompt.setSelectedOptionIndex(0);
prompt.getDecorators().update(0, new ReflectionDecorator());
prompt.open(KitchenSink.this.window);
} else {
String message = (String)userData.get("message");
Prompt.prompt(MessageType.valueOf(messageType.toUpperCase()), message, KitchenSink.this.window);
}