Search in sources :

Example 41 with MessageDialogBox

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

the class FilePropertiesDialog method getAcls.

/**
 * @param fileSummary
 */
protected void getAcls(RepositoryFile fileSummary) {
    // $NON-NLS-1$ //$NON-NLS-2$
    String url = contextURL + "api/repo/files/" + SolutionBrowserPanel.pathToId(fileSummary.getPath()) + "/acl";
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
    // This header is required to force Internet Explorer to not cache values from the GET response.
    builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    try {
        builder.sendRequest(null, new RequestCallback() {

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

            public void onResponseReceived(Request request, Response response) {
                if (response.getStatusCode() == Response.SC_OK) {
                    generalTab.setAclResponse(response);
                    if (permissionsTab != null) {
                        permissionsTab.setAclResponse(response);
                    }
                } 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.getLocalizedMessage(), 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) Request(com.google.gwt.http.client.Request) RequestException(com.google.gwt.http.client.RequestException)

Example 42 with MessageDialogBox

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

the class FilePropertiesDialog method getMetadata.

/**
 * @param fileSummary
 */
protected void getMetadata(RepositoryFile fileSummary) {
    String metadataUrl = contextURL + "api/repo/files/" + SolutionBrowserPanel.pathToId(fileSummary.getPath()) + "/metadata?cb=" + // $NON-NLS-1$ //$NON-NLS-2$
    System.currentTimeMillis();
    RequestBuilder metadataBuilder = new RequestBuilder(RequestBuilder.GET, metadataUrl);
    // This header is required to force Internet Explorer to not cache values from the GET response.
    metadataBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    metadataBuilder.setHeader("accept", "application/json");
    try {
        metadataBuilder.sendRequest(null, new RequestCallback() {

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

            public void onResponseReceived(Request request, Response response) {
                if (response.getStatusCode() == Response.SC_OK) {
                    if (response.getText() != null && !"".equals(response.getText()) && !response.getText().equals("null")) {
                        generalTab.setMetadataResponse(response);
                    }
                } 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.getLocalizedMessage(), 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) Request(com.google.gwt.http.client.Request) RequestException(com.google.gwt.http.client.RequestException)

Example 43 with MessageDialogBox

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

the class DatasourceAdminDialogController method showErrorDialog.

private void showErrorDialog(String titleKey, String messageKey) {
    MessageDialogBox b = new MessageDialogBox(messageBundle.getString(titleKey), messageBundle.getString(messageKey), false, false, true, messageBundle.getString("dialog.button.ok"));
    b.getElement().getStyle().setZIndex(Short.MAX_VALUE);
    b.center();
    b.show();
}
Also used : MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox)

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