}
public static POptionPane showOptionDialog(final PActionHandler handler, final String message, final String title, final POptionType optionType, final PMessageType messageType, final String... options) {
final POptionPane optionPane = new POptionPane();
final PDialogBox dialogBox = optionPane.getDialogBox();
dialogBox.setStyleName(PonySDKTheme.DIALOGBOX);
dialogBox.setAnimationEnabled(false);
dialogBox.setGlassEnabled(true);
dialogBox.setTitle(title);
dialogBox.setCaption(messageType.getName());
// Build content
final PVerticalPanel panel = new PVerticalPanel();
final PLabel content = new PLabel(message);
panel.add(content);
final PHorizontalPanel controlsPanel = new PHorizontalPanel();
controlsPanel.setStyleName(PonySDKTheme.DIALOGBOX_CONTROLS);
controlsPanel.setHorizontalAlignment(PHorizontalAlignment.ALIGN_CENTER);
for (final String option : options) {
final PButton button = new PButton();
button.setText(option);
button.ensureDebugId("optionpane[" + option + "]");
button.addClickHandler(new PClickHandler() {
@Override
public void onClick(final PClickEvent clickEvent) {
handler.onAction(dialogBox, option);
}
});
controlsPanel.add(button);
}
panel.add(controlsPanel);
panel.setCellHorizontalAlignment(controlsPanel, PHorizontalAlignment.ALIGN_CENTER);
panel.setCellHorizontalAlignment(content, PHorizontalAlignment.ALIGN_CENTER);
dialogBox.setWidget(panel);
dialogBox.show();
dialogBox.center();
return optionPane;
}