Search in sources :

Example 1 with ScheduleOutputLocationDialog

use of org.pentaho.mantle.client.dialogs.scheduling.ScheduleOutputLocationDialog in project pentaho-platform by pentaho.

the class AdhocRunInBackgroundCommand method showDialog.

@Override
protected void showDialog(final boolean feedback) {
    final ScheduleOutputLocationDialog outputLocationDialog = new ScheduleOutputLocationDialog(getSolutionPath()) {

        @Override
        protected void onSelect(final String name, final String outputPath, String useWorkerNodes, final boolean overwriteFile, final String dateFormat) {
            setOutputName(name);
            setOutputLocationPath(outputPath);
            setUseWorkerNodes(useWorkerNodes);
            setOverwriteFile(String.valueOf(overwriteFile));
            setDateFormat(dateFormat);
            performOperation(feedback);
        }

        @Override
        protected void onCancel() {
            super.onCancel();
            AdhocRunInBackgroundCommand.onCancel();
        }

        @Override
        protected void onOk() {
            super.onOk();
            AdhocRunInBackgroundCommand.onOk(getOutputLocationPath());
        }

        @Override
        protected void onAttach() {
            super.onAttach();
            AdhocRunInBackgroundCommand.onAttach();
        }
    };
    outputLocationDialog.setOkButtonText(Messages.getString("ok"));
    outputLocationDialog.setScheduleNameText(Messages.getString("scheduleNameColonReportviewer"));
    outputLocationDialog.center();
}
Also used : ScheduleOutputLocationDialog(org.pentaho.mantle.client.dialogs.scheduling.ScheduleOutputLocationDialog)

Example 2 with ScheduleOutputLocationDialog

use of org.pentaho.mantle.client.dialogs.scheduling.ScheduleOutputLocationDialog 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();
    }
}
Also used : Response(com.google.gwt.http.client.Response) RequestBuilder(com.google.gwt.http.client.RequestBuilder) RequestCallback(com.google.gwt.http.client.RequestCallback) MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox) ScheduleOutputLocationDialog(org.pentaho.mantle.client.dialogs.scheduling.ScheduleOutputLocationDialog) Request(com.google.gwt.http.client.Request) JSONString(com.google.gwt.json.client.JSONString) RequestException(com.google.gwt.http.client.RequestException)

Aggregations

ScheduleOutputLocationDialog (org.pentaho.mantle.client.dialogs.scheduling.ScheduleOutputLocationDialog)2 Request (com.google.gwt.http.client.Request)1 RequestBuilder (com.google.gwt.http.client.RequestBuilder)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 JSONString (com.google.gwt.json.client.JSONString)1 MessageDialogBox (org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox)1