use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class RestoreFileCommand method showErrorDialogBox.
public void showErrorDialogBox(SolutionFileActionEvent event) {
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("restoreError"), false, false, true);
dialogBox.center();
event.setMessage(Messages.getString("restoreError"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class RunInBackgroundCommand method showDialog.
protected void showDialog(final boolean feedback) {
final ScheduleOutputLocationDialog outputLocationDialog = new ScheduleOutputLocationDialog(solutionPath) {
@Override
protected void onSelect(final String name, final String outputLocationPath, final String useWorkerNodes, final boolean overwriteFile, final String dateFormat) {
setOutputName(name);
setOutputLocationPath(outputLocationPath);
setUseWorkerNodes(useWorkerNodes);
setOverwriteFile(String.valueOf(overwriteFile));
setDateFormat(dateFormat);
performOperation(feedback);
}
};
final String filePath = solutionPath;
String urlPath = NameUtils.URLEncode(NameUtils.encodeRepositoryPath(filePath));
RequestBuilder scheduleFileRequestBuilder = createParametersChecker(urlPath);
final boolean isXAction = isXAction(urlPath);
try {
scheduleFileRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
MessageDialogBox dialogBox = // $NON-NLS-1$
new MessageDialogBox(Messages.getString("error"), exception.toString(), false, false, true);
dialogBox.center();
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == Response.SC_OK) {
String responseMessage = response.getText();
boolean hasParams = hasParameters(responseMessage, isXAction);
if (!hasParams) {
outputLocationDialog.setOkButtonText(Messages.getString("ok"));
}
outputLocationDialog.center();
} else {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("serverErrorColon") + " " + response.getStatusCode(), false, false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
true);
dialogBox.center();
}
}
});
} catch (RequestException e) {
MessageDialogBox dialogBox = // $NON-NLS-1$
new MessageDialogBox(Messages.getString("error"), e.toString(), false, false, true);
dialogBox.center();
}
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class RunInBackgroundCommand method performOperation.
protected void performOperation(boolean feedback) {
final String filePath = (this.getSolutionPath() != null) ? this.getSolutionPath() : repositoryFile.getPath();
String urlPath = NameUtils.URLEncode(NameUtils.encodeRepositoryPath(filePath));
RequestBuilder scheduleFileRequestBuilder = createParametersChecker(urlPath);
final boolean isXAction = isXAction(urlPath);
try {
scheduleFileRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
MessageDialogBox dialogBox = // $NON-NLS-1$
new MessageDialogBox(Messages.getString("error"), exception.toString(), false, false, true);
dialogBox.center();
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == Response.SC_OK) {
final JSONObject scheduleRequest = new JSONObject();
// $NON-NLS-1$
scheduleRequest.put("inputFile", new JSONString(filePath));
// Set date format to append to filename
if (StringUtils.isEmpty(getDateFormat())) {
// $NON-NLS-1$
scheduleRequest.put("appendDateFormat", JSONNull.getInstance());
} else {
// $NON-NLS-1$
scheduleRequest.put("appendDateFormat", new JSONString(getDateFormat()));
}
// Set whether to overwrite the file
if (StringUtils.isEmpty(getOverwriteFile())) {
// $NON-NLS-1$
scheduleRequest.put("overwriteFile", JSONNull.getInstance());
} else {
// $NON-NLS-1$
scheduleRequest.put("overwriteFile", new JSONString(getOverwriteFile()));
}
// Set job name
if (StringUtils.isEmpty(getOutputName())) {
// $NON-NLS-1$
scheduleRequest.put("jobName", JSONNull.getInstance());
} else {
// $NON-NLS-1$
scheduleRequest.put("jobName", new JSONString(getOutputName()));
}
// Set output path location
if (StringUtils.isEmpty(getOutputLocationPath())) {
// $NON-NLS-1$
scheduleRequest.put("outputFile", JSONNull.getInstance());
} else {
// $NON-NLS-1$
scheduleRequest.put("outputFile", new JSONString(getOutputLocationPath()));
}
if (!StringUtils.isEmpty(getUseWorkerNodes())) {
// $NON-NLS-1$
scheduleRequest.put("useWorkerNodes", new JSONString(getUseWorkerNodes()));
}
// BISERVER-9321
scheduleRequest.put("runInBackground", JSONBoolean.getInstance(true));
String responseMessage = response.getText();
final boolean hasParams = hasParameters(responseMessage, isXAction);
RequestBuilder emailValidRequest = // $NON-NLS-1$
new RequestBuilder(RequestBuilder.GET, contextURL + "api/emailconfig/isValid");
// $NON-NLS-1$ //$NON-NLS-2$
emailValidRequest.setHeader("accept", "text/plain");
emailValidRequest.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
emailValidRequest.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
MessageDialogBox dialogBox = // $NON-NLS-1$
new MessageDialogBox(Messages.getString("error"), exception.toString(), false, false, true);
dialogBox.center();
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == Response.SC_OK) {
// final boolean isEmailConfValid = Boolean.parseBoolean(response.getText());
// force false for now, I have a feeling PM is going to want this, making it easy to turn back
// on
final boolean isEmailConfValid = false;
if (hasParams) {
ScheduleParamsDialog dialog = new ScheduleParamsDialog(filePath, scheduleRequest, isEmailConfValid);
dialog.center();
dialog.setAfterResponseCallback(scheduleParamsDialogCallback);
} else if (isEmailConfValid) {
ScheduleEmailDialog scheduleEmailDialog = new ScheduleEmailDialog(null, filePath, scheduleRequest, null, null);
scheduleEmailDialog.center();
} else {
// just run it
RequestBuilder scheduleFileRequestBuilder = // $NON-NLS-1$
new RequestBuilder(RequestBuilder.POST, contextURL + "api/scheduler/job");
// $NON-NLS-1$//$NON-NLS-2$
scheduleFileRequestBuilder.setHeader("Content-Type", "application/json");
scheduleFileRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
scheduleFileRequestBuilder.sendRequest(scheduleRequest.toString(), new RequestCallback() {
@Override
public void onError(Request request, Throwable exception) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), exception.toString(), false, false, // $NON-NLS-1$
true);
dialogBox.center();
}
@Override
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == 200) {
MessageDialogBox dialogBox = new MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("runInBackground"), // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("backgroundExecutionStarted"), false, false, true);
dialogBox.center();
} else {
MessageDialogBox dialogBox = new MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-2$ //$NON-NLS-3$
Messages.getString("error"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-2$ //$NON-NLS-3$
Messages.getString("serverErrorColon") + " " + response.getStatusCode(), false, false, true);
dialogBox.center();
}
}
});
} catch (RequestException e) {
MessageDialogBox dialogBox = new // $NON-NLS-1$
MessageDialogBox(// $NON-NLS-1$
Messages.getString("error"), // $NON-NLS-1$
e.toString(), false, false, true);
dialogBox.center();
}
}
}
}
});
} catch (RequestException e) {
MessageDialogBox dialogBox = // $NON-NLS-1$
new MessageDialogBox(Messages.getString("error"), e.toString(), false, false, true);
dialogBox.center();
}
} else {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("serverErrorColon") + " " + response.getStatusCode(), false, false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
true);
dialogBox.center();
}
}
});
} catch (RequestException e) {
MessageDialogBox dialogBox = // $NON-NLS-1$
new MessageDialogBox(Messages.getString("error"), e.toString(), false, false, true);
dialogBox.center();
}
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class OpenURLCommand method performOperation.
protected void performOperation(boolean feedback) {
final TextBox textBox = new TextBox();
// $NON-NLS-1$
textBox.setText("http://");
// $NON-NLS-1$
textBox.setWidth("500px");
textBox.setVisibleLength(72);
IDialogCallback callback = new IDialogCallback() {
public void cancelPressed() {
}
public void okPressed() {
SolutionBrowserPanel.getInstance().getContentTabPanel().showNewURLTab(textBox.getText(), textBox.getText(), textBox.getText(), false);
}
};
IDialogValidatorCallback validatorCallback = new IDialogValidatorCallback() {
public boolean validate() {
// $NON-NLS-1$
boolean isValid = !"".equals(textBox.getText()) && textBox.getText() != null;
if (!isValid) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("urlNotSpecified"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
return isValid;
}
};
PromptDialogBox promptDialog = new PromptDialogBox(Messages.getString("enterURL"), Messages.getString("ok"), Messages.getString("cancel"), false, true, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
textBox);
promptDialog.setValidatorCallback(validatorCallback);
promptDialog.setCallback(callback);
// $NON-NLS-1$
promptDialog.setWidth("500px");
promptDialog.center();
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class PurgeReportingDataCacheCommand method performOperation.
protected void performOperation() {
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/system/refresh/reportingDataCache";
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
requestBuilder.setHeader("accept", "text/plain");
requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
requestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// showError(exception);
}
public void onResponseReceived(Request request, Response response) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), Messages.getString("reportingDataCacheFlushedSuccessfully"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
});
} catch (RequestException e) {
Window.alert(e.getMessage());
// showError(e);
}
}
Aggregations