* @param callback - the callback of the button that was selected
* @param widgetToCover - the widget that should be covered by the dialog
*/
public static Dialog options(List<OptionsDialogEntry> options, OptionCallback callback, HasWidgets widgetToCover) {
OptionsDialog optionsDialog = new OptionsDialog();
int count = 0;
for (OptionsDialogEntry optionsDialogEntry : options) {
count++;
Button button = new Button(optionsDialogEntry.getText());
switch (optionsDialogEntry.getType()) {
case NORMAL:
break;
case IMPORTANT:
button.setImportant(true);
break;
case CONFIRM:
button.setConfirm(true);
break;
default:
throw new RuntimeException("how did we get here?");
}
button.addTapHandler(new InternalTouchHandler(count, optionsDialog, callback));
optionsDialog.add(button);
}
optionsDialog.setPanelToOverlay(widgetToCover);
optionsDialog.show();
return optionsDialog;
}