Search in sources :

Example 6 with MessageDialogBox

use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.

the class ExecuteGlobalActionsCommand method performOperation.

protected void performOperation() {
    // $NON-NLS-1$
    final String url = GWT.getHostPageBaseURL() + "api/system/refresh/globalActions";
    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("globalActionsExecutedSuccessfully"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
                true);
                dialogBox.center();
            }
        });
    } catch (RequestException e) {
        Window.alert(e.getMessage());
    // showError(e);
    }
}
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) Request(com.google.gwt.http.client.Request) RequestException(com.google.gwt.http.client.RequestException)

Example 7 with MessageDialogBox

use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.

the class SolutionBrowserPanel method editFile.

public void editFile() {
    if (filesListPanel.getSelectedFileItems() == null || filesListPanel.getSelectedFileItems().size() != 1) {
        return;
    }
    RepositoryFile file = filesListPanel.getSelectedFileItems().get(0).getRepositoryFile();
    if (file.getName().endsWith(".analysisview.xaction")) {
        // $NON-NLS-1$
        openFile(file, COMMAND.RUN);
    } else {
        // check to see if a plugin supports editing
        ContentTypePlugin plugin = PluginOptionsHelper.getContentTypePlugin(file.getName());
        if (plugin != null && plugin.hasCommand(COMMAND.EDIT)) {
            // load the editor for this plugin
            String editUrl = getPath() + "api/repos/" + pathToId(file.getPath()) + "/" + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            (plugin != null && (plugin.getCommandPerspective(COMMAND.EDIT) != null) ? plugin.getCommandPerspective(COMMAND.EDIT) : "editor");
            // See if it's already loaded
            for (int i = 0; i < contentTabPanel.getTabCount(); i++) {
                Widget w = contentTabPanel.getTab(i).getContent();
                if (w instanceof IFrameTabPanel && ((IFrameTabPanel) w).getUrl().endsWith(editUrl)) {
                    // Already up, select and exit
                    contentTabPanel.selectTab(i);
                    return;
                }
            }
            contentTabPanel.showNewURLTab(Messages.getString("editingColon") + file.getTitle(), Messages.getString("editingColon") + file.getTitle(), editUrl, // $NON-NLS-1$ //$NON-NLS-2$
            true);
        } else {
            MessageDialogBox dialogBox = new // $NON-NLS-1$
            MessageDialogBox(// $NON-NLS-1$
            Messages.getString("error"), // $NON-NLS-1$
            Messages.getString("cannotEditFileType"), true, false, true);
            dialogBox.center();
        }
    }
}
Also used : MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox) Widget(com.google.gwt.user.client.ui.Widget) RepositoryFile(org.pentaho.gwt.widgets.client.filechooser.RepositoryFile) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) JsArrayString(com.google.gwt.core.client.JsArrayString) ContentTypePlugin(org.pentaho.mantle.client.solutionbrowser.PluginOptionsHelper.ContentTypePlugin)

Example 8 with MessageDialogBox

use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.

the class SolutionBrowserPanel method executeActionSequence.

public void executeActionSequence(final FileCommand.COMMAND mode) {
    if (filesListPanel.getSelectedFileItems() == null || filesListPanel.getSelectedFileItems().size() != 1) {
        return;
    }
    // open in content panel
    AbstractCommand authCmd = new AbstractCommand() {

        protected void performOperation() {
            performOperation(false);
        }

        protected void performOperation(boolean feedback) {
            final FileItem selectedFileItem = filesListPanel.getSelectedFileItems().get(0);
            String url = null;
            url = // $NON-NLS-1$ //$NON-NLS-2$
            "api/repo/files/" + SolutionBrowserPanel.pathToId(filesListPanel.getSelectedFileItems().get(0).getRepositoryFile().getPath()) + "/generatedContent";
            url = getPath() + url;
            if (mode == FileCommand.COMMAND.BACKGROUND) {
                MessageDialogBox dialogBox = new // $NON-NLS-1$
                MessageDialogBox(// $NON-NLS-1$
                Messages.getString("info"), // $NON-NLS-1$
                Messages.getString("backgroundExecutionWarning"), true, false, true);
                dialogBox.center();
                // $NON-NLS-1$
                url += "&background=true";
                RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
                try {
                    builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
                    builder.sendRequest(null, new RequestCallback() {

                        public void onError(Request request, Throwable exception) {
                            MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("couldNotBackgroundExecute"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
                            true);
                            dialogBox.center();
                        }

                        public void onResponseReceived(Request request, Response response) {
                        }
                    });
                } catch (RequestException e) {
                // ignored
                }
            } else if (mode == FileCommand.COMMAND.NEWWINDOW) {
                // popup blockers might attack this
                // $NON-NLS-1$ //$NON-NLS-2$
                Window.open(url, "_blank", "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no");
            } else if (mode == FileCommand.COMMAND.SUBSCRIBE) {
                // $NON-NLS-1$
                final String myurl = url + "&subscribepage=yes";
                contentTabPanel.showNewURLTab(selectedFileItem.getLocalizedName(), selectedFileItem.getLocalizedName(), myurl, true);
            } else {
                contentTabPanel.showNewURLTab(selectedFileItem.getLocalizedName(), selectedFileItem.getLocalizedName(), url, true);
            }
        }
    };
    authCmd.execute();
}
Also used : Response(com.google.gwt.http.client.Response) FileItem(org.pentaho.mantle.client.solutionbrowser.filelist.FileItem) MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox) RequestBuilder(com.google.gwt.http.client.RequestBuilder) EmptyRequestCallback(org.pentaho.mantle.client.EmptyRequestCallback) RequestCallback(com.google.gwt.http.client.RequestCallback) AbstractCommand(org.pentaho.mantle.client.commands.AbstractCommand) Request(com.google.gwt.http.client.Request) JsArrayString(com.google.gwt.core.client.JsArrayString) RequestException(com.google.gwt.http.client.RequestException)

Example 9 with MessageDialogBox

use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.

the class SelectUserOrRoleDialog method fetchAllRoles.

public void fetchAllRoles(final ArrayList<String> existing, final Document fileInfo) {
    try {
        // $NON-NLS-1$
        final String url = GWT.getHostPageBaseURL() + "api/userrolelist/permission-roles";
        RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
        // This header is required to force Internet Explorer to not cache values from the GET response.
        requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
        requestBuilder.setHeader("accept", "application/json");
        requestBuilder.sendRequest(null, new RequestCallback() {

            public void onError(Request request, Throwable caught) {
                MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("couldNotGetRoles"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
                true);
                dialogBox.center();
            }

            public void onResponseReceived(Request request, Response response) {
                JsArrayString roles = parseRolesJson(JsonUtils.escapeJsonForEval(response.getText()));
                // filter out existing
                rolesListBox.clear();
                PermissionsPanel permPanel = new PermissionsPanel(null);
                for (int i = 0; i < roles.length(); i++) {
                    String role = roles.get(i);
                    if (!existing.contains(role)) {
                        rolesListBox.addItem(role);
                    } else {
                        if (!permPanel.getNames(fileInfo, 1).contains(role) && permPanel.getNames(fileInfo, 0).contains(role)) {
                            // we have equal user/role pair(s) and user already in existing list
                            rolesListBox.addItem(role);
                        }
                    }
                }
            }
        });
    } catch (RequestException e) {
        Window.alert(e.getMessage());
    }
}
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) Request(com.google.gwt.http.client.Request) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) RequestException(com.google.gwt.http.client.RequestException) PermissionsPanel(org.pentaho.mantle.client.solutionbrowser.fileproperties.PermissionsPanel)

Example 10 with MessageDialogBox

use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.

the class RefreshSystemSettingsCommand method performOperation.

protected void performOperation() {
    // $NON-NLS-1$
    final String url = GWT.getHostPageBaseURL() + "api/system/refresh/systemSettings";
    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("refreshSystemSettingsSuccess"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
                true);
                dialogBox.center();
            }
        });
    } catch (RequestException e) {
        Window.alert(e.getMessage());
    // showError(e);
    }
}
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) Request(com.google.gwt.http.client.Request) 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