Package org.pentaho.gwt.widgets.client.dialogs

Examples of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox


  }

  protected void onOk() {
    String name = scheduleNameTextBox.getText();
    if ( !NameUtils.isValidFileName( name ) ) {
      MessageDialogBox errorDialog =
          new MessageDialogBox( Messages.getString( "error" ), Messages.getString( "prohibitedNameSymbols", name,
              NameUtils.reservedCharListForDisplay( " " ) ), false, false, true ); //$NON-NLS-1$ //$NON-NLS-2$
      errorDialog.center();
      return;
    }

    // check if has parameterizable
    WaitPopup.getInstance().setVisible( true );
    String urlPath = URL.encodePathSegment( NameUtils.encodeRepositoryPath( filePath ) );

    RequestBuilder scheduleFileRequestBuilder;
    final boolean isXAction;

    if ( ( urlPath != null ) && ( urlPath.endsWith( "xaction" ) ) ) {
      isXAction = true;
      scheduleFileRequestBuilder = new RequestBuilder( RequestBuilder.GET, GWT.getHostPageBaseURL() + "api/repos/" + urlPath
          + "/parameterUi" );
    } else {
      isXAction = false;
      scheduleFileRequestBuilder = new RequestBuilder( RequestBuilder.GET, GWT.getHostPageBaseURL() + "api/repo/files/" + urlPath
          + "/parameterizable" );
    }

    scheduleFileRequestBuilder.setHeader( "accept", "text/plain" );
    scheduleFileRequestBuilder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
    try {
      scheduleFileRequestBuilder.sendRequest( null, new RequestCallback() {

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

        public void onResponseReceived( Request request, Response response ) {
          WaitPopup.getInstance().setVisible( false );
          if ( response.getStatusCode() == Response.SC_OK ) {
View Full Code Here


    final boolean isXAction = isXAction( urlPath );

    try {
      scheduleFileRequestBuilder.sendRequest( null, new RequestCallback() {
        public void onError( Request request, Throwable exception ) {
          MessageDialogBox dialogBox =
              new MessageDialogBox( Messages.getString( "error" ), exception.toString(), false, false, true ); //$NON-NLS-1$
          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, true ); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
            dialogBox.center();
          }
        }
      } );
    } catch ( RequestException e ) {
      MessageDialogBox dialogBox =
          new MessageDialogBox( Messages.getString( "error" ), e.toString(), false, false, true ); //$NON-NLS-1$
      dialogBox.center();
    }
  }
View Full Code Here

    try {
      scheduleFileRequestBuilder.sendRequest( null, new RequestCallback() {

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

        public void onResponseReceived( Request request, Response response ) {
          if ( response.getStatusCode() == Response.SC_OK ) {
            final JSONObject scheduleRequest = new JSONObject();
            scheduleRequest.put( "inputFile", new JSONString( filePath ) ); //$NON-NLS-1$

            // Set job name
            if ( StringUtils.isEmpty( getOutputName() ) ) {
              scheduleRequest.put( "jobName", JSONNull.getInstance() ); //$NON-NLS-1$
            } else {
              scheduleRequest.put( "jobName", new JSONString( getOutputName() ) ); //$NON-NLS-1$
            }

            // Set output path location
            if ( StringUtils.isEmpty( getOutputLocationPath() ) ) {
              scheduleRequest.put( "outputFile", JSONNull.getInstance() ); //$NON-NLS-1$
            } else {
              scheduleRequest.put( "outputFile", new JSONString( getOutputLocationPath() ) ); //$NON-NLS-1$
            }

            // BISERVER-9321
            scheduleRequest.put( "runInBackground", JSONBoolean.getInstance( true ) );

            String responseMessage = response.getText();
            final boolean hasParams = hasParameters( responseMessage, isXAction );

            RequestBuilder emailValidRequest =
                new RequestBuilder( RequestBuilder.GET, contextURL + "api/emailconfig/isValid" ); //$NON-NLS-1$
            emailValidRequest.setHeader( "accept", "text/plain" ); //$NON-NLS-1$ //$NON-NLS-2$
            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 =
                      new MessageDialogBox( Messages.getString( "error" ), exception.toString(), false, false, true ); //$NON-NLS-1$
                  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();
                    } else if ( isEmailConfValid ) {
                      ScheduleEmailDialog scheduleEmailDialog =
                          new ScheduleEmailDialog( null, filePath, scheduleRequest, null, null );
                      scheduleEmailDialog.center();
                    } else {
                      // just run it
                      RequestBuilder scheduleFileRequestBuilder =
                          new RequestBuilder( RequestBuilder.POST, contextURL + "api/scheduler/job" ); //$NON-NLS-1$
                      scheduleFileRequestBuilder.setHeader( "Content-Type", "application/json" ); //$NON-NLS-1$//$NON-NLS-2$
                      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, true ); //$NON-NLS-1$
                            dialogBox.center();
                          }

                          @Override
                          public void onResponseReceived( Request request, Response response ) {
                            if ( response.getStatusCode() == 200 ) {
                              MessageDialogBox dialogBox =
                                  new MessageDialogBox(
                                      Messages.getString( "runInBackground" ), Messages.getString( "backgroundExecutionStarted" ), //$NON-NLS-1$ //$NON-NLS-2$
                                      false, false, true );
                              dialogBox.center();
                            } else {
                              MessageDialogBox dialogBox =
                                  new MessageDialogBox(
                                      Messages.getString( "error" ), Messages.getString( "serverErrorColon" ) + " " + response.getStatusCode(), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-2$ //$NON-NLS-3$
                                      false, false, true );
                              dialogBox.center();
                            }
                          }

                        } );
                      } catch ( RequestException e ) {
                        MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString( "error" ), e.toString(), //$NON-NLS-1$
                            false, false, true );
                        dialogBox.center();
                      }
                    }

                  }
                }
              } );
            } catch ( RequestException e ) {
              MessageDialogBox dialogBox =
                  new MessageDialogBox( Messages.getString( "error" ), e.toString(), false, false, true ); //$NON-NLS-1$
              dialogBox.center();
            }

          } else {
            MessageDialogBox dialogBox =
                new MessageDialogBox(
                    Messages.getString( "error" ), Messages.getString( "serverErrorColon" ) + " " + response.getStatusCode(), false, false, true ); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
            dialogBox.center();
          }
        }

      } );
    } catch ( RequestException e ) {
      MessageDialogBox dialogBox =
          new MessageDialogBox( Messages.getString( "error" ), e.toString(), false, false, true ); //$NON-NLS-1$
      dialogBox.center();
    }
  }
View Full Code Here

    requestBuilder.setHeader( "accept", "text/plain" );
    try {
      requestBuilder.sendRequest( null, new RequestCallback() {

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

        public void onResponseReceived( Request request, Response response ) {
          Document doc = XMLParser.parse( response.getText() );
          NodeList updates = doc.getElementsByTagName( "update" ); //$NON-NLS-1$
          if ( updates.getLength() > 0 ) {
            FlexTable updateTable = new FlexTable();
            updateTable.setStyleName( "backgroundContentTable" ); //$NON-NLS-1$
            updateTable.setWidget( 0, 0, new Label( Messages.getString( "version" ) ) ); //$NON-NLS-1$
            updateTable.setWidget( 0, 1, new Label( Messages.getString( "type" ) ) ); //$NON-NLS-1$
            updateTable.setWidget( 0, 2, new Label( Messages.getString( "os" ) ) ); //$NON-NLS-1$
            updateTable.setWidget( 0, 3, new Label( Messages.getString( "link" ) ) ); //$NON-NLS-1$
            updateTable.getCellFormatter().setStyleName( 0, 0, "backgroundContentHeaderTableCell" ); //$NON-NLS-1$
            updateTable.getCellFormatter().setStyleName( 0, 1, "backgroundContentHeaderTableCell" ); //$NON-NLS-1$
            updateTable.getCellFormatter().setStyleName( 0, 2, "backgroundContentHeaderTableCell" ); //$NON-NLS-1$
            updateTable.getCellFormatter().setStyleName( 0, 3, "backgroundContentHeaderTableCellRight" ); //$NON-NLS-1$

            for ( int i = 0; i < updates.getLength(); i++ ) {
              Element updateElement = (Element) updates.item( i );
              String version = updateElement.getAttribute( "version" ); //$NON-NLS-1$
              String type = updateElement.getAttribute( "type" ); //$NON-NLS-1$
              String os = updateElement.getAttribute( "os" ); //$NON-NLS-1$
              // String title = updateElement.getAttribute("title");
              String downloadURL = updateElement.getElementsByTagName( "downloadurl" ).item( 0 ).toString(); //$NON-NLS-1$
              downloadURL = downloadURL.substring( downloadURL.indexOf( "http" ), downloadURL.indexOf( "]" ) ); //$NON-NLS-1$ //$NON-NLS-2$
              updateTable.setWidget( i + 1, 0, new Label( version ) );
              updateTable.setWidget( i + 1, 1, new Label( type ) );
              updateTable.setWidget( i + 1, 2, new Label( os ) );
              updateTable
                  .setWidget(
                    i + 1,
                    3,
                    new HTML(
                      "<A HREF=\"" + downloadURL + "\" target=\"_blank\" title=\"" + downloadURL + "\">" + Messages
                        .getString( "download" ) + "</A>" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
              updateTable.getCellFormatter().setStyleName( i + 1, 0, "backgroundContentTableCell" ); //$NON-NLS-1$
              updateTable.getCellFormatter().setStyleName( i + 1, 1, "backgroundContentTableCell" ); //$NON-NLS-1$
              updateTable.getCellFormatter().setStyleName( i + 1, 2, "backgroundContentTableCell" ); //$NON-NLS-1$
              updateTable.getCellFormatter().setStyleName( i + 1, 3, "backgroundContentTableCellRight" ); //$NON-NLS-1$
              if ( i == updates.getLength() - 1 ) {
                // last
                updateTable.getCellFormatter().setStyleName( i + 1, 0, "backgroundContentTableCellBottom" ); //$NON-NLS-1$
                updateTable.getCellFormatter().setStyleName( i + 1, 1, "backgroundContentTableCellBottom" ); //$NON-NLS-1$
                updateTable.getCellFormatter().setStyleName( i + 1, 2, "backgroundContentTableCellBottom" ); //$NON-NLS-1$
                updateTable.getCellFormatter().setStyleName( i + 1, 3, "backgroundContentTableCellBottomRight" ); //$NON-NLS-1$
              }
            }
            PromptDialogBox versionPromptDialog =
                new PromptDialogBox(
                    Messages.getString( "softwareUpdateAvailable" ), Messages.getString( "ok" ), null, false, true, updateTable ); //$NON-NLS-1$ //$NON-NLS-2$
            versionPromptDialog.center();
          } else {
            MessageDialogBox dialogBox =
                new MessageDialogBox(
                    Messages.getString( "softwareUpdates" ), Messages.getString( "noUpdatesAvailable" ), false, false, true ); //$NON-NLS-1$ //$NON-NLS-2$
            dialogBox.center();
          }
        }
      } );
    } catch ( RequestException e ) {
      Window.alert( e.getMessage() );
View Full Code Here

        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, true ); //$NON-NLS-1$ //$NON-NLS-2$
          dialogBox.center();
        }
      } );
    } catch ( RequestException e ) {
      Window.alert( e.getMessage() );
      // showError(e);
View Full Code Here

        try {
          deleteFilesRequestBuilder.sendRequest( filesList, new RequestCallback() {

            @Override
            public void onError( Request request, Throwable exception ) {
              MessageDialogBox dialogBox =
                  new MessageDialogBox( Messages.getString( "error" ), Messages.getString( "couldNotDeleteFile" ), //$NON-NLS-1$ //$NON-NLS-2$
                      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 MessageDialogBox( Messages.getString( "error" ), Messages.getString( "couldNotDeleteFile" ), //$NON-NLS-1$ //$NON-NLS-2$
                  false, false, true );
          dialogBox.center();
          event.setMessage( Messages.getString( "couldNotDeleteFile" ) );
          EventBusUtil.EVENT_BUS.fireEvent( event );
        }
      }
    };
View Full Code Here

          createDirRequestBuilder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
          createDirRequestBuilder.sendRequest( "", new RequestCallback() {

            @Override
            public void onError( Request createFolderRequest, Throwable exception ) {
              MessageDialogBox dialogBox =
                  new MessageDialogBox(
                      Messages.getString( "error" ), Messages.getString( "couldNotCreateFolder", folderNameTextBox.getText() ), //$NON-NLS-1$ //$NON-NLS-2$
                      false, false, true );
              dialogBox.center();
              event.setMessage( Messages.getString( "couldNotCreateFolder", folderNameTextBox.getText() ) );
              EventBusUtil.EVENT_BUS.fireEvent( event );
            }

            @Override
View Full Code Here

        try {
          deleteFilesRequestBuilder.sendRequest( filesList, new RequestCallback() {

            @Override
            public void onError( Request request, Throwable exception ) {
              MessageDialogBox dialogBox =
                  new MessageDialogBox( Messages.getString( "error" ), Messages.getString( "couldNotDeleteFolder" ), //$NON-NLS-1$ //$NON-NLS-2$
                      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 MessageDialogBox( Messages.getString( "error" ), Messages.getString( "couldNotDeleteFolder" ), //$NON-NLS-1$ //$NON-NLS-2$
                        false, false, true );
                dialogBox.center();
                event.setMessage( Messages.getString( "couldNotDeleteFolder" ) );
                EventBusUtil.EVENT_BUS.fireEvent( event );
              }
            }

          } );
        } catch ( RequestException e ) {
          MessageDialogBox dialogBox =
              new MessageDialogBox( Messages.getString( "error" ), Messages.getString( "couldNotDeleteFolder" ), //$NON-NLS-1$ //$NON-NLS-2$
                  false, false, true );
          dialogBox.center();
          event.setMessage( Messages.getString( "couldNotDeleteFolder" ) );
          EventBusUtil.EVENT_BUS.fireEvent( event );
        }
      }
    };
View Full Code Here

    };
    IDialogValidatorCallback validatorCallback = new IDialogValidatorCallback() {
      public boolean validate() {
        boolean isValid = !"".equals( textBox.getText() ) && textBox.getText() != null; //$NON-NLS-1$
        if ( !isValid ) {
          MessageDialogBox dialogBox =
              new MessageDialogBox(
                  Messages.getString( "error" ), Messages.getString( "urlNotSpecified" ), false, false, true ); //$NON-NLS-1$ //$NON-NLS-2$
          dialogBox.center();
        }
        return isValid;
      }
    };
    PromptDialogBox promptDialog =
View Full Code Here

        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( "mondrianSchemaCacheFlushedSuccessfully" ), false, false, true ); //$NON-NLS-1$ //$NON-NLS-2$
          dialogBox.center();
        }
      } );
    } catch ( RequestException e ) {
      Window.alert( e.getMessage() );
      // showError(e);
View Full Code Here

TOP

Related Classes of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.