use of org.pentaho.ui.xul.gwt.tags.GwtConfirmBox in project pentaho-platform by pentaho.
the class MantleController method refreshPickListMenu.
/**
* Loads an arbitrary <code>FilePickList</code> into a menu
*
* @param pickMenu
* The XulMenuBar to host the menu entries
* @param filePickList
* The files to list in natural order
*/
private void refreshPickListMenu(XulMenubar pickMenu, final AbstractFilePickList<? extends IFilePickItem> filePickList, PickListType type) {
final MenuBar menuBar = (MenuBar) pickMenu.getManagedObject();
menuBar.clearItems();
final String menuClearMessage = Messages.getString(type.getMenuItemKey());
final String clearMessage = Messages.getString(type.getMessageKey());
if (filePickList.size() > 0) {
for (IFilePickItem filePickItem : filePickList.getFilePickList()) {
final String text = filePickItem.getFullPath();
menuBar.addItem(filePickItem.getTitle(), new Command() {
public void execute() {
SolutionBrowserPanel.getInstance().openFile(text, COMMAND.RUN);
}
});
}
menuBar.addSeparator();
menuBar.addItem(menuClearMessage, new Command() {
public void execute() {
// confirm the clear
GwtConfirmBox warning = new GwtConfirmBox();
warning.setHeight(117);
warning.setMessage(clearMessage);
warning.setTitle(menuClearMessage);
warning.setAcceptLabel(Messages.getString("clearRecentAcceptButtonLabel"));
warning.setCancelLabel(Messages.getString("clearRecentCancelButtonLabel"));
warning.addDialogCallback(new XulDialogCallback<String>() {
public void onClose(XulComponent sender, Status returnCode, String retVal) {
if (returnCode == Status.ACCEPT) {
filePickList.clear();
}
}
public void onError(XulComponent sender, Throwable t) {
}
});
warning.show();
}
});
} else {
menuBar.addItem(Messages.getString("empty"), new // $NON-NLS-1$
Command() {
public void execute() {
// Do nothing
}
});
}
}
use of org.pentaho.ui.xul.gwt.tags.GwtConfirmBox in project data-access by pentaho.
the class MetadataImportDialogController method confirm.
/**
* Shows a confirmation dialog
*
* @param title
* @param message
* @param okButtonLabel
* @param cancelButtonLabel
* @param onResulthandler
*/
private void confirm(final String title, final String message, final String okButtonLabel, final String cancelButtonLabel, final AsyncCallback<Boolean> onResulthandler) {
XulConfirmBox confirm = new GwtConfirmBox() {
@Override
public Panel getDialogContents() {
VerticalPanel vp = new VerticalPanel();
Label lbl = new Label(this.getMessage());
vp.add(lbl);
vp.setCellHorizontalAlignment(lbl, VerticalPanel.ALIGN_LEFT);
vp.setCellVerticalAlignment(lbl, VerticalPanel.ALIGN_MIDDLE);
return vp;
}
};
confirm.setTitle(title);
confirm.setMessage(message);
confirm.setAcceptLabel(okButtonLabel);
confirm.setCancelLabel(cancelButtonLabel);
confirm.addDialogCallback(new XulDialogCallback<String>() {
public void onClose(XulComponent component, Status status, String value) {
if (onResulthandler != null) {
onResulthandler.onSuccess(status == XulDialogCallback.Status.ACCEPT);
}
}
public void onError(XulComponent component, Throwable err) {
onResulthandler.onFailure(err);
return;
}
});
confirm.open();
}
Aggregations