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

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


        Set<JsJob> selectedJobs = getSelectedJobs();
        if ( selectedJobs != null && selectedJobs.size() > 0 ) {
          MessageDialogBox messageDialog =
              new MessageDialogBox( Messages.getString( "executeNow" ), Messages.getString( "executeNowStarted" ),
                  false, true, true );
          messageDialog.setCallback( new IDialogCallback() {
            public void okPressed() {
              // wait a little to refresh to give schedule time to update the last run
              Timer t = new Timer() {
                public void run() {
                  refresh();
                }
              };
              t.schedule( 2000 );
            }

            public void cancelPressed() {
            }
          } );
          messageDialog.center();
          controlJobs( selectedJobs, "triggerNow", RequestBuilder.POST, false );
        }
      }
    } );
    triggerNowButton.setEnabled( false );
    bar.add( triggerNowButton );

    // Add control schedule button
    controlScheduleButton.setCommand( new Command() {
      public void execute() {
        Set<JsJob> selectedJobs = getSelectedJobs();
        if ( selectedJobs != null && selectedJobs.size() > 0 ) {
          JsJob[] jobs = selectedJobs.toArray( new JsJob[selectedJobs.size()] );
          if ( "NORMAL".equals( jobs[0].getState() ) ) {
            controlJobs( selectedJobs, "pauseJob", RequestBuilder.POST, false );
          } else {
            controlJobs( selectedJobs, "resumeJob", RequestBuilder.POST, false );
          }
        }
      }
    } );
    controlScheduleButton.setEnabled( false );
    bar.add( controlScheduleButton );

    bar.addSpacer( 20 );

    // Add edit button
    editButton.setCommand( new Command() {
      public void execute() {
        Set<JsJob> selectedJobs = getSelectedJobs();
        if ( selectedJobs != null && selectedJobs.size() > 0 ) {
          JsJob[] jobs = selectedJobs.toArray( new JsJob[selectedJobs.size()] );
          final JsJob editJob = jobs[0];
          final String url =
              GWT.getHostPageBaseURL() + "api/repo/files/"
                  + SolutionBrowserPanel.pathToId( editJob.getFullResourceName() ) + "/canAccess?cb="
                  + System.currentTimeMillis() + "&permissions=" + READ_PERMISSION;
          RequestBuilder executableTypesRequestBuilder = new RequestBuilder( RequestBuilder.GET, url );
          try {
            executableTypesRequestBuilder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
            executableTypesRequestBuilder.sendRequest( null, new RequestCallback() {

              public void onError( Request request, Throwable exception ) {
                promptForScheduleResourceError( editJob );
              }

              public void onResponseReceived( Request request, Response response ) {
                if ( "true".equalsIgnoreCase( response.getText() ) ) {
                  editJob( editJob );
                } else {
                  promptForScheduleResourceError( editJob );
                }
              }
            } );
          } catch ( RequestException e ) {
            // showError(e);
          }
        }
      }
    } );

    editButton.setEnabled( false );
    editButton.setToolTip( Messages.getString( "editTooltip" ) );
    bar.add( editButton );

    // Add remove button
    scheduleRemoveButton.setCommand( new Command() {
      public void execute() {
        Set<JsJob> selectedJobs = getSelectedJobs();
        if ( selectedJobs != null && selectedJobs.size() > 0 ) {
          final PromptDialogBox prompt =
              new PromptDialogBox( Messages.getString( "warning" ), Messages.getString( "yes" ), Messages
                  .getString( "no" ), false, true );
          prompt.setContent( new Label( Messages.getString( "deleteConfirmSchedles", "" + selectedJobs.size() ) ) );

          prompt.setCallback( new IDialogCallback() {
            public void okPressed() {
              controlJobs( getSelectedJobs(), "removeJob", RequestBuilder.DELETE, true );
              prompt.hide();
            }
View Full Code Here


        new PromptDialogBox( Messages.getString( "fileUnavailable" ), Messages.getString( "yesDelete" ), Messages
            .getString( "no" ), false, true );
    prompt.setContent( new HTML( Messages.getString( "editScheduleResourceDoesNotExist",
        job.getFullResourceName() ) ) );

    prompt.setCallback( new IDialogCallback() {
      public void okPressed() {
        HashSet<JsJob> jobSet = new HashSet<JsJob>();
        jobSet.add( job );
        controlJobs( jobSet, "removeJob", RequestBuilder.DELETE, true );
        prompt.hide();
View Full Code Here

    Button browseButton = new Button( Messages.getString( "select" ) );
    browseButton.addClickHandler( new ClickHandler() {

      public void onClick( ClickEvent event ) {
        final SelectFolderDialog selectFolder = new SelectFolderDialog();
        selectFolder.setCallback( new IDialogCallback() {
          public void okPressed() {
            scheduleLocationTextBox.setText( selectFolder.getSelectedPath() );
          }

          public void cancelPressed() {
View Full Code Here

        }
        return isValid;
      }
    } );

    setCallback( new IDialogCallback() {
      @Override
      public void okPressed() {
        onSelect( scheduleNameTextBox.getText(), scheduleLocationTextBox.getText() );
      }
View Full Code Here

    AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() {

      public void onFailure( Throwable err ) {
        MessageDialogBox dialog =
            new MessageDialogBox( Messages.getString( "error" ), Messages.getString( "loginError" ), false, true, true ); //$NON-NLS-1$ //$NON-NLS-2$
        dialog.setCallback( new IDialogCallback() {
          public void cancelPressed() {
          }

          public void okPressed() {
            loginDialog.show();
View Full Code Here

  private static boolean showNewWindowOption = true;

  public MantleLoginDialog() {
    super( Messages.getString( "login" ), Messages.getString( "login" ), Messages.getString( "cancel" ), false, true ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    IDialogCallback myCallback = new IDialogCallback() {

      public void cancelPressed() {
      }

      @SuppressWarnings( "deprecation" )
      public void okPressed() {
        String path = Window.Location.getPath();
        if ( !path.endsWith( "/" ) ) { //$NON-NLS-1$
          path = path.substring( 0, path.lastIndexOf( "/" ) + 1 ); //$NON-NLS-1$
        }
        RequestBuilder builder = new RequestBuilder( RequestBuilder.POST, path + "j_spring_security_check" ); //$NON-NLS-1$
        builder.setHeader( "Content-Type", "application/x-www-form-urlencoded" ); //$NON-NLS-1$ //$NON-NLS-2$
        builder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
        RequestCallback callback = new RequestCallback() {

          public void onError( Request request, Throwable exception ) {
            outerCallback.onFailure( exception );
          }

          public void onResponseReceived( Request request, Response response ) {

            try {
              final String url = GWT.getHostPageBaseURL() + "api/mantle/isAuthenticated"; //$NON-NLS-1$
              RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, url );
              requestBuilder.setHeader( "accept", "text/plain" );
              requestBuilder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
              requestBuilder.sendRequest( null, new RequestCallback() {

                public void onError( Request request, final Throwable caught ) {
                  MessageDialogBox errBox =
                      new MessageDialogBox(
                          Messages.getString( "loginError" ), Messages.getString( "authFailed" ), false, false, true ); //$NON-NLS-1$ //$NON-NLS-2$
                  errBox.setCallback( new IDialogCallback() {
                    public void cancelPressed() {
                    }

                    public void okPressed() {
                      outerCallback.onFailure( caught );
                    }
                  } );
                  errBox.show();
                }

                public void onResponseReceived( Request request, Response response ) {
                  if ( "true".equalsIgnoreCase( response.getText() ) ) {
                    long year = 1000 * 60 * 60 * 24 * 365;
                    // one year into the future
                    Date expirationDate = new Date( System.currentTimeMillis() + year );
                    Cookies.setCookie( "loginNewWindowChecked", "" + newWindowChk.getValue(), expirationDate ); //$NON-NLS-1$ //$NON-NLS-2$
                    outerCallback.onSuccess( newWindowChk != null && newWindowChk.getValue() );
                  } else {
                    outerCallback.onFailure( new Throwable( Messages.getString( "authFailed" ) ) ); //$NON-NLS-1$
                  }
                }

              } );
            } catch ( final RequestException e ) {
              MessageDialogBox errBox =
                  new MessageDialogBox(
                      Messages.getString( "loginError" ), Messages.getString( "authFailed" ), false, false, true ); //$NON-NLS-1$ //$NON-NLS-2$
              errBox.setCallback( new IDialogCallback() {
                public void cancelPressed() {
                }

                public void okPressed() {
                  outerCallback.onFailure( e );
View Full Code Here

    public void onClick( ClickEvent event ) {
      if ( rolesListBox.getSelectedIndex() != -1 ) {
        MessageDialogBox warning = new MessageDialogBox( Messages.getString( "deleteRoleTitle" )
            , Messages.getString( "deleteRoleMessage" ), false, false, true, Messages.getString( "yesDelete" ), null
            , Messages.getString( "no" ) );
        warning.setCallback( new IDialogCallback() {
          @Override
          public void okPressed() {
            deleteRoles();
          }
View Full Code Here

    public void onClick( ClickEvent event ) {
      if ( usersListBox.getSelectedIndex() != -1 ) {
        MessageDialogBox warning = new MessageDialogBox( Messages.getString( "deleteUserTitle" )
            , Messages.getString( "deleteUserMessage" ), false, false, true, Messages.getString( "yesDelete" ), null
            , Messages.getString( "no" ) );
        warning.setCallback( new IDialogCallback() {
          @Override
          public void okPressed() {
            deleteUsers();
          }
View Full Code Here

          vp.add( new Label( Messages.getString( "permissionsWillBeLostQuestion" ) ) ); //$NON-NLS-1$
          final PromptDialogBox permissionsOverwriteConfirm =
              new PromptDialogBox(
                  Messages.getString( "permissionsWillBeLostConfirmMessage" ), Messages.getString( "ok" ), Messages.getString( "cancel" ), false, true, vp ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

          final IDialogCallback callback = new IDialogCallback() {

            public void cancelPressed() {
              permissionsOverwriteConfirm.hide();
              inheritsCheckBox.setValue( false );
              dirty = false;
View Full Code Here

    if ( isScheduleConflict ) {
      final MessageDialogBox dialogBox =
          new MessageDialogBox( Messages.getString( "blockoutTimeExists" ), //$NON-NLS-1$
              conflictMessage.toString(), false, false, true, updateScheduleButtonText, showContinueButton
                  ? continueButtonText : null, null );
      dialogBox.setCallback( new IDialogCallback() {
        // If user clicked on 'Continue' we want to add the schedule. Otherwise we dismiss the dialog
        // and they have to modify the recurrence schedule
        @Override
        public void cancelPressed() {
          // User clicked on continue, so we need to proceed adding the schedule
View Full Code Here

TOP

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

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.