use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class AdhocRunInBackgroundCommand method onError.
private void onError(Throwable exception) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), exception.toString(), false, false, true);
dialogBox.center();
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class AdhocRunInBackgroundCommand method onError.
private void onError(Response response) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("serverErrorColon") + " " + response.getStatusCode(), false, false, true);
dialogBox.center();
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class DeleteFolderCommand method performOperation.
protected void performOperation(boolean feedback) {
final SolutionFolderActionEvent event = new SolutionFolderActionEvent();
event.setAction(this.getClass().getName());
final String filesList = repositoryFile.getId();
final String folderName = repositoryFile.getTitle() == null ? repositoryFile.getName() : repositoryFile.getTitle();
final HTML messageTextBox = new HTML(Messages.getString("moveToTrashQuestionFolder", escapeHtmlEntities(folderName)));
final PromptDialogBox folderDeleteWarningDialogBox = new PromptDialogBox(Messages.getString("moveToTrash"), Messages.getString("yesMoveToTrash"), Messages.getString("no"), true, true);
folderDeleteWarningDialogBox.setContent(messageTextBox);
final IDialogCallback callback = new IDialogCallback() {
public void cancelPressed() {
folderDeleteWarningDialogBox.hide();
}
public void okPressed() {
// $NON-NLS-1$
String deleteFilesURL = contextURL + "api/repo/files/delete";
RequestBuilder deleteFilesRequestBuilder = new RequestBuilder(RequestBuilder.PUT, deleteFilesURL);
deleteFilesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
// $NON-NLS-1$//$NON-NLS-2$
deleteFilesRequestBuilder.setHeader("Content-Type", "text/plain");
try {
deleteFilesRequestBuilder.sendRequest(filesList, new RequestCallback() {
@Override
public void onError(Request request, Throwable exception) {
MessageDialogBox dialogBox = new // $NON-NLS-1$ //$NON-NLS-2$
MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("error"), // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("couldNotDeleteFolder"), false, false, true);
dialogBox.center();
event.setMessage(Messages.getString("couldNotDeleteFolder"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
@Override
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == 200) {
new RefreshRepositoryCommand().execute(false);
event.setMessage("Success");
FileChooserDialog.setIsDirty(Boolean.TRUE);
setBrowseRepoDirty(Boolean.TRUE);
EventBusUtil.EVENT_BUS.fireEvent(event);
} else {
MessageDialogBox dialogBox = new // $NON-NLS-1$ //$NON-NLS-2$
MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("error"), // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("couldNotDeleteFolder"), false, false, true);
dialogBox.center();
event.setMessage(Messages.getString("couldNotDeleteFolder"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
}
});
} catch (RequestException e) {
MessageDialogBox dialogBox = new // $NON-NLS-1$ //$NON-NLS-2$
MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("error"), // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("couldNotDeleteFolder"), false, false, true);
dialogBox.center();
event.setMessage(Messages.getString("couldNotDeleteFolder"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
}
};
folderDeleteWarningDialogBox.setCallback(callback);
folderDeleteWarningDialogBox.center();
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class DeletePermanentFileCommand method performOperation.
/*
* (non-Javadoc)
*
* @see com.google.gwt.user.client.Command#execute()
*/
protected void performOperation(boolean feedback) {
final SolutionFileActionEvent event = new SolutionFileActionEvent();
event.setAction(this.getClass().getName());
VerticalPanel vp = new VerticalPanel();
String deleteMessage;
final PromptDialogBox deleteConfirmDialog;
if (mode.equals("purge")) {
deleteMessage = Messages.getString("deleteAllQuestion");
deleteConfirmDialog = new PromptDialogBox(Messages.getString("emptyTrash"), Messages.getString("yesEmptyTrash"), Messages.getString("no"), false, true, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
vp);
} else {
if (MULTIPLE_DELETE_TYPE.equals(type)) {
deleteMessage = Messages.getString("deleteMultiQuestion");
} else {
deleteMessage = Messages.getString("deleteQuestion", type);
}
deleteConfirmDialog = new PromptDialogBox(Messages.getString("permDelete"), Messages.getString("yesPermDelete"), Messages.getString("no"), false, true, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
vp);
}
// $NON-NLS-1$
vp.add(new HTML(deleteMessage));
final IDialogCallback callback = new IDialogCallback() {
public void cancelPressed() {
deleteConfirmDialog.hide();
}
public void okPressed() {
String temp = "";
// Add js file list
temp = temp + fileList;
// remove trailing ","
temp = temp.substring(0, temp.length() - 1);
final String filesList = temp;
// $NON-NLS-1$
String deleteFilesURL = contextURL + "api/repo/files/deletepermanent";
RequestBuilder deleteFilesRequestBuilder = new RequestBuilder(RequestBuilder.PUT, deleteFilesURL);
// $NON-NLS-1$//$NON-NLS-2$
deleteFilesRequestBuilder.setHeader("Content-Type", "text/plain");
deleteFilesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
deleteFilesRequestBuilder.sendRequest(filesList, new RequestCallback() {
@Override
public void onError(Request request, Throwable exception) {
MessageDialogBox dialogBox = new // $NON-NLS-1$ //$NON-NLS-2$
MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("error"), // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("couldNotDeleteFile"), false, false, true);
dialogBox.center();
event.setMessage(Messages.getString("couldNotDeleteFile"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
@Override
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == 200) {
new RefreshRepositoryCommand().execute(false);
event.setMessage("Success");
FileChooserDialog.setIsDirty(Boolean.TRUE);
setBrowseRepoDirty(Boolean.TRUE);
EventBusUtil.EVENT_BUS.fireEvent(event);
} else {
event.setMessage(Messages.getString("couldNotDeleteFile"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
}
});
} catch (RequestException e) {
MessageDialogBox dialogBox = new // $NON-NLS-1$ //$NON-NLS-2$
MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("error"), // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("couldNotDeleteFile"), false, false, true);
dialogBox.center();
event.setMessage(Messages.getString("couldNotDeleteFile"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
}
};
if (!feedback) {
callback.okPressed();
} else {
deleteConfirmDialog.setCallback(callback);
deleteConfirmDialog.center();
}
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class MantleController method processSettings.
public void processSettings(JsArray<JsSetting> settings) {
if (settings == null) {
return;
}
for (int i = 0; i < settings.length(); i++) {
JsSetting setting = settings.get(i);
try {
if (IMantleUserSettingsConstants.MANTLE_SHOW_NAVIGATOR.equals(setting.getName())) {
// $NON-NLS-1$
boolean showNavigator = "true".equals(setting.getValue());
model.setShowNavigatorSelected(showNavigator);
} else if (IMantleUserSettingsConstants.MANTLE_SHOW_DESCRIPTIONS_FOR_TOOLTIPS.equals(setting.getName())) {
// $NON-NLS-1$
boolean checked = "true".equals(setting.getValue());
((PentahoMenuItem) useDescriptionsMenuItem.getManagedObject()).setChecked(checked);
} else if (IMantleUserSettingsConstants.MANTLE_SHOW_HIDDEN_FILES.equals(setting.getName())) {
// $NON-NLS-1$
boolean checked = "true".equals(setting.getValue());
((PentahoMenuItem) showHiddenFilesMenuItem.getManagedObject()).setChecked(checked);
}
} catch (Exception e) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("couldNotGetUserSettings"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
}
}
Aggregations