Search in sources :

Example 26 with MessageDialogBox

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();
}
Also used : MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox)

Example 27 with MessageDialogBox

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();
}
Also used : MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox)

Example 28 with MessageDialogBox

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();
}
Also used : RequestBuilder(com.google.gwt.http.client.RequestBuilder) MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox) PromptDialogBox(org.pentaho.gwt.widgets.client.dialogs.PromptDialogBox) SolutionFolderActionEvent(org.pentaho.mantle.client.events.SolutionFolderActionEvent) Request(com.google.gwt.http.client.Request) HTML(com.google.gwt.user.client.ui.HTML) IDialogCallback(org.pentaho.gwt.widgets.client.dialogs.IDialogCallback) RequestException(com.google.gwt.http.client.RequestException) Response(com.google.gwt.http.client.Response) RequestCallback(com.google.gwt.http.client.RequestCallback)

Example 29 with MessageDialogBox

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();
    }
}
Also used : RequestBuilder(com.google.gwt.http.client.RequestBuilder) MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox) PromptDialogBox(org.pentaho.gwt.widgets.client.dialogs.PromptDialogBox) Request(com.google.gwt.http.client.Request) HTML(com.google.gwt.user.client.ui.HTML) SolutionFileActionEvent(org.pentaho.mantle.client.events.SolutionFileActionEvent) IDialogCallback(org.pentaho.gwt.widgets.client.dialogs.IDialogCallback) RequestException(com.google.gwt.http.client.RequestException) Response(com.google.gwt.http.client.Response) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) RequestCallback(com.google.gwt.http.client.RequestCallback)

Example 30 with MessageDialogBox

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();
        }
    }
}
Also used : PentahoMenuItem(org.pentaho.gwt.widgets.client.menuitem.PentahoMenuItem) JsSetting(org.pentaho.mantle.client.usersettings.JsSetting) MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox) XulException(org.pentaho.ui.xul.XulException) RequestException(com.google.gwt.http.client.RequestException)

Aggregations

MessageDialogBox (org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox)43 RequestException (com.google.gwt.http.client.RequestException)29 Request (com.google.gwt.http.client.Request)28 RequestBuilder (com.google.gwt.http.client.RequestBuilder)28 RequestCallback (com.google.gwt.http.client.RequestCallback)28 Response (com.google.gwt.http.client.Response)28 IDialogCallback (org.pentaho.gwt.widgets.client.dialogs.IDialogCallback)9 JSONString (com.google.gwt.json.client.JSONString)7 PromptDialogBox (org.pentaho.gwt.widgets.client.dialogs.PromptDialogBox)6 JsArrayString (com.google.gwt.core.client.JsArrayString)5 Label (com.google.gwt.user.client.ui.Label)5 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)5 HTML (com.google.gwt.user.client.ui.HTML)4 TextBox (com.google.gwt.user.client.ui.TextBox)3 Widget (com.google.gwt.user.client.ui.Widget)3 JsArray (com.google.gwt.core.client.JsArray)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 JSONObject (com.google.gwt.json.client.JSONObject)2 Button (com.google.gwt.user.client.ui.Button)2